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
-
Why only a few pages of my website are being indexed by google
Our website www.navisyachts.com has in its sitemap over 3000 pages of information, and this is all unique content written by our team. Now Google Webmaster central shows only 100 urls indexed from 3500 submitted. Can you help me understand why and how I can fix this issue? The website has 4 years old, is a Joomla 3.3 up to date. It has part of the content in the Joomla core content systems and part in K2. Thank you. Pablo
Reporting & Analytics | | FWC_SEO0 -
Google Analytics is treating my blog like all the content is just on the home page.
Hello all, I installed Google Analytics on a main website and a blog (blog.travelexinsurance.com) While it appears to be tracking correctly (and when I test it in real time it shows that I'm visiting) but it is treating the entire blog as though it's one page. So I can't see data on blog post X. All I see is that X visitors came to my blog in aggregate. So I see blog.travelex.com has 999 visitors, but it doesn't show that /travel-luggage got 50 visits, while /insurace-tips got 75 and so forth. I assume I screwed up the tracking somehow, but can't figure out where I went wrong. Tracking on the main domain works just fine. It's specific to the blog.
Reporting & Analytics | | Patrick_G0 -
Deleted Rarely Visited Pages - Traffic Dropped (Big Time)
Hi folks: I'd appreciate any thoughts you might have on a problem I am having with organic traffic. One of our sites has about 500 pages/blog posts. We had about 200 pages that no one was visiting, or only one to ten people had visited in an entire year. As a result, we decided to experiment, and delete any page which had fewer than 5 visits in a year. This resulted in a deletion of about 90 pages.We did this on April 6 or 7 of this year. Two days later, we had a substantial drop in visits to the site. We had been getting about 300 sessions a day. Now, we are lucky to get that in a month. I know there was an algorithm update in late March, but our traffic dropped about two weeks after that, and a day or so after the deletion of the pages. There is a clear demarcation on analytics. I gave it a month, the traffic did not recover, so we decided to restore the pages. Traffic has not recovered and it has been about 3 months now. Does anyone have any thoughts on why we might have experienced such a drastic drop as well as what we might do to recover from it? Thanks very much
Reporting & Analytics | | jnfere0 -
Does traffic coming from Adwords increase overall Domain Authority or Page Rank?
If I'm setting up an Adwords campaign, will setting my homepage as the landing page boost my domain rank? and will the Page Rank of the landing page get boosted because of the high click rate coming from the Adwords campaign?
Reporting & Analytics | | s2bkevin0 -
Posting on blog comments with anchor text on high ranked pages effective?
So i've identified some blogs which have a fairly high ranking and lots of traffic. They also allow anchor text in the name field. Does it make sense for me to comment on these blogs, or does google treat these with less authority that true page links? Any advice is greatly appreciated! TIA
Reporting & Analytics | | symbolphoto0 -
Duplicate Page Title
I'm new to SEO and have just signed up to SEOMOZ to see what I can learn. I got the report back on my site and it indicates various errors, one of them being Duplicate Page Title - I have a blog on my site and a lot of pages identified as with duplicates are like this: http://www.martinspencephotography.co.uk/blog?page=2 Is it important I rectify this? Do I need to rectify it?
Reporting & Analytics | | MartinSpence460 -
Why is the page title sometimes missing in the API results?
Why is the page title sometimes missing in the API results? It exists on the page and in the "keyword difficulty tool", but missing in the API. It is never returned when upa= 1For example:stdClass Object(
Reporting & Analytics | | kirza
[fmrp] => 7.05087881216
[fmrr] => 5.05983022077E-6
[pda] => 91.758307504
[ueid] => 0
[ufq] => www.yellowpages.com/
[uid] => 0
[umrp] => 0
[umrr] => 0
[upa] => 1
[upl] => yellowpages.com/
[us] => 0
[ut] =>
[uu] =>
) {"fmrp":5.679443875178763,"fmrr":2.052551993215746e-07,"pda":70.05750830306422,"ueid":0,"ufq":"education-portal.com/","uid":0,"umrp":0,"umrr":0,"upa":1,"upl":"education-portal.com/","us":0,"ut":"","uu":""}How to get the titles for these pages?0 -
Huge Ranking drop without touching the page
I was ranked #5 for the keyword "Become a Sportscaster" - had been in the top 10 for months, then all of a sudden dropped to #46. I haven't touched this page in a few months, so I don't think I messed anything up. Any thoughts on why such a dramatic drop would happen? Brian Clapp Founder, SportsTVJobs.com
Reporting & Analytics | | sportstvjobs0