Google Analytics Virtual Pageviews

Discussion in 'Google Analytics' started by MissMystery, May 26, 2011.

  1. #1
    Hi

    I am working on a website and need to setup goals on a registration form. The registration form has many stages and many URL's but as the # is within the URL, for example:

    These are the URL's as you go through the form:
    Step 1
    https://www.example.com/instructions/purchase#form-top-1
    Step 2
    https://www.example.com/instructions/purchase#form-top-2

    The goals have been setup, but Google Analytics is not tracking what is happening on these URL's. I am assuming this is to do with the # tag.

    I've had a read around virtual pageviews and I am not sure whether this will help with this issue?

    Please help!

    Thanks
     
    MissMystery, May 26, 2011 IP
  2. manish.chauhan

    manish.chauhan Well-Known Member

    Messages:
    1,682
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Since you are using named anchor tags to quickly link to specific forms on a webpage. In Analytics, this will trigger a pageview for /instructions/purchase by default – not for /purchase#form-top-1 or /purchase#form-top-2. Google Analytics do not track anchor tags by default, in order to track them separately, you will have to use location.hash tag in your analytics code:

    Old traditional tracking code:

    var pageTracker = _gat._getTracker("UA-XXXXX-X");
    pageTracker._trackPageview(location.pathname + location.search + location.hash);

    New asynchronous tracking code:

    _gaq.push(['_setAccount', 'UA-XXXXX-X']);
    _gaq.push(['_trackPageview', location.pathname + location.search + location.hash]);

    Hope this would help you :)
     
    manish.chauhan, May 26, 2011 IP
  3. inet

    inet Well-Known Member

    Messages:
    706
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    163
    #3
    Would the same rule apply for tracking #tags for multiple page use? i.e. if you had affiliate url's pointing to the same page?

    Thanks
     
    inet, Jun 16, 2011 IP
  4. elinacruz2009

    elinacruz2009 Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you give any example for this? any site?
     
    elinacruz2009, Jun 22, 2011 IP