Enable Demographics and Interests reports in Universal Analytics
Asked Answered
S

3

21

I want to enable demographics and interests reports with the Universal Analytics tracking code.

The generated tracking code for my site looks like this:

<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-999999999-9', 'whatever.com');
  ga('send', 'pageview');

</script>

Under Display Advertiser Features there is a option saying:

Demographics and Interest Reports make Age, Gender, and Interest data available so you can better understand who your visitors are. To see this data, you need to make a small change to your tracking code. Learn more about how to make these tracking code changes.

It links to: https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad

Which basically tells me to replace:

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') 
   + '.google-analytics.com/ga.js';

With:

ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://')
  + 'stats.g.doubleclick.net/dc.js';

But this seems to target a different version of Analytics (Classic Analytics tracking code, and I am using the new Universal Analytics)...

Should I just replace:

})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

With something? (E.g.)

})(window,document,'script','//stats.g.doubleclick.net/analytics.js','dc');

Also, do I really need to enable Advertiser Features in order to track visitors age and gender? I have currently no intention in using AdSense.

Showplace answered 14/11, 2013 at 2:9 Comment(0)
S
15

As I know , the feature is not available for Universal Analytics until phase 3.

This link has more information about Universal Mode: https://developers.google.com/analytics/devguides/collection/upgrade/

Refer the article below for more info about do it in Classic Mode. http://online-behavior.com/analytics/demographics


The upgrade page has the following content under the section "Important Considerations" (emphasis hjpotter92):

Data integrations related to the dc.js JavaScript library aren’t supported, but are coming soon.

The dc.js JavaScript library isn't supported in Universal Analytics, but will be in the coming year. If you rely on dc.js related features, such as Remarketing, Google Display Network Impression Reporting, DoubleClick Campaign Manager Integration, or Google Analytics Demographics and Interests Reports, do not upgrade to Universal Analytics yet. Wait until you see an announcement about dc.js in Universal Analytics, and upgrade then.

Sacrament answered 14/11, 2013 at 2:40 Comment(5)
Hi Ishare, so do I have to choose between Classic Analytics + Demographic and Interest Reports and Universal Analytics + Custom dimensions & metrics? Is there a way to get both? If there isn't, is there a alternative to Google Analytics that you can recommend?Showplace
Hi, honestly I do not have an idea about how to include both to gather. However, you can keep the both codes (Universal and traditional) in your website and try to measure the success. But if you’re applying event tracking or custom variables, please chose one format and do the needful.Sacrament
Well for me GA is the best free web analytics tool in the word, but I have used Piwik(piwik.org) . It's also free and have more similar features like GA.Sacrament
My advice is, please use the old traditional analytics code for some time. Because Universal analytics have fewer bugs and still Google is improving the product. So let it improves and do not include unless you have a requirement to go for Universal Analytics.Just go to Avinash (Digital Marketing Evangelist - Google) blog - kaushik.net/avinash , he is still using the old GA script. Why he is not moving to Universal Analytics? Because it is still in the testing period.Sacrament
We are now in Phase 3, and Google says the following, "All features (including the dc.js JavaScript) are supported in Universal Analytics. Universal Analytics tracking code (analytics.js) can send DoubleClick beacon for remarketing." (developers.google.com/analytics/devguides/collection/upgrade/…) Can this question be updated in light of that? The Google code for display remarketing on analytics.js says to add, "ga('require', 'displayfeatures');" Will that line enable the Demographics & Interests as well?Perrone
B
7

Using Demographics and Interests reports in analytics.js

In order to enable Demographics and Interests reports in Universal Analytics, you need to alter your tracking code slightly to include a required directive:

ga('create', 'UA-XXXXXX-XX', 'example.com');

ga('require', 'displayfeatures'); enables Demographics and Interests reports

ga('send', 'pageview');

But please note that you must also update your privacy policy if you add this code! (emphasis mine)

If you choose to support Display Advertising, you need to make a simple, one-line change to your Google Analytics tracking code. Once you have made this change, Google Analytics collects the information it normally does, as well as the DoubleClick cookie when that cookie is present. For more information about this cookie, visit the Google Advertising Privacy FAQ. When you make this update to your tracking code, you also need to update your privacy policy.

This modification does not impact any customizations you have previously made to your code.


Use ga.js and analytics.js simultaneously

You can use both analytics.js and ga.js simultaneously without negatively impacting your Analytics.

The analytics.js snippet is part of Universal Analytics, which is currently in public beta. New users should use analytics.js. Existing ga.js users should create a new web property for analytics.js and dual tag their site. It is perfectly safe to include both ga.js and analytics.js snippets on the same page.

Bandage answered 7/2, 2014 at 15:5 Comment(1)
Make sure to copy the same tracking ID into the two different snippets.Elysium
S
4

Since this question is still getting a lot of attention, I would like to point out that Universal Analytics is now on Phrase 3 and is able to generate demographics and interests reports. To track this information change your JavaScript code and add ga('require', 'displayfeatures'); after ga('create', 'UA-999999999-9', 'whatever.com') .

ga('create', 'UA-999999999-9', 'whatever.com');
ga('require', 'displayfeatures'); // enables demographics and interests reports
ga('send', 'pageview');
Showplace answered 22/4, 2014 at 16:55 Comment(2)
is this code supposed to dynamically load the dc.js script? Similar to how requiring the ecommerce plugin loads an ecommerce.js script?Berryberryhill
Kind of. It loads the counterpart of dc.js for Universal Analytics. Under the new architecture both displayfeatures and ecommerce are plugins.Showplace

© 2022 - 2024 — McMap. All rights reserved.