Closed KarinaLibrary closed 10 years ago
Can you post a URL or code?-Tom (via phone)
On Sat, Mar 8, 2014 at 2:59 PM, Michael Lommel notifications@github.com wrote:
After GAS install, onClick event tracking seems to cause the Landing Page to be "(not set)" in GA. Strange because in GA Debug can see that beacon fires correctly. Is it possible to leave previous event tracking that calls _gaq.push, or is it necessary to use _gasHTMLMarkup? Or do I need to switch from _gaq.push to _gas.push?
If I do need to use _gasHTMLMarkup, does it have to be in a div per the readMe, or can it be in the link element itself as it is now?
Reply to this email directly or view it on GitHub: https://github.com/CardinalPath/gas/issues/66
The onClicks are:
<a href="http://domain.org/product-index/product1/" onClick="_gaq.push(['_trackEvent', 'CompareTable', 'Product1fromCompare']);">
The cross domain GAS code is:
var _gas = _gas || [];
_gas.push(['_setAccount', 'UA-xxxxxxxx-y']); // Xdomain Analytics Account
_gas.push(['_setAllowLinker', true]);
//_gas.push(['_setAllowAnchor', true]);
_gas.push(['_setDomainName', 'domain1.com']); // Cross Domain 1
_gas.push(['_setDomainName', 'domain2.org']); // Cross Domain 2
_gas.push(['_addIgnoredRef', 'domain1.com']);
_gas.push(['_addIgnoredRef', 'domain2.org']);
_gas.push(['_require', 'inpage_linkid', '//www.google-analytics.com/plugins/ga/inpage_linkid.js']);
_gas.push(['_gasMultiDomain', 'click']);
_gas.push(['_trackPageview']);
onClick="_gaq
should be onclick="_gas
Also, move this _gas.push(['_gasMultiDomain', 'click']);
below this _gas.push(['_trackPageview']);
Hi Tom
Can you clarify ? Why is it required to remplace _gaq.push to _gas.push since GAS creates _gaq and as a public default tracker ??
As well as usage / sequence of _gas.push(['_gasMultiDomain', 'click']); versus _gas.push(['_trackPageview']); ? The sample code with cross domain tracking on https://github.com/CardinalPath/gas/ doesn't include _gas.push(['_trackPageview']); then it's difficult to know what should be done
Many thanks Tom - will try that. As the above comment points to, probably the README needs updating for the Cross Domain section as the code there now is like this (https://github.com/CardinalPath/gas#cross-domain):
_gas.push(['_setAccount', 'UA-XXXXX-1']);
_gas.push(['_setAllowLinker', true]);
_gas.push(['_setAllowAnchor', true]);
_gas.push(['_setDomainName', 'mysite.com']);
_gas.push(['_setDomainName', 'myothersite.com']);
_gas.push(['_gasMultiDomain', 'click']);
So it looks like _trackPageview
would come after that. I have actually not seen any problem with the xdomain itself though; the utm tags get passed as expected.
I don't know if there has been a change since these slides from 2012, or of there is a subtle reason to have in a different order:
https://github.com/CardinalPath/gas/issues/66#issuecomment-37186188 is more a personal preference. Every array prefixed with ['_gas
just sets up handlers. _trackPageview
is async so I usually bind those after I send off the beacon. Not mission critical.
As for replacing _gaq w/ _gas, there is some behind the scenes multi domain logic that won't get caught by _gas and could be causing your click handler to fire before the _gas push is fired. They play nicely sometimes, but not in this edge case would be my guess.
Good to know! Thanks Tom.
Would it make sense then to have _gas.push(['_require', 'inpage_linkid', '//www.google-analytics.com/plugins/ga/inpage_linkid.js']);
after _trackPageview
as well? I can see in the GA Debug console it seems to be waiting on that before firing the beacon.
@KarinaLibrary - no :-/ It adds some stuff to the _trackPageview call (similar to custom keys/values). So it has to be included before _trackPageview. If you're clients super concerned about performance you could preload the script using a pattern like this: http://www.phpied.com/preload-cssjavascript-without-execution/ . Kinda overkill, but available.
After GAS install, onClick event tracking seems to cause the Landing Page to be "(not set)" in GA. Strange because in GA Debug can see that beacon fires correctly.
Is it possible to leave previous event tracking that calls _gaq.push, or is it necessary to use _gasHTMLMarkup? Or do I need to switch from _gaq.push to _gas.push?
If I do need to use _gasHTMLMarkup, does it have to be in a div per the readMe, or can it be in the link element itself as it is now?