Use this guide to implement a Quantcast Tag in Google Tag Manager if it has been customized by the Quantcast Account Team; for instance, to support multiple product category passback.
Video Overview
The below videos walk through the exact steps to implement the Quantcast tag in Google Tag Manager. The steps are in text form further down the guide.
- Quantcast EasyTag Implementation
- Quantcast Conversion Tag Implementation
IMPLEMENT THE QUANTCAST EASY TAG
Create a New Tag
Tags are added to Containers and associated with rules that determine when they will fire.
- At the Google Tag Manager Overview screen click ‘Add a new tag’
- Then click ‘Choose a tag type’ to begin set up
- Select the ‘Custom HTML Tag’ type
Tag Configuration
Paste the Quantcast Easy Tag provided by your Quantcast Account Team into the Custom HTML field and click Save. Don’t make modifications to the tag.
Add a Trigger
Click the 'Choose a trigger to make this tag fire' text area
Select the All Pages rule. Click Save on upper right corner.
Name the Tag
If you haven't yet renamed the Untitled Tag, you'll be prompted to do so. Call this tag 'Quantcast All Pages Tag' and click the save button.
Publish the Container
Click the 'Submit' button on the upper right.
Version Configuration
Prior to clicking the Publish button you’ll have the option to enter a Version Name and Version Description. Consider adding a short, descriptive name and brief description of the changes in this workspace. This information can be helpful at a later date when looking back at changes to the container. Click Publish when you are ready.
IMPLEMENT THE QUANTCAST CONVERSION TAG
Create a New Tag
- At the Google Tag Manager Overview screen click ‘Add a new tag’
- Then click ‘Choose a tag type to begin set up’
- Select the ‘Custom HTML Tag’ type
Tag Configuration
Paste the Quantcast Conversion tag (provided by your Quantcast Account Team) into the Custom HTML field and click Save. Don’t make modifications to this tag outside of adjusting Quantcast macro placeholders with GTM Variables.
Optionally, you can replace standard Quantcast placeholders with GTM Variables in this step to enable data pass back. Please see “Adding Data Passback to the Quantcast Tag” below for more details. If you’re not sure what your GTM Variables are, you can finalize Tag Configuration now and return later.
Add a Trigger
Click the 'Choose a trigger to make this tag fire' text area
Select the respective GTM Trigger for your conversion event. See adding a trigger section below if you do not have a conversion event trigger. Click Save on upper right corner.
Name the Tag
If you haven't renamed the Untitled Tag, you'll be prompted to do so. Call this tag 'Quantcast Conversion Tag' and click the save button.
Publish the Container
Click the 'Submit' button on the upper right to publish the container.
Version Configuration
Prior to clicking the Publish button you’ll have the option to enter a Version Name and Version Description. Consider adding a short, descriptive name and brief description of the changes in this workspace. This information can be helpful at a later date when looking back at changes to the container. Click Publish when you are ready.
Adding a Conversion Event Trigger
A Trigger is a rule that can be assigned in Google Tag Manager to ‘trigger’ tags at different points during the customer experience. To create a new Trigger, click the + button on the upper right on the Choose a Trigger screen.
Choose an appropriate Trigger Type and setup rules in line with your specific needs.
The following example shows a Trigger setup to fire when a URL contains quantcast.com/thankyou
Once your Trigger is set up, click save and you will be prompted to name your Trigger. Enter a name for your Trigger. Click Save again.
This will automatically assign your newly created trigger to the Quantcast Conversion tag. Click save once you have added your conversion trigger. And move to the Name the Tag ste
ADDING DATA PASSBACK TO THE QUANTCAST TAG
Data Passback can be used to populate dynamic values within a tag. For example, the revenue
amount or order ID of a particular purchase can be included as a value in the tag. For data passback to function, there may be changes that will need to be made both on the website by a developer outside of Google Tag Manager and within Google Tag Manager. This process makes use of Google’s dataLayer.
Add the dataLayer to the Site
On the website there will need to be some JavaScript code that will add data to the data layer. This code should be on the page before the Google Tag Manager Container tag to ensure the data will be available to Tag Manager. For example:
Pass dataLayer variables to Google Tag Manager
To add a Variable in Google Tag Manager, first choose 'Variables' in the Menu and then click 'New'. Click on the box to open the 'Choose Variable Type' menu. Select 'Data Layer Variable'.
Enter the name of the variable used in the site dataLayer (orderid, for example) into the Data Layer Variable Name field in GTM. Click Save.
Lastly, give it a Variable Name to finalize creating your GTM Variable.
Example of creating a GTM Variable for Revenue:
Pass Back your Variables to Quantcast
Now we need to tell GTM where the data goes. Quantcast uses two standard placeholders for GTM
Variables. There are normally two per variable placeholder. One in the script and one in the noscript section. If your Quantcast Pixel requires revenue and order id data passback, this will require us to replace 4 macro placeholders in total.
– INSERT+REVENUE is the standard placeholder for revenue.
– INSERT+ORDER+ID is the standard placeholder for order id.
Find the corresponding placeholders in the Quantcast pixel and replace them with the Variable Name between two open and closing curly brackets. For example, my previous Variable Name for my Order ID is Order ID, so I would replace INSERT+ORDER+ID with {{Order ID}}. My Variable Name for Revenue is Revenue, so I would replace INSERT+REVENUE with {{Revenue}}. This is what a fully adjusted pixel will look like when all revenue and order ID macro placeholders are updated. Your pixel may have additional passback placeholders like Product Category, Customer Type, or Revenue Bucket, etc. All of these can be passed back to Quantcast using a similar workflow.
Be sure to Save and Publish your changes.
Verify the Quantcast Tag is Firing on your Site
After you’ve published all changes, use a browser tool such as Quantcast Tag Inspector, Ghostery or Chrome Developer Tools, to verify that your Quantcast tags are firing on all pages. A call to the Quantcast server, as visible from Chrome Developer Tools, will resemble this:
http://pixel.quantserve.com/pixel;r=2097142827;labels=_fp.event.Purchase%20Confirmation;orderid=123456789;revenue=100;event=refresh;rf=0;a=p-1234557891234;url=http%3A%2F%2Fwww.quantcast.com%2F;ref=http%3A%2F%2Fwww.quantcast.com%2F;fpan=0;fpa=P0-1474956269-1509051675707;ns=1;ce=1;cm=;je=0;sr=2752x1152x24;enc=n;dst=1;et=1519851455672;tzo=480;ogl=
Read here for additional information on verifying if Quantcast tags are successfully implemented on your pages.