Google Analytics Domain Tracking API _link() method
-
05-07-2019 - |
Question
Has anyone else had any problems using google's Domain Tracking API, I am specifically talking about the _link() method.
The example provided shows that the _link() method should be used in the onclick event like this:
<a href="http://www.newsite.com" onclick="pageTracker._link('http://www.newsite.com');return false;">Go to our sister site</a>
However, this essentially just makes the link...do nothing (most probably because of the 'return false').
My understanding is that the pageTracker._link() method is 'supposed' to add additional parameters to the url and do it's own document.location style redirect.
Any ideas / catches / previous posts??
Solution 2
Apparently a miss-interpretation of the documentation:
You must also enable linking on the target site
So lets clarify also
- pageTracker._setAllowLinker(true); is set on the ORIGINATING page
- pageTracker._setAllowLinker(true); is set on the TARGET page
I only had it enabled on the target page, as the docs indicate.
OTHER TIPS
Sorry for the obvious question, but did you enable linking on the target page:
You must also enable linking on the target site (
pageTracker._setAllowLinker(true);
) in order for link to work properly.