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
-
Two of Four Google Analytics Views Not Showing Data
Question for you MOZ friends: We added two new views about a week ago, the same views that we have added for more than 50 Accounts, and they are not showing any data. The views are for 'Filtered Traffic' (no IPs or spam) and 'Organic Only' including only the organic medium. Any ideas why this may not be working? First time we've come across this and couldn't find much help researching it... Thanks as always! street%20ga_zpsorfdnemi.png
Reporting & Analytics | | ReunionMarketing0 -
Why don't i have a page rank for charlesvapor.com
www.charlesvapor.com has been up for 5 months and the seo work is completed; i do not have page ranking foir this site and i want to know a little about why; is their any help figuring it out?
Reporting & Analytics | | prostene13590 -
How can I easily combine moz page difficulty, google search volume and SERPS position?
I want to produce an excel spreadsheet that I can use to identify the best use of my content Writing time. So Looking at a keyword list I want Current SERPS to show me where I am now? moz page difficulty score to show how hard I'll have to work google traffic estimate so that I can see the potential payoff. I can can generate all these separately but combining them is a huge time waster as invariably the results don't come back in quiet the same order and a line by line check is required. Part of the reason for doing this is keyword exploration so that we can find new niches by generating hundreds or thousands of keywords to test.
Reporting & Analytics | | Zippy-Bungle0 -
Sudden Increase In Number of Pages Indexed By Google Webmaster When No New Pages Added
Greetings MOZ Community: On June 14th Google Webmaster tools indicated an increase in the number of indexed pages, going from 676 to 851 pages. New pages had been added to the domain in the previous month. The number of pages blocked by robots increased at that time from 332 (June 1st) to 551 June 22nd), yet the number of indexed pages still increased to 851. The following changes occurred between June 5th and June 15th: -A new redesigned version of the site was launched on June 4th, with some links to social media and blog removed on some pages, but with no new URLs added. The design platform was and is Wordpress. -Google GTM code was added to the site. -An exception was made by our hosting company to ModSecurity on our server (for i-frames) to allow GTM to function. In the last ten days my web traffic has decline about 15%, however the quality of traffic has declined enormously and the number of new inquiries we get is off by around 65%. Click through rates have declined from about 2.55 pages to about 2 pages. Obviously this is not a good situation. My SEO provider, a reputable firm endorsed by MOZ, believes the extra 175 pages indexed by Google, pages that do not offer much content, may be causing the ranking decline. My developer is examining the issue. They think there may be some tie in with the installation of GTM. They are noticing an additional issue, the sites Contact Us form will not work if the GTM script is enabled. They find it curious that both issues occurred around the same time. Our domain is www.nyc-officespace-leader. Does anyone have any idea why these extra pages are appearing and how they can be removed? Anyone have experience with GTM causing issues with this? Thanks everyone!!!
Reporting & Analytics | | Kingalan1
Alan1 -
It appears there's a problem with our connection to your Google Analytics account. Please go to your Settings page to update your connection.
I keep getting this error though I have confirmed I have the correct information. Any recommendations?
Reporting & Analytics | | x3oadmin0 -
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 -
Tracking page visits
Hi guys After a lot of effort and late nights our website has gone online. http://www.health2000.co.nz/ In google Analytics am I able to see what pages individuals clicked on before they went to the cart? Ive had a look at GA 'Flow Visualsiton' but it seems a little confusing. Thanks for your help Pete
Reporting & Analytics | | dawsonski0 -
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