1. Code
  2. OpenCart

Understanding Marketing Campaigns in OpenCart


In any business, once you've finished the basic setup, one of the most important things to keep your eye on is the net outcome. Obviously, you would always look for new tricks to improve sales, whether it's through different promotional campaigns or providing discounts. 

In the era of e-commerce too, it's no different ball game—you need to be alert and prompt to apply the strategies which keep you alive in the competitive market. In this tutorial, we'll look at running a marketing campaign in the context of OpenCart, which is used to boost the sales and impact on your business's bottom line.

From OpenCart 2.0.x onwards, you'll see a new feature included: "Marketing Tracking". It allows you to create marketing campaigns from the back-end. Let's try to understand the basic concept of a marketing campaign before we go ahead and explore marketing campaigns with OpenCart.

The Concept of Marketing Campaigns

Here's Investopedia's definition of a marketing campaign:

Specific activities designed to promote a product, service or business. A marketing campaign is a coordinated series of steps that can include promotion of a product through different mediums (television, radio, print, online) using a variety of different types of advertisements.

So basically, it's an advertisement of your product through different media. However, what we're interested in is the online marketing campaign method in the context of this article. In this method, you'll focus on creating banner ads and tracking the sales they generate.

Let's go through a simple example to understand this. Christmas is coming soon and you want to promote certain products of your online store as part of a "Christmas Campaign". So you're creating specific banners related to those products and putting them on your site and on other third-party sites too. 

Of course, third-party sites won't show your campaign free of charge, so you'll have to pay as per the contract. Each campaign is identified by an unique link which allows you to track the sales generated by the specific campaign. Thus, it allows you to analyze the traffic and sales generated by third-party campaigns, and whether you should continue with them or not!

How to Create Marketing Campaigns From the Back-End

Now, let's go through the process of creating campaigns from the back-end of OpenCart. Log in to the back-end and navigate to Marketing > Marketing.

Campaign Listing

As you can see in the above screenshot, it'll list all the running campaigns in your site at the moment. It also provides a useful search interface to filter the campaigns listing. So far, there are no campaigns, so let's create a one. Click on the + sign at the top right to create a new campaign.

New Campaign

Fill in the basic details and you're good to go. You don't need to fill in Tracking Code since it's already populated with the unique code for the campaign being created. You'll also see a couple of example links for this campaign, but we'll get back to that in the next section. For now, just hit the Save button to create the campaign.

Set Up the Tracking Module in the Front-End

So, we've created the campaign and now we're ready to start tracking it! As I mentioned earlier, you could either put campaigns on your own site or distribute them to third-party sites. 

For the sake of simplicity, we'll create a campaign code and put it on the home page of our own site using the "HTML Content" module of OpenCart! For those who are not familiar with this module, the "HTML Content" module allows you to create a custom HTML content block in the front-end.

Navigate to Extensions > Modules and enable the HTML Content module if it's not enabled already. Once enabled, click on the edit button to create a new instance of the module as shown in the following screenshot.

Edit HTML Content Module

Fill in the details as shown in the following screenshot. Among the other fields, the Description field is important, and I've used HTML code which will display a linked image. Also, make sure to keep the Status to Enabled.

Create Christmas Campaign Module

Here's the HTML code:

It's the simplest form of code which will display an image linked to your campaign. In the above example, we've used the "Apple Cinema 30" product as our example campaign, which means that clicking on the image will open the product detail page. 

The important thing to note here is "tracking=560fd1cb5c4e7" which will track the clicks. Make sure that you use the tracking code from the "Christmas Campaign". Obviously, you could use any other image instead of the image used in above example. Now, save the module and it'll be displayed in the list as shown here.

Christmas Module

Now, the last step is to assign the module we've just created to the home page layout. Navigate to System > Design > Layouts. Edit the Home layout and add a new module HTML Content > Christmas Campaign to the Content Top position, and save the changes.

Assign Christmas Campaign Module to Content Top Position

Head over to the front-end home page. You should be able to see the module we've just created!

Front-End Preview

Follow Up the Statistics

So, you've set up the campaign and it's displayed on the front-end as well, but now what? Go ahead and click on the Christmas Campaign module on the home page, which will take you to the product detail page, and complete the order through to the end. Once the order is placed, navigate to Marketing > Marketing to list the campaigns in the back-end.


The important columns to note are Clicks and Orders. They show how many times our campaign module was clicked and if they were converted to actual orders or not! So in this way, you could create as many campaigns you want to create, and track whether they were successful or not!


In this article, we covered the important marketing concept of campaigns. We also created a campaign in OpenCart and published it to the home page. Use the comment feed to post your queries and suggestions!

Furthermore, for those of you who have enjoyed our OpenCart content thus far, we also offer a wide variety of OpenCart software on CodeCanyon that you may find useful for study or for integrating into your application.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.