- Print
- DarkLight
A comprehensive tagging strategy sets your campaign up for success and provides robust audience insights. The following instructions walk you through the process for placing Q Pixels for advanced conversion tracking in Opencart.
đź’ˇ Reminder:
|
⚠️ What you need to continue: Q Pixel (tag code available in the Quantcast Platform on the Q Pixel page) |
Q Pixel in Opencart
Open the success.php file found in /catalog/controller/checkout/success.php
Copy the following 2 lines:
$this->session->data['AddShoppersAmount'] = $this->cart->getTotal();
$this->session->data['AddShoppersOrderID'] = $this->session->data['order_id'];
Paste the two copied lines immediately after the line that reads:
“if (isset($this->session->data['order_id'])) {"
Open the success.tpl file found in /catalog/view/theme/default/template/common/success.tpl
You will find the two lines of code that were just pasted here.
Update the "qacct" field in the code with your Quantcast p-code. You can find the location for this code in the account code snippet below.
<script type=”text/javascript”>
window._qevents = window._qevents || [];
(function() {
var elem = document.createElement('script');
elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
elem.async = true;
elem.type = "text/javascript";
var scpt = document.getElementsByTagName('script')[0];
scpt.parentNode.insertBefore(elem, scpt);
})();
window._qevents.push({
"qacct": "p-xxxxxxxxxxxxx",
"labels": "_fp.event.PageView, _fp.event.Purchase"
"orderid": "AddShoppersOrderID",
"revenue": "AddShoppersAmount",
"event": "refresh"
});
</script>
6. Paste the updated script into the “success.tpl” file and save.
Verify tag implementation using the Quantcast Tag Inspector
The Quantcast Tag Inspector is a Google Chrome plugin that checks whether your Quantcast Tag and Audience Segments are implemented correctly. Install the Inspector to review individual pages of your site, and make sure the audience segments are firing correctly. For more information, see the Inspect Your Tag help document.
You are done! Please check the Q Pixel app to confirm that your tags are collecting data. If you are not seeing any activity, reach out to [email protected] or submit a Help Center request at www.quantcast.com. For more information on tagging, see our Tagging Overview article.