Optimizing Tag Performance

Once you’ve mastered getting Quantified, try these advanced measurement options.

Splitting the Asynchronous Tag

Advanced users can optimize the performance of the Quancast asynchronous tag by splitting the tag into two components as described below. Note: this is just a sample. You must use your own Quantcast-generated tag, found within the home page dashboard.

  1. In the HTML code of your page, insert the following 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);  
  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="//pixel.quantserve.com/pixel/p-test123.gif" height="1" width="1" alt="Quantcast"/>


Note – Do not use jQuery.getScript() to download or fire the Quantcast tag, it causes the browser to by-pass its cache, significantly slowing down performance of your pages. Use the Quantcast tag as described here to obtain the best possible performance.