You may have noticed Demographics and Interests under the Audience tab on the left hand side of the Analytics dashboard. They show useful information about who the visitors to your website or blog are. In order to view these stats you need to enable them. To do this, you need to add a line of code to the GA script and update your privacy policy to reflect the new data you are collecting.
I have a couple of Google Analytics posts here, if you’re looking to learn how to install and use it to collect stats about your blog. If you already have it installed and are looking to upgrade it to see Demographic and Interest reports, this tutorial should help.
Enable Demographics + Interest Reports on Google Analytics
1. Login to Google Analytics. If you don’t have an account yet, you can find out how to set up and install GA here. On the homepage, select the site you want to see, click Audience and enable.
2. Click Admin > select the Account and Property. Under Property select Property Settings. Scroll down until you see Display Advertiser Features and turn that on.
3. Under Property, look to see if it says Tracking Code or Tracking Info. If you see Tracking Info you have a Universal Analytics account. If you see Tracking Code you have a Classic Analytics account. This is important to check for the next step.
4. Find where you added the script to your theme or template. For Blogger, go to Template > Edit HTML and the code should be above </head>
. For WordPress users, it is probably in your themes header.php file or a hook/head area in theme settings. Follow 4A for a Universal Analytics account and 4B for a Classic Anaytics account. See this page for more details and instructions on how to alter the code for Android or iOS.
4A. Universal Analytics account – You’ll see a code similar to the following script that you previously added
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX-XX', 'yourdomain.com');
ga('send', 'pageview');
</script>
in between the last two GA lines, add the following
ga('require', 'displayfeatures');
so that it looks like
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX-XX', 'yourdomain.com');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
Once added, move to step 5.
4B. Classic Anaytics account – You’ll see a code similar to the following that you previously added
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Replace this line
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
with the following
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
If you have a classic account, you might want to consider updating to a universal account to receive more insights. Instructions can be found here.
5. Save your template changes. You may have to wait up to 24hours before moving onto the next step.
6. Go back to the Google Analytics > Audience and click Validate Tracking Code. You may have to wait up to 24hours for it to work so retry later.
7. Update your policy page, this is important. Google requires that anyone using their Display Advertising code has to inform their visitors that they are doing so. You can see what you need to include here.
8. It may take some time for data to appear, but you should start seeing some extra data about the visitors to your site.
2 responses to “How to enable demographics on Google Analytics for more audience stats”
Is there a different way to do this if you didn’t add the code? when I set up google analytics I just put the code into the box blogger has for it, its under settings, other, then at the bottom its google analytics. I have all the information in google analytics to show its tracking but I just can’t find either of the codes you showed
No there doesn’t seem to be a way of updating the Blogger tag, you’ll need to add the code to the template yourself.