_blank hits. We use ga.js for now as the client does not want to upgrade yet. The problem is that to properly track a hit I push a function to _gaq so that navigating happens after the event is logged to GA.
Surrogates are a great idea but I think that the implementation should mock the target fully. What happens now is that external and asset links will not work for my client as the function pushed to
_gaq never gets executed, consider:
if ( !isNewTab && window._gat && window._gat._getTracker ) {
e.preventDefault();
// Pushing a function to _gaq ensures that it gets opened after tracking it
_gaq.push(function () {
window.location.href = url;
});
};
This approach is taken from StackOverflow so probably I’m not the only one that would be affected. Setting a timer to navigate seems really inefficient and ugly to me. I would rather check if I’m dealing with a surrogate or not or expect the surrogate to actually execute the code I’m sending.
After some digging I found out that the surrogate implementation is:
function () {
try {
if (arguments[0][0]== '_link') window.location.href = arguments[0][1]
} catch(er) {}
}
So if I do
_gaq.push(['_link', url]) it will work (given that Ghostery blocks ga.js).
If I do the same with ga.js loaded properly it just logs a hit.
Still, this is inconsistent.
Loading Profile...



Twitter,
Facebook, or email.
