Enhanced Link Linking in Google Universal Analytics

I use UA in our internal software of our company to understand how our users use it, and part of this is what they click when they click, etc.

Advanced link binding seems to be the best choice for this, but for a Developer Document:

Tag your page for advanced link binding

To implement this additional labeling for an extended attribution link, you must use the asynchronous version of the tracking code in Google Analytics.

The problem I see is that I am currently using Universal Analytics, which uses analytics.js , while the asynchronous version of GA uses ga.js So now I am confused because this option is available in my property settings in the Admin section of our GA account.

Universal analytics

  <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-CODE-HERE', 'SITE_URL'); ga('send', 'pageview'); </script> 

Asynchronous code

 <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _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> 

Since the two versions of GA are not compatible, can I use Enhanced Link Attribution? If so, what steps will I take? I can’t find the answers in the Google Analytics docs related to ELA with UA.

Edit Is it possible or recommended to use both versions of Google Analytics on the same page / site / property? Assuming I set a different GA property for the standard version and use both JS snippets on the site?

+8
google analytics
source share
4 answers

To answer the original question: No, advanced link binding is not yet supported by Universal Analytics. Although this and many other features will be deployed soon. Universal Analytics is still very beta, but it has been determined that this is the future for Google Analytics.

Yes, the new code is asynchronous, like the old code, and I really could not imagine a situation where you want to disable it. Asynchronous loading in this case means that when you run javascript analytics, your web page continues to load regardless of whether javascript has finished loading or not. Before updating the asynchronous snippet, the best practice for loading analytics code in the footer was to prevent the entire page from freezing due to the lack of the asynchronous nature of the script. Although this has been changed since on long / slow pages the user often interacted with the website before the footer / javascript was able to load and, in turn, caused significant discrepancies in the data.

Wikipedia:

In computer programming, asynchronous events are events regardless of the main program flow. Asynchronous actions are actions performed in a non-blocking scheme, allowing the main program to flow to continue processing.

I also do not propose changing the name of the object , as Concept Rat suggests, since I believe that this only applies if you run many “universal analytics” trackers for different web properties within the same fragment.

https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#snippet :

Rename a global object

In some cases, the variable name ga may already use an existing object on your page. To avoid overriding an existing object, you can rename the ga function, for example, to __gaTracker. to do this, just replace the ga parameter in the snippet above:

(function (i, s, 0, r, g, a, t) {i ['GoogleAnalyticsObject'] = g; i [g] = g [g] function || () {(I [g] .q = I [g] .q || []). (Push arguments)}, I [g] .l = 1 * new Date (); a = s.createElement (o), m = s.getElementsByTagName (o) [ 0]; a.async = 1; a.src = g; m.parentNode.insertBefore (a, t)}) (Window, document, 'script', '//www.google-analytics.com/analytics.js ',' __ gaTracker ');

Then you can use __gaTracker instead of ga when invoking commands:

__ gaTracker ('create', 'UA-XXXX-Y'); __gaTracker ('send', 'pageview');

If renaming a variable was necessary to load both snippets, I do not believe Google will say this:

https://developers.google.com/analytics/devguides/collection/analyticsjs/ :

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 must create a new web resource for analytics.js and dual mark their site. It is safe to include both ga.js and analytics.js on the same page.

Also note that if you want to try out universal analytics, you must run it at the same time as your existing implementation, because ultimately they must release a migration tool to stay backward compatible, allowing you to store existing data. To be completely clear: You must fully implement universal analytics if you create a completely new account without existing data.

+6
source share

I deal with this problem. As of November 2012, Google answered the support question: “Support for Analytics.js on the Analytics page has not yet been implemented. This is one of the functions that we will work on and which will be presented later in the beta version. Other functions that are in not currently supported, include remarketing and AdSense reports. " As you know, Enhanced Link Attribution is a feature of In-Page Analytics.

I have not found new references to this problem from this post, so I can only assume that Universal Analytics is still not ready for prime time. If you can, I would try using Asynchronous code until Universal Analytics works correctly.

+3
source share

FYI: Universal Analytics exits beta testing and now supports advanced link binding:

https://support.google.com/analytics/answer/2558867?hl=en

+2
source share

For reference, Universal Analytics supports or supports asynchronous mode. You can see it in the third line of the universal JS code under the tag "script" a.async = 1; "

You can also run both standard GA and Universal code at the same time. Just set up a separate property for the universal code and make sure that you change the name of the object "ga" that you see on the fourth line "//www.google-analytics.com/analytics.js'''ga") to say "gau "(just needs to be unique on the script page). Then use "gau (" instead of "ga" ("to configure things, etc.). Remember that this is just for universal code, not standard GA.

Once you do this, you can continue to track everything using standard GA, and keep Universal GA journal under the new property. When you are happy with things, you can switch to using only the universal.

0
source share

All Articles