Tracking a page in an Ajax Popover from Google Ana

2019-08-02 08:03发布

I am looking to track a Pop-Over page that appears when the forum is submitted at:

http://www.xebra.com/salesAssistance.html

I tried adding the urchin/google analytics code to the page that is displayed in the pop-over window, but whenever I do so the status bar displays "Read http://www.google-analytics.com/" and the entire form page goes blank.

It is important to track the page in the popover because that page is the conversion goal (the page we are trying to direct people to).

How do I stop Google Analytics from destroying my window, while still tracking that a user has been there?


Thank you,
Andrew J. Leer

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-02 08:33

You could separate your google analytics code into two bits:

one that goes on top of the page:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." :"http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
    var pageTracker = _gat._getTracker("#########");
} catch(err) {}
</script>

and the other just before the "end body" tag

<script>
   pageTracker._trackPageview();
</script>

And the call the pageTracker._trackPageview(); method in the ajaxComplete callback of the "pop-up" window.

查看更多
登录 后发表回答