I have a site using Google Analytics. On one page clicking a button changes everything about the page. However, it does not change the page’s URL. I would like to track it as a separate page in Google Analytics. So I would assume I would trackPageview("/new") (or really _gaq.push(['_trackPageview',"/new");), however before I implement this I want to make sure events and such are not counted twice.
That is to say, if I were to load the page / (and have the default trackPageview call occur) then call trackPageview("/new") and finally call trackEvent("Test",…) would the Test event be reflected on the /, /new or both?
In your example, ‘Test’ would be reflected on ‘/’ because that is the window.location.pathname.
There is an undocumented GA function called _set where you can override the variable like the code below: