Quantcast -- Audience Measurement, Lookalike Modeling, Audience Buying


Log in

Forgot Password?



Using the Quantcast Asynchronous Tag

As part of the most widely-used direct measurement solution, the Quantcast asynchronous tag provides superior page loading performance. This tag is backwards compatible with the previous Quantcast JavaScript tag (see below) and supports all existing Quantcast services, such as audience segment labels. Use of the Quantcast asynchronous tag is optional, but Quantcast recommends use of this tag instead of the previous tag. Quantcast continues to support the previous tag.


The Quantcast asynchronous tag ensures that the quant.js file (a core component of Quantcast Measurement) loads in the background. Furthermore, this file loads just once, on the first pageview per session. Upon subsequent pageviews, the Quantcast tag pushes notification of the pageview via the _qevents array. All this done in the background, which minimizes the number of direct calls, improves latency and ensures proper measurement. The result is that you continue to get Quantcast Measurement reporting with minimal impact on the end-user experience.


To use to the asynchronous tag:

  1. In the HTML code of your page, insert the following in the section, just before the </head> tag:


    <!-- Quantcast Tag, part 1 --> 
    <script type="text/javascript">
      var _qevents = _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);  

    Double click the code above to select it.


  2. Before the </body> tag and other JavaScript tags, insert the following code. Be sure to use _qevents, not _qoptions:


    <!-- Quantcast Tag, part 2 -->
    <script type="text/javascript">
        _qevents.push( { qacct:"p-test123"} );
    <div style="display: none;">
        <img src="http://pixel.quantserve.com/pixel/p-test123.gif" height="1" width="1" alt="Quantcast"/>

    Double click the code above to select it.

Be sure to insert your own p-code where p-test123 appears in the code above.

Backwards Compatibility

The tag is completely backwards compatible. If the quant.js loads, both the old and new tag will work fine, however, we recommend you use either the new or old tag on a single page, not both.

Facebook Twitter LinkedIn YouTube
©2014 Quantcast Corporation