Forum Moderators: DixonJones

Message Too Old, No Replies

How to use G Analytics trackPageview correctly?

         

Tonearm

5:02 pm on May 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since all of my funnel and goal pages have the same URL, I need to use _trackPageview as described here:

[google.com...]

Should I just add the following block after the main tracking code:

<script>
pageTracker._trackPageview("/funnel_G1/step1.html")
</script>

I've never used javascript before so I'm confused.

BradleyT

4:59 pm on May 19, 2009 (gmt 0)

10+ Year Member



<a onclick="javascript:pageTracker._trackPageview('/funnel_G1/step1.html');" href="http://www.example.com/step1.html">Proceed to step 1</a>

Tonearm

1:31 pm on May 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks BradleyT. Is there any way I could do it without an onclick or similar function. I'd just like to have it register when the page loads.

BradleyT

8:05 pm on May 20, 2009 (gmt 0)

10+ Year Member



You should be able to put it somewhere on the page where an event fires and it would have the same effect. Onclick= is just a JS event that says when this object (URL) is clicked, call this function.

So if you called it in onload or in the head it would fire that function also. The only downside with that is it could fire many times if someone refreshes the page a lot - it seems like people like to refresh pages for whatever reason.