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
-
Blocking Standard pages with Robots.txt (t&c's, shipping policy, pricing & privacy policies etc)
Hi I've just had best practice site migration completed for my old e-commerce store into a Shopify environment and I see in GSC that it's reporting my standard pages as blocked by robots.txt, such as these below examples. Surely I don't want these blocked ? is that likely due to my migrators or s defaults setting with Shopify does anyone know? : t&c's shipping policy pricing policy privacy policy etc So in summary: Shall I unblock these? What caused it Shopify default settings or more likely my migration team? All Best Dan
Reporting & Analytics | | Dan-Lawrence0 -
How to analysis Product List position in Analytic for 2nd Page Clicks?
Hi All, While implementing Product list position when user move to 2nd page then position again start from 1st position so how I will know in google analytic that 1st Position clicked from 1st page, 2nd page, 3rd page etc and same way how do i know if page is sorted with highest or lowest price? I am talking about given below position. dataLayer.push({ 'ecommerce':{ 'currencyCode':'EUR', // Local currency is optional. 'impressions':[ { 'name':'Triblend Android T-Shirt', // Name or ID is required. 'id':'12345', 'price':'15.25', 'brand':'Google', 'category':'Apparel', 'variant':'Gray', 'list':'Search Results', 'position':1 }, Regards, Mitesh
Reporting & Analytics | | Arnold30 -
GA Landing Page Inaccuracies
I had seen a thread on this a while back but no solution posted. There was a link posted to someone else explaining the issue but I got a 404 when clicking. Have a client that does mostly PPC and they are getting their conversion page showing up as landing page from paid many times. This is definitely not a sitelink, etc. The only way you get to this page is if you filled out the form. There are a few other pages showing up as landing pages that don't make sense too. Can this be attributed to someone being "inactive" for 30 minutes and then coming back and performing an action on this page (leaving)? If so, does this double count the conversion if a page visit here is a conversion? Just trying to make sense of the landing page report showing so many instances of our conversion page. Thanks in advance!
Reporting & Analytics | | jeremyskillings0 -
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 -
Increase number of pages crawled
Only one page is being crawled, how do I increase the number to include most of our site?
Reporting & Analytics | | NorthCoast0 -
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 -
Google.co.uk (The Web or Pages From UK) Query?
Hi, Google.co.uk is ambiguous at best, it is geo targeted for the UK, however, by default all results incorporate "The Web" meaning outside the UK. If a user wishes to filter to "Pages From UK" then they have to click that specifically. Now my clients regularly ask me whether the traffic they are getting is from Google.co.uk (The Web) or Google.co.uk (Pages from UK) In analytics it combines these two as single source = Google.co.uk without any further breakdown, is there a way to figure this out. If I can split the figures then I can run necessary additional comparisons etc. Regards Ausaf
Reporting & Analytics | | conversiontactics0 -
Too Many On-Page Links
I'm getting the warning of "Too many on-page links". I have a number of affiliate marketing sites, all Wordpress, all with sidebars. In the header navigation bar is a link that offers "reviews" and links to each product/brand. This is not a drop down link but leads to a page with product links. Also, in the sidebar I have links that also lead to the products/brands. Redundant yes, but in the beginning this seemed to be a good practice in site design. It would be easy to simply remove the widget that contains the link process in the sidebar. The problem may simply be that the sidebar is the same for every page in the site(s). Is this hurting total SEO as my sites are all over 95-percent indexed. One site in particular does very well in traffic and sales so is removing these links potentially going to improve my SEO and ultimately by success? Thanks, Don
Reporting & Analytics | | JavaManOne0