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.
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
-
Google Analytic showing Bounce Rate More than 100% i.e. 2000%, 3000% Bounces for Many Pages
Hello Guys, Google Analytic showing Bounce Rate More than 100% i.e. 2000%, 3000% etc for Many Pages. Can anyone let me know what is the issue? Thanks!
Reporting & Analytics | | dsouzac0 -
Moz Crawl shows over 100 times more pages than my site has?
The latest crawl stats are attached. My site has just over 300 pages? Wondering what I have done wrong? RRv3fR0
Reporting & Analytics | | Billboard20120 -
Switch to www from non www preference negatively hit # pages indexed
I have a client whose site did not use the www preference but rather the non www form of the url. We were having trouble seeing some high quality inlinks and I wondered if the redirect to the non www site from the links was making it hard for us to track. After some reading, it seemed we should be using the www version for better SEO anyway so I made a change on Monday but had a major hit to the number of pages being indexed by Thursday. Freaking me out mildly. What are people's thoughts? I think I should roll back the www change asap - or am I jumping the gun?
Reporting & Analytics | | BrigitteMN0 -
How to get a specific keyword count from a particular country to a particular page in google analytics
We are trying to get the keyword count of a particular keyword from a particular country to a particular page. eg: (keyword)Green shoes from (country)United states on (particular page)one of our blog posts page Any help will be really appreciated
Reporting & Analytics | | Nobody15870501745820 -
Page Views Plummeted
Since using SEOMoz to diagnose and address issues with my site www.esecaucus.com, my page views have plummeted while my number of visits and unique visitors has remained intact. Does this mean that previously the amount of page views were artificially inflated by some kind of technical error in the site?
Reporting & Analytics | | Nobody15330770827560 -
Viewing stats for a single webpage in Analytics
I have Google Analytics and can't figure out how to generate stats for a single page on my site. I would like to know what websites are referring this page, time on site, unique views, etc.
Reporting & Analytics | | StreetwiseReports0 -
Ranking on page 1 position 3 but hardley any visits
in one of my projects the expected vistors is around 23000 weve got the keyword onto the first page position 3 and weve only recieved 30 vistits this month, my qustion is why? are the local searches from google analtics that tell you thier are 23000 searches for that keyword false please can someone shed some light on this, my client is totally over the moon with his ranking but cant believe that hes only recieving 30 visits this month from what we thought was a million dollar keyword
Reporting & Analytics | | Westernoriental0