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
-
Webmaster Tools Pages and Queries
In Google Webmaster Tools, under Search Analytics, what is the difference between positions in queries and positions in pages?
Reporting & Analytics | | CostumeD0 -
Why would page views per visitor suddenly increase?
My website traffic is growing by about 1% a week. It has a fairly stable page views/visitor of about 1.69. There's normally very little variability in this As we sell an industrial product. Today page views jumped by 50% and so did page views/visitor but visitor numbers stayed the same. I dont have a useful hypothesis to explain this. Analytics shows me that the traffic source, country of origin and pages viewed are pretty much the same as normal. There's been no substantive change to the site (today we changed the text in a widget to link to a new page - and no one visited it). It doesn't look like 1 person has gone through the whole site as that would skew the distribution of page views by country So why would user behavour suddenly change? I'll look at it for the rest of the week but in 7 years of looking after this website I haven't seen anything like this before.
Reporting & Analytics | | Zippy-Bungle0 -
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 -
Google analytic conversion code in a single wordpress page
Hello How can I add/place the Google analytic conversion code in a single wordpress page? Example: http://www.newsmilecostarica.com/thank-you/ Thank you so much Andy
Reporting & Analytics | | newsmile0 -
In-Page Analytics
Hey folks, In the in-page analytics section of GA I am wanting to get the % of clicks on a particular link over a large selection of dates. Does anyone know how to pull the data without having to do it day by day? Ideally I want to pull it all at once. There might of course be other ways to do this, if so please let me know. Thanks for your help. Cheers,
Reporting & Analytics | | CraigAddyman0 -
Editing Google Analytics eCommerce Javascript for Volusion
Does anyone know how to edit the ecommerce javascript with Volusion dynamic variables? I thought I did it correctly but none of the information got recorded in GA. It recorded that there was a transaction made but not info on the purchase price, order #, etc. This is the current code I am using: NOTE: In Volusions customer support center they provided this information: Where Order-Specific Information is Generated Order-specific information can be generated by JavaScript on the OrderFinished.asp page within Volusion. On this page, two JavaScript arrays will be initialized that advanced users may need to be aware of. The arrays and their contents are as follow:
Reporting & Analytics | | jhooley
Order Array Contents Order[0] = Order ID
Order[1] = Unused
Order[2] = Payment Amount
Order[3] = Affiliate Commisionable Value
Order[4] = Sales Tax
Order[5] = Total Shipping Cost
Order[6] = Billing City
Order[7] = Billing State
Order[8] = Billing Country OrderDetails Array Contents OrderDetails[X][0] = Order ID
OrderDetails[X][1] = Order Detail ID
OrderDetails[X][2] = Product Code
OrderDetails[X][3] = Product Name
OrderDetails[X][4] = (unused)
OrderDetails[X][5] = Product Price
OrderDetails[X][6] = Quantity Note that in the above example, X refers to a line item number (beginning from zero). Note that there can be multiple Order Details arrays - one for each item contained within an order. I'm a newbie at Analytics installation and could really use any help. Thanks!1 -
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