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
-
Solved How to solve orphan pages on a job board
Working on a website that has a job board, and over 4000 active job ads. All of these ads are listed on a single "job board" page, and don’t obviously all load at the same time. They are not linked to from anywhere else, so all tools are listing all of these job ad pages as orphans. How much of a red flag are these orphan pages? Do sites like Indeed have this same issue? Their job ads are completely dynamic, how are these pages then indexed? We use Google’s Search API to handle any expired jobs, so they are not the issue. It’s the active, but orphaned pages we are looking to solve. The site is hosted on WordPress. What is the best way to solve this issue? Just create a job category page and link to each individual job ad from there? Any simpler and perhaps more obvious solutions? What does the website structure need to be like for the problem to be solved? Would appreciate any advice you can share!
Reporting & Analytics | | Michael_M2 -
SEO Effect of inserting No indexed Contents in normal Pages (Nextgen Gallery)
Hello Dear Community, I'm running a photography website and have a question about the indexability of "No indexed Content" inserted on indexable pages. Background : I read everywhere that best practice is to "no index" all useless pages with few content, what I did with Yoast plugin : I no indexed all my nextgen galleries and "ngg_tags" since they create single pages for every photo, tags or slideshow. I did the same for all my porfolio-posts, price lists, testimonials and so on... Nevertheless, I inserted these galleries and portfolios on SEO optimized page for my target keywords. + Nextgen plugin automatically adds these images in the page sitemap. My idea is to have only my Seo optimized page showing in Google and not the others. Problem: I've been checking the results in Google Search Console, filtering by images : I discovered that most of the images featured in these Masonry galleries are not showing in google, and actually almost all the images indexed are the Wordpress from media gallery. I double checked with Screaming Frog, and the software doesn"t see images on these pages. My question is: Is the low indexablilty of these contents are related to the No indexation of the original contents ??? Does somebody has experienced the same issue that these contents doesn't show on Google ? in advance many thanks for your help
Reporting & Analytics | | TristanAventure0 -
Why few pages have more than 100% bounce rate?
Hello All, For my ecommerce site approx more than 30k products I have. In Google Analytic approx daily for few products approx 10-15 products bounce rate show 300%, 200%, 150%, 140%, 125% how? and what is the solution? Product page daily change. Thanks!
Reporting & Analytics | | Johny123450 -
How is it possible that this site has a higher page authority than my site?
Judging by open site explorer, I'm crushing my competitor in every imaginable way. And yet, somehow they have a higher page authority than me and, consequently, are ranking higher than me. How is this possible? My site is on the left: 40atcpP.png
Reporting & Analytics | | ScottMcPherson0 -
How to hook up a ppc campaign to a google + Page
Greetings,
Reporting & Analytics | | Nightwing
Sometimes you just want to give Google a big slap for making straight forward requests damn impossible. So all i ma trying to ad is point a ppc ad at this Google + account <a>https://plus.google.com/118393512656496298734#118393512656496298734/posts</a> But i get a warning sign saying:
"The URL must be for a Google+ page, not a personal profile" I then spend half an hour tring to find a Google + page but get no where fast 😞 Warning message illustrated here:
http://i216.photobucket.com/albums/cc53/zymurgy_bucket/google-page-plus_zps46ff995a.jpg So my question is please how to a get the Google + page for this account:
<a>https://plus.google.com/118393512656496298734#118393512656496298734/posts</a> Any insights welcome!
David0 -
Can underscore blanks trigger home page bounce rates
Buongiorno from 8 degrees C Wetherby UK 🙂 On this site the scrolling banner has been hyperlinked with underscore blank causing new pages to open when a user clicks on a banner. My question is please... "If a user clicks on a banner will Google measure this as a home page bounce" ( I dont think it will i just want to be 100% sure) Click here for illustration:
Reporting & Analytics | | Nightwing
http://i216.photobucket.com/albums/cc53/zymurgy_bucket/home-page-sw-banner_zps0fda6318.jpg Grazie Tanto,
David0 -
Google Webmaster says "0" pages indexed
Built my first Wordpress site. It launched a few months ago. Google has crawled 76 pages so far. But why are 0 indexed?
Reporting & Analytics | | cschwartzel0 -
I have two campaigns that are only crawling one page, why is this?
I have a total of three campaigns running right now, and two of them are only crawling one page. I set the campaigns up the same, what is the problem?
Reporting & Analytics | | SiteVamp0