views:

514

answers:

1

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

+2  A: 

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.

andi
Another words when the ajax call is finished?
leeand00
The function that it calls when the ajax call returns? How does that keep (whatever is happening from happening?)
leeand00
Wait, maybe I wasn't clear...it's not a popup window, it's a pop-over window...I'm using the thickbox library: http://jquery.com/demo/thickbox/
leeand00
Now i see that you're not using jquery ajax request.You can add the pageTracker._trackPageview(); right after response = http.responseText; in the "if(http.readyState == 4) {" block. You can even set a parameter for the tracking method: _trackPageview("order_completed.html")
andi
Ah I see, and then that _trackPageview() argument gets recorded as the page that was tracked then?
leeand00
andi
I modified my code to call the pageTracker._trackPageview() method with an argument of the thankYouForInfo.html page, but I don't see any results in Google Analytics yet (that was yesterday, but I guess it hasn't been a full day yet...so I'm gonna wait another day and see what happens).
leeand00
are you sure that the method gets called? did you try to place an alert("something") before or after calling _trackPageview() ? If it does get called, then it's certainly going to show up in analytics. Just give it a day ;)
andi
Hey yeah that did it! :) Thanks chief! One up for you!
leeand00
Nearly a year to the day and this question helped me out! Thanks!!
Colin