Inspecting _utm.gif I’ve determined the Extensible Parameter utme is not being passed. I don’t see it at all when I inspect it with Firebug. I’m trying to track an event with Google Analytics – a simple button click.
The Google code in <head>.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']); //in reality, this ID is set correctly
_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>
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
try {
var myTracker=_gat._getTrackerByName();
_gaq.push(['myTracker._trackEvent', ' + category + ', ' + action + ']);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}
</script>
The code I use in the <body>
<a onClick="recordOutboundLink(this, 'button', 'clicked');return false;" href="http://someoutboundlink.com">
<img src="http://some-image.png">
</a>
What am I missing? Why aren’t my params button and clicked being passed in the _utm.gif?
Your function is wrong. Just because you named your tracker variable myTracker it’s not the internal name of the tracker. In your case you use a nameless tracker. And the correct way to fire an event for it is just calling
_trackEvent.