Bug in Virtual Page view javascript
-
I am trying to learn the basics of tracking outbound links with this javascript code set up on
this url
http://queenofhats.com/links.php
I think I have a bug in my javascript that tracks clicks on an outbound link.
When A person clicks on the "Portland Maine" link, in theory it should create a virtual pageload of a page called "portland_maine".
I have clicked on the link, but when I filter on "portland" in the Top Content section of Google Analyitcs, there are is no record of the click.
So I think my javascript code has a bug.
Any comment on the javascript would be most welcome.
I just noticed that I have \ before /links.
Is the "" the source of the problem?
Thanks!!
-
Hi Guillaume:
I made the correction you suggested. See code below. I believe that because there is PHP on the page, that I Must keep the / before the ' marks. Correct?
I think that If I remove the / marks, that the web page will not render correctly in PHP becuase the ' mark is special character in php.
When I look in Google anlaytics under "portland" I see no page views.
So can you suggest what I need to change?
a href="http://www.portlandmaine.com" target="_blank" onclick= _gaq.push(['_trackPageview','/links/portland_maine']);">http://www.portlandmaine.com
Thanks!!
-
HI Guillaume:
Thanks very much for going to my web site and identifying the key point that I now have the new async version of GA on my site. So I have to use the new version of page tracking.
Good catch!
Merci
Dan
-
Hi Dan,
Yes, you're partially right, the "" is part of the problem, but there is also something else. I went and took a look at your website and you seem to be using the asynchronous version of Google Analytics code so the pageTracker won't work for you.
If you were still using the old version of Google Analytics, the code should be :
Now, with the new version of Google Analytics tracking code :
Best regards,
Guillaume Voyer.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
I have to delete old thankyou page configuration?
Currently i am tracking thank you page conversion via google tag manager by doing following configuration in tag manager :- "Page URL Contains thankyoupage.html" But now i am implementing Enhance Ecommerce with tag manager with following configuration : - Custom event - "Event equals Transaction" I have test at staging level conversion working fine. But i have only one doubt that now I am implementing Enhance Ecommerce with tag manager so i have to delete old tag configuration right? i.e. "Page URL Contains thankyoupage.html"
Reporting & Analytics | | varo0 -
When analysing my inbound anchor text am I using by page or site?
When checking to see my anchor text profile to make sure it's not too dense with the same phrases, should I be measuring against my whole site or page specific? eg if i have 100 links across my site and 20 are for the same phrase this is 20%, but if the same 20 phrases are to one page and that page has 40 links this is 55% Many thanks Ash
Reporting & Analytics | | AshShep10 -
Problem setting up new view in Analytics
Hi, I'm having problems finding where to set up a new view in Analytics. I have seen https://support.google.com/analytics/answer/1009714?hl=en but get lost at point 3 (In the View column, click the menu, then click Create new view.) In the menu there is no option that I can see. If I go into the one view that is set up, I also can't see anything 'View Settings' that would allow me to copy the view and then modify it. Am I missing something? Thanks
Reporting & Analytics | | Houses0 -
Today analytic View Changes or Bug?
Hello Friends Today I just open my analytic dashboard and found changes in analytic metrics like for example “All traffic source view” found keyword instead of source medium. Have look below graph does anyone know why analytic display keywords instead of source medium? Is it analytic update? Or bugs check with your dashboard and go to “ALL TRAFFIC SOURCE” primary dimension is keyword? yxma
Reporting & Analytics | | CommercePundit0 -
Does analytics track an order two times by refresh on the confirmation-page?
Hi there,
Reporting & Analytics | | Webdannmark
I have a quick question. Does Google analytics track an order two times, if the user buys a product, see the confirmation page and then click refresh/click or back and forward again?
The order/tracking data must be the same, but i guess the tracking code runs for every refresh and therefore tracks the order two times in Analytics or does analytics know that it is the same order? Someone that can clearify this?Thanks! Regards
Kasper0 -
Time on page: What happens when I open many tabs?
Hello everyone, I was studying Analytics, and checked that the time on page is calculated by the diference of the time you entered the page and when you click to go to another one. But how the time is calculated when I open several links using new tabs in different moments? Does Google counts the last tab? Just a guess... Thanks!
Reporting & Analytics | | seomasterbrasil0 -
Google Analytics internal Site Search - Destination pages dispaly Search results
Hi, Im having a bit of an issue with Google Analytics internal site search, I am able to currently track the search terms through my website internal search but when I click onto destination pages I just get the search result page. When clicking destination pages I would expect to get the pages on which the user ended up after the results page, instead I just get the results page which is pretty much useless ?submitsearchXXXXXX hope you can help, look forward to your response. Thanks,
Reporting & Analytics | | Tug-Agency1 -
Is 10 Keyword Targets for Page Rank too many?
My client has selected 10 keywords that they want to rank on the first page of Google for. Is 10 keywords too many to try and rank for? I have heard that you should focus on top 5 keywords instead.
Reporting & Analytics | | dseasterling0