google analytics new tracking code update

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
10/30/2014 6:51:22 AM
Gravatar
Total Posts 199

google analytics new tracking code update

I am using                 2.4.0.2 MSSQL

in the site settings > API keys section I have my google analytics ID.  Google is now updating their tracking code script and I need to get demographic information.

How can I update the tracking code script?  All I can set is the google account number currently?

See this link for the code changes needed.

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

11/9/2014 8:21:34 AM
Gravatar
Total Posts 18444

Re: google analytics new tracking code update

sorry for the delayed response. We do have built in support for that though I'm not sure which version it was added in.

To use it you would change this in layout.master:

<portal:AnalyticsAsyncTopScript ID="analyticsTop" runat="server" />

to this:

<portal:AnalyticsAsyncTopScript ID="analyticsTop" runat="server" UseUniversal="true" EnableDisplayFeatures="true" />

if you find that does not work in version 2.4.0.2, I think you can still work around it because of the way the google script works async. You could just add your own below the control I just mentioned something like this:

<script> ga('require', 'displayfeatures'); </script>

 

11/10/2014 2:19:11 PM
Gravatar
Total Posts 199

Re: google analytics new tracking code update

thank you joe,  looks like it was not supported in the version I have since it is the older version of analytics.  I had to add an entire function and it is working now.

 

<portal:AnalyticsAsyncTopScript ID="analyticsTop" runat="server" EnableDisplayFeatures="true" />

<script>

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

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

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

 

11/10/2014 2:46:09 PM
Gravatar
Total Posts 18444

Re: google analytics new tracking code update

I think it also requires UseUniversal="true"  as shown in my previous example, and probably is in your version

You must sign in to post in the forums. This thread is closed to new posts.