Implement Q Pixel with Google Tag Manager

Prev Next

Quantcast is fully integrated with Google Tag Manager. Installing your tag is now easier than ever.


💡 Reminder:

  • Do not alter the code. Any edits to the code may result in the tag not firing.

  • The tag does not interfere with your page load because it is asynchronous (it loads in the background). See Get Started with Quantcast Tagging for more technical details.  

⚠️ What you need to continue:

Q Pixel (tag code available in the Quantcast Platform on the Q Pixel page)

Download Your Personalised GTM Container File

  1. Navigate to the Q-Pixel section within the platform

  2. Select “Install Q Pixel”

  3. Expand the Google tag manager instructions and download your container file.

  4. This will download a container file to your local machine named “quantcast_gtm_PCODE.json”

Import Your Container File to Google Tag Manager

To complete this step you must have the relevant access to the Google Tag Manager container you would like to deploy the pixel within. If you do not have access you can forward the file to the relevant teams to be actioned.

  1. Navigate to Google Tag Manager and select the container you wish to deploy the pixel within

  2. Navigate to the admin panel

  3. Select “Import Container”

  4. Select your Quantcast container file for upload

  5. Define the workspace you which to push your changes to

  6. IMPORTANT!! Ensure you select the ‘Merge’ option when importing otherwise this will override all existing settings

  7. Select “Add to Workspace”

Import Content Overview

Quantcast Base Tag (Tag)

  • This foundational tag initializes the Quantcast pixel and enables the capture of rule-based and code-defined events across your website.

Quantcast Tag Conversion (Tag)

  • This tag records the primary conversion event for your Quantcast account — typically the most valuable user action on your site.

  • By default, the event label is ‘PurchaseConfirmation’, though you can customize this to reflect your actual conversion event.

  • Ensure the label retains the “_fp.event.” prefix.

  • The trigger for this tag is included by default, but you can substitute it with an existing trigger specific to your conversion setup.

Quantcast Tag Conversion Trigger (Trigger)

  • This trigger activates the conversion tag when a qualifying conversion occurs, based on a dataLayer push with the name ‘purchase’.

  • You may replace or remove this trigger if a suitable one already exists in your GTM setup.

  • The trigger name can also be customized to match your site’s existing dataLayer event name.

Quantcast Tag GTM Events Delegate (Tag)

  • This tag listens for all custom events in GTM and sends corresponding Quantcast events using the event names.

  • It works in tandem with the Events Delegate Trigger and can be safely removed without affecting core event measuring.

Quantcast Tag GTM Event Delegate (Trigger)

  • Fires on all custom GTM events, regardless of their names.

  • It is only needed if you plan to pass through all custom events to Quantcast. It can be removed alongside the delegate tag if not used.

Quantcast Tag History Change (Trigger)

  • Triggers on changes to the URL fragment or when the HTML5 pushState API is used.

  • Ideal for measuring virtual pageviews in single-page applications (SPAs).

Quantcast Tag ID (Variable)

  • Stores your unique Quantcast p-code, which links data captured on your site to your Quantcast account.

  • This is essential for ensuring proper data partitioning across customer accounts.

Quantcast Tag Order ID (Variable)

  • Captures the order or transaction ID associated with a conversion for detailed attribution.

  • Defaults to the dataLayer variable “transactionId”. Update as needed to reflect your implementation.

  • If left unset, measuring remains functional, but conversion Order IDs will not be captured.

Quantcast Tag Pageview (Tag)

  • Fires on all pageviews to log user navigation across the site.

  • Uses GTM’s default pageview trigger by default but can be customized.

  • Consent is managed by the Quantcast tag itself, but it can also integrate with consent signals if required.

Quantcast Tag Revenue (Variable)

  • Captures the revenue amount associated with a conversion to support campaign performance analysis.

  • Defaults to the dataLayer variable “transactionTotal”. Update this to match your current setup.

  • If left unset, conversion events will still be measured, but revenue data will not be recorded.

Reviewing Your Import

You can now navigate to the container overview within Google Tag Manager in order to view the changes being implemented. In order for all tags to work as intended we recommend reviewing the following factors:

  • Review all tags and variables included in the import

  • You may update tag labels, but the prefix _fp. must remain intact

  • Add relevant triggers to any tags where they' re missing

    • Review the value for “Quantcast Tag Conversion Trigger”

      • This is currently set to fire when a data-layer push occurs with the label “purchase”

      • Please update the label to match that of your current conversion data layer push

      • If you do not have an existing conversion data layer push then please update the “Quantcast Tag Conversion” with your existing conversion trigger

  • Review the value for “Quantcast Tag Order ID”

    • By default this variable is set to read from a data layer variable named “transactionId”

    • To capture your order ID either add a data layer variable for “transactionId” or update the variable to read the relevant data variable

  • Review the value for “Quantcast Tag Revenue”

    • By default this variable is set to read from a data layer variable named “transactionTotal”

    • To capture your revenue either add a data layer variable for “transactionTotal” or update the variable to read the relevant data variable

  • Remove any tags that are not applicable to your use case

Publish Your Changes and Go Live

Once you are happy with the changes in Google Tag Manager you are ready to publish the changes and go live.

If you have any questions, please contact [email protected].

Additional Information on Tagging