Implementing Quantcast Easy Tag for Advertise in Google Tag Manager (GTM)

Follow the process below to ensure strong campaign performance and robust insights.


  • Do not alter the code. Any edits to the code may result in the tag not collecting data.
  • The tag does not interfere with your page load. Quantcast tag is asynchronous, meaning, it loads in the background. See here for more technical details.

What you need to continue:

  • Quantcast P-code <P-CODE>
  • Conversion Page Label <Conversion Label>

Add the Quantcast Tag to your Conversion Activity

  1. Log into GTM, click Add A New Tag


2.  Select Tag Configuration to open the GTM Tag Library


3. Find Quantcast Advertise in the Library

  • IMPORTANT: Select the Quantcast Advertise tag type


4. Place the P-Code <p-code>

5. Place the Conversion Page label <INSERT CONVERSION LABEL>

  • The Conversion Page Label allows Quantcast to collect your conversion activity separately from the rest of the page data.  This is required for campaign configuration.
  • Quantcast Advertise labels always begin with a _fp.event, and this has to be included. (For example, “_fp.event.Purchase Confirmation” would be appropriate for a Purchase Confirmation tag.)

6. Add Revenue and Order ID by clicking the box with the + and selecting the Google Tag Manger Variable for the respective variable.

  • See section “Adding Variables for Data Pass Back” at the end of the doc if you do not have variables created.  
  • Using Google Analytics E-commerce?  Use your GA data layer to enable data passback. See  “Using GA E-commerce Data Layer” below.

7. Click Triggering

GTM Convesrion page

8. Select your Conversion Trigger

  • See section “Creating a Trigger” if you do not have a Conversion Page Trigger created.

GTM Conversion Trigger

9.Your tag should look like the below. Click Save.

GTM Conversion Trigger complete

10. Name the tag you have created. We recommend using “Quantcast Conversion Tag”.

11. Click Save.

Name and save conversion tag

Your Conversion Tag setup is complete!  Move on to the next step to finish setting up the rest of your tags.

Remaining Site Activity Setup

Navigate to a new Quantcast Advertise template (steps 1 and 2 in Conversion Tag process).

1. Place the P-Code provided by Quantcast.

      1. P-Codes are case sensitive and 15 characters in length
      2. This is the only box you have to fill in!

2. Select Triggering

remaining tags pcode and trigger

3. Select the All Pages trigger.

all pages trigger

4. Select Add Exception to exclude the conversion page.  

add exception

5. Select the Trigger for your Conversion Page and click Save

Conversion tag exception

6. Give the tag a name. We recommend using “Quantcast Advertise Remaining Pages”.

7. Click Save.

remaining page save

8. Navigate back to the GTM Account Page and click the red Publish button on the upper right. This will publish the Quantcast tag to your site.


9. Click Publish again after reviewing your changes


10. Add a description of the tag you are publishing and select Continue or select Skip to proceed without a description.


You are done!  Please notify your Quantcast rep so that they can confirm your tags are collecting data.  

Additional Instructions:

Creating a Trigger: Triggers govern when a tag is fired or not fired.

1. Select Triggering and click the + in the upper right to create a new trigger.


2. Click on Trigger Configuration


3. Select Page View from the Trigger Type


4. Enter the criteria to identify the page for which you want to create a trigger. Select Some Page Views.

  • In this example, we are using “Page URL contains”.


5. Click Save in the upper right. A window will prompt you to name your Trigger.

6. Enter a name that reflects the function of the Trigger. E.g. Conversion Page

7. Click Save


8. You Trigger is now ready to use

Adding Variables for Data Passback

1. Generate data on the page: There are various ways to complete this step.  Below is the most common via a data layer.

  • Update your page code to capture the data you want to collect in the data layer (e.g., order ID, revenue, customer type, etc). This code must be added before the Google Tag Manager Container tag to ensure the data will be available. If the data layer is added after Google Tag Manager, your values will pass back as “undefined”.


2. Indicate to GTM the location of the data: In this example, we will set up OrderID.

  • Click Variables from the GTM Menu.


  • Click New under User-Defined Variables to open the setup menu.


  • Click Untitled Variable and name your variable.
  • Click the Variable Configuration area.


  • Select the method which GTM will look for data pass back. We will select Data Layer Variable from this menu.


  • Add the Data Layer Variable Name in the field.
    • We are using orderid as this is the name of the variable in the data layer. Your Data Layer Variable Name may be different. Leave all other settings as-is.


  • Click Save on the upper right corner once this is complete.
  • Repeat the steps above to add additional variables.
  • Once your User Defined Variables are setup, they will be visible on the menu.
  • Once you created the variables, return to the Conversion Tag setup to complete the implementation.

Using E-commerce Data Layer – You can find more information on the official Google Developer Documentation

  • Identify the information you want to passback.  Here we show 4 values: id, revenue, customer type, & category (below we will show how to set up data passback for Revenue and Category).
    • Note You cannot use conventional JavaScript to access array members. In Google Tag Manager, you can push Arrays into the Data Layer. However, the Data Layer Variable type, which you use to retrieve values stored in the Data Layer, does not support the square bracket notation in its fields. Instead, you need to use a special, proprietary format to access Array members.
  • Access your GTM Interface and select your workspace.
  • Enter the data layer variable name using the below as a guide to build the naming conventions
    • ecommerce.purchase.actionField.revenue
    • ecommerce.purchase.actionField.customertype
    • ecommerce.purchase.products.productsArrayNumber.category
  • For revenue we have entered ecommerce.purchase.actionField.revenue
  • Select Save
  • For product category, since we have multiple products in the array and want to retrieve only the category of the first product, we have entered ecommerce.purchase.products.0.category
  • Select “Save”
  • Repeat this process to create the remaining variables you want to collect  (e.g. Customer Type, Order ID, etc) 
  • To collect the data in the Quantcast tag, navigate to your Quantcast Conversion Tag by selecting the “Tags” menu on the interface and selecting your conversion tag.
  • Then, replace the existing placeholders in your tag by your newly created variables:
    • INSERT+ORDER+ID: QC_Ecommerce_OrderID
    • INSERT+REVENUE: QC_Ecommerce_Revenue
    • INSERT+PRODUCT+CATEGORY: QC_Ecommerce_Category
    • INSERT+CUSTOMER+TYPE: QC_Ecommerce_customerType
  • Save your modifications and publish your changes.
  • You are done!




Verify tag implementation using the Quantcast Tag Inspector.
The Quantcast Tag Inspector is a Google Chrome plugin that helps you check 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. Learn more about the Quantcast Inspector.

You are done! Please notify your Quantcast rep so that they can confirm your tags are collecting data.