Here's some code I used on Drupal to insert page titles into the Quantcast marketing tag. This code gives me the ability to use a Quantcast marketer account with specific page titles. Why is this interesting? Quantcast normally just gives you an overall profile for all the visitors on your site. Because of this code, I now have demographic profiles that are individualized for different pages on my site. If you've ever wondered how a particular page on your site might differ from the general demographic profile for your entire site, this code is for you.

Be aware that you have to insert your own Quantcast account number and domain into this code to make it work right.

<?php
$page_title=drupal_get_title();
$header_addition = <<<EOT
  <!-- Start Quantcast Marketing Tag -->
<script type="text/javascript"> 
_qoptions={qacct:"[insert your quantcast acct here]",labels:"$page_title"};
_qoptions.labels="_fp.event.$page_title.[insert your domain here]";
</script>
<script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
<noscript>
<img src="http://pixel.quantserve.com/pixel/[insert your quantcast acct here].gif?labels=_fp.event.$page_title.[insert your domain here]" style="display: none;" border="0" height="1" width="1" alt="Quantcast"/>
</noscript>
<!-- End Quantcast Marketing tag -->
EOT;
echo $header_addition;
?>
Shared publiclyView activity