开发者

Goals Firing on Ajax Confirmation Pages

I am trying to track goals firing using Google Analytics, and I am running into issues with tracking actual confirmation pages that are AJAX calls. The confirmation page isn't a URL exactly, but a .php file which is loaded in AJAX. I can't figure out for the life of me why goals aren't able to fire using an AJAX call, but I can easily track a URL.

Here is all the information I have regarding the goals, including the goals, and actual code and the landing page itself (https://docs.google.com/document/pub?id=1uUjX5wWOpy9w85fpocIz32gMIWvZS开发者_如何学编程QzSG8WCBDSq4DA).


So, the URL that Google Analytics tracks is, by default, determined by what the browser detects (specifically, location.pathname+location.search). So, the filename of the php file that is loaded via AJAX is not relevant to Google Analytics, since by default, your trackPageview call will just send the URL that the browser shows (without the domain or anchor values).

Google Analytics allows you to pass a custom URL as the path, as the second parameter of trackPageview.

So, in your confirmation page, you need to switch the _gaq.push(['_trackPageview']); to be

_gaq.push(['_trackPageview', '/ed-JUNE-confirm']);

Now, there are other things that are confusing (for example, the multiple plain pageview calls on the same page), but, fundamentally, to 'trigger' the goal you need to send a pageview that has a head-match for your Goal URL, and use these virtual pageviews to accomplish it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜