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
-
Seeing very few pages analysed re: Mobile usability, in Google Seach Console - why?
Hi Mozzers, Under Mobile Usability, in Google Search Console, I am seeing very few website pages getting analysed - 10 out of 40 static pages, on the website in question. Is this to be expected or does this indicated an indexing problem on mobile?
Reporting & Analytics | | McTaggart0 -
Non-Interaction Virtual page views
Hello, I would like to know if it is possible in Google Analytics, to generate "non-Interaction" Virtual Page views. In other words, Virtual Page Views, that do not affect the bounce rate (exactly like when we set "non-Interaction": True when we fire an event). I am presently fixing a Google Analytics implementation, where virtual page views were used all over the place instead of events. I am pulling my hairs. Cheers Luca
Reporting & Analytics | | Lvet0 -
Will changing the property from http to https in Google Analytics affect main unfiltered view?
I set my client up with an unfiltered view in Google Analytics. This is the one with historical data going back for years, so I don't want to do anything that will affect this view. Recently, the website moved from HTTP to HTTPS. There's a setting for the property that will allow me to change the property name to https://EXAMPLE.com and change the default URL to https://EXAMPLE.com. Questions: 1. If I change the property name and the default URL, will this somehow affect my unfiltered view in a way that I'll lose historical data or data moving forward? 2. I have heard that changing the default URL to HTTPS will help me avoid a common problem others have experienced (where they lose the referrer in Google Analytics and a bunch of their sessions go to direct / other). Is this true?
Reporting & Analytics | | Kevin_P3 -
Is there a way to map your on-page SEO changes with the organic growth?
Hi Mozzers, I was just wondering if there's a way we can map our on-page SEO changes with the increase/decrease in organic traffic. For instance, I introduced brand pages' link the product page breadcrumbs and suddenly organic traffic for my brand pages increase from X to 2X in 1 couple of weeks. Now, this can be because of this breadcrumb change purely or because of some algorithm update or may be, bots started finding the content interesting and hence, started ranking them up (in case the brand pages were launched recently). So, you can't say which change should be mapped to what increase/decrease in organic traffic. Or, is there a way to map this?
Reporting & Analytics | | _nitman0 -
Analytics: How to see how many uniques viewed over X amount of pages in period
Hey guys, anyone any idea how to do the following in google analytics? I need a little help, I am looking at my traffic for a given month, I can see how many unique users visit over X amount of times, but can instead of visits, can I see how many unique users I had that looked at X amount of pages or more? Appreciate all help!! 🙂
Reporting & Analytics | | MirandaP0 -
Google analytic conversion code in a single wordpress page
Hello How can I add/place the Google analytic conversion code in a single wordpress page? Example: http://www.newsmilecostarica.com/thank-you/ Thank you so much Andy
Reporting & Analytics | | newsmile0 -
Page Optimization score is An A but Rank is dropping
New to company in SEO and they wanted a page to rank high for certain term : knowledge management on this page: http://www.apqc.org/knowledge-management Ran SEO Moz optimizer and did suggested changes. Moved score to A and ranking was on google first page but now it's dropped considerably last 2 months as the bounce rate has gone through the roof. I'm at my wits end and don't want the higher ups on me for the drop. I'm not sure what to try next.
Reporting & Analytics | | inhouseninja0