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
-
When Deployment done for my site in google analytic page views little bit affected
Hello Expert, For my ecommerce site every minute I have 500 visitors now when my development team do deployment like minor JS update where site restart not require then what I found is on website (front end) not able to find anything happen that means visitor not event realize page even refresh but in analytic real time it shows minor pageviews down. So can anyone guess here what happen actually in this case as per google? Thanks!
Reporting & Analytics | | micey1230 -
Google News Bug
During today and yesterday we are getting a lot of visits (Over 400) from http://news.google.com the visits are all at the same time and to different pages, the visits are very brief so much so that it pushes our bounce rate up to 69% in GA. Is there anything we can do to stop this? Thank you in advance?
Reporting & Analytics | | Palmbourne0 -
Page Name Tracking - Without UTM links
Hello, Our current site is fully html with no cms. We're moving to a newer version today with a typo 3 cms. My one worry is as follows; On some pages an internal link opens a jquery lightbox, inside the lightbox will be a video or download link. I cannot simply add a standard event url like I wanted to (utm_ link) as the pages are linked via the cms pointing to different pages, not the url's. We really need the following appearing in Analytics, whether its an event or landing page; The click of the light-box link The click of the video OR download link inside the lightbox. I would really, really appreciate any help on this as the new website is going live today, regardless whether this has been resolved. Thank you very much in advance of any replies. twY8s8B.jpg
Reporting & Analytics | | Whittie0 -
Google Analytics Page Metrics and Redirects
Hi All- Context: A site has been redesigned. Pages were renamed in the process. Problem: It's very hard to compare before and after metrics because the page URLs are not the same. Question: Anyone know how to do this in Google Analytics? I'm hoping there's some simple trick I just don't know about. D
Reporting & Analytics | | DonnaDuncan0 -
Webmaster Tools Error: Unreachable page
Hi all, When I try to the "Fetch as Google" feature on Webmaster Tools, I get the error Unreachable page. I checked the Google Analytics code, everything seems to be OK. What should I do?
Reporting & Analytics | | fisniks0 -
Is the meta description available on the On Page Optimization Report even if its currently being optimized?
Currently, description is only available if the element is not being optimized (i.e. character count is off/keyword isn't included in the description)
Reporting & Analytics | | Jerome670 -
Figuring Out the Source of "direct traffic" by looking at landing page parameters
I have a client who runs an e-commerce website, and I noticed that 40% of his traffic and 25% of his sales are all attributable to Direct Traffic. At first, I tried to solve this problem by tagging all of the previously untagged links in his e-newsletter, which I expect to be very helpful. However, then I looked at the landing pages for his direct traffic, and I see that it is almost entirely filled with thousands of unique URLs that begin with a question mark followed by the name of his e-newsletter or shopping cart vendor. It would be the equivalent of having a url like the following: "www.willmarlow.com/?constantcontact=keya;sldkfjsdlfkjdf;sldkjf" If we have this amount of information in the link, shouldn't there be a way to add additional parameters to the URL to move this traffic out of the Direct column? Has anyone encountered this before? Thanks.
Reporting & Analytics | | williammarlow0 -
Duplicate page content
I have a website which "houses" five different and completely separate departments, so the content is separated by subfolders. e.g. domain.com/department1 domain.com/department2 etc. and each have their own individual top navigation menus. There is an "About Us" section for each department which has about 6 subpages (Work for us, What we do, Awards etc.) but the problem is that the content for each department is exactly the same. The only difference is the navigation menu and the breadcrumbs. This isn't ideal as a change to one page means having to make the change to all 5 and from an SEO perspective it's duplicate content x5 (apart from the Nav). One solution I can see is to have the "About Us" section moved to the root level (domain.com/about-us) and have a generic nav, possibly with the department names on it. The only problem with this is that it disrupts the user journey if they are forced away from the department that they're chosen. Basically i'm looking for suggestions or examples of other sites that have got around this problem, I need inspiration! Any help would be greatly appreciated.
Reporting & Analytics | | haydennz0