Close and Go BackBack to Viget

How To Track Internal Links in Google Analytics

Josh Chambers
68 Jul 16
By Josh Chambers, Marketing Strategist :

What do you do if you want to track how often a link on your site is clicked? How do you see those links in Google Analytics (GA)? What filters and profiles should you create to accurately track this information? Hopefully, I can accurately answer these questions—some of them in this post, some in the future. *Warning* if you don’t care about web analytics, reading this post may produce seizures and a strong desire to fall asleep on the job.

First, why in the world would you want to track internal links? Isn’t that stupid idea?

  • If I click the “go here now” link on my site, and it takes me to another page on my site ( www.example/go_here_now.html ), why do I need to track the link? Wouldn’t I just check the navigation path report for /go_here_now.html? Yes, you could do that. But what if you have multiple links on Page 1 that link to Page 2? How do you know what links brought someone from Page 1 to Page 2? Was it the blue link? Or the green button? The navigation path simply tells you what page people came from and to, it doesn’t tell you exactly how they got from page to page

Second, which method of link tagging should you use? _trackPageview or utm? 

  • If you don’t know the difference, read this. If you do, skip to the next bullet.
    • The _trackPageview JavaScript creates a fake pageview. This method is most commonly used to track outgoing links or downloads. The _trackPageview attribute is placed within the <a> tag and looks like this: onClick="javascript: pageTracker._trackPageview(’/example/blue-link’). The /example/blue-link becomes a new pageview and it is tracked in GA as a new pageview - so it will increase your pageview count. These fake pageviews will now show up in your “content” reports. More information.
    • The utm method involves telling GA what the campaign name is (you define this), the source (typcially something like Google), and the medium (typically something like PPC) - as well as a few other options. This method is most commonly used in tracking PPC campaigns (as Google AdWords does this automatically), email campaigns, and other external campaigns that link back to your site. Epikone has a great post on this, and here’s some additional Google info.
  • I recommend using the _trackPageview method.
    • If you choose to tag your links with utm, it erases all referral information. In other words, if someone arrived at your site via a Google organic search; but they then clicked on an internal link that had the utm tagging, you lose the insight that the visitor originally came from the Google organic search (the source and medium). Instead, you see the new source and medium information that you manually entered. For me, that’s not a good option. I need to know where the visitor came from as much as I need to know what internal links they’re clicking on. Again, check out Epikone’s post.
    • Because _trackPageview creates a new pageview, you can use custom filters to include and exclude those pageviews from GA profiles (more on that below). Also, you don’t lose any referral information.

Now then, to answer the questions I began this post with...

Step 1: Proper GA tracking script placement. It’s all about the delivery.

  • Usually, when we’re not using _trackPageview, we recommend placing your GA tracking script just before the close of your <body> tag. We do this so that if GA is loading slowly (which rarely happens), your whole page can load before GA kicks in and it won’t have to wait up for a slow GA server. However, in this method we’re tagging links within the <body> tag, so GA needs to kick in before those tagged links load on the page. The GA tracking script should be placed after the opening of the <body>  tag, and before your tagged links, to ensure your tagged links load after the GA tracking script. Make sense?

Step 2: Add the _trackPageview  variable to your links.  Do, or die.

  • Add the snippet onClick="javascript: pageTracker._trackPageview(’/outgoing/example.com’) to your links. Once done, your link should look like this:
  • <a href="http://www.example.com" onClick="javascript: pageTracker._trackPageview(’/outgoing/example.com’);">

Step 3: Define your URL structure. Be as Type A as possible.

  • In order to use this tool effectively, you will want to quickly find and filter in/out and all of your manually-created pageviews. I recommend using at least two subdirectories when deciding how to name your new “pages.” For example: /internal-links/blue-link. Even better: /internal-links/homepage/blue-link. The reason? If you’re trying to quickly find and filter your manually tagged internal links, having a generic base directory like “internal-links” makes your life a lot easier. Creating each link with only one subdirectory like /blue-link and /pink-link and /red-button means you would have to search for each of those URLs manually—boorrrrrring.

Step 4 (OPTIONAL): Create a filter to exclude your new pageviews from your regular profile. Faux pageviews, unlike fauxhawks, are bad.

  • Create a custom filter: 
    • Filter Type: Custom filter
    • Check the “Exclude” radio button
    • Filter Field: Request URI
    • Filter Pattern: ^/internal-links/homepage.*
    • Case Sensetive: No

Step 5 (OPTIONAL): Create a new profile to include only your new links. Analytics = fun.

  • Create a new profile. Again, be Type A with your naming system
  • Create a filter. From the dropwdown menu, select the “Include traffic only to a subdirectory”
  • Enter the two base directories of your newly created pageviewinto the “Subdirectory”. Using our example of /internal-links/homepage/blue-link, we would enter this into the “Subdirectory” field
    • ^/internal-links/homepage/

Step 6: Test it

  • After 24 hours, view your new profile to see if everything was implemented properly.
  • If you didn’t create a new profile, view your “Top Content” report and search for “internal-links” or whatever nomenclature you chose to use. 
  • If it’s not working, check to ensure you’ve copied the _trackPageview code exactly as is and check to ensure your filters are implemented properly if you’re using them. If you’re stuck, feel free to drop a comment and we’ll get back to you.

There you have it! I’ll write another post on how to use these pageviews for goal tracking, but in the meantime please don’t hesitate to ask questions if this was confusing, and please let me know if I’m off base.

I’m going to go get some exercise or something...my head hurts, and I’ve fulfilled my nerd quota for the week.

Checkout Part 2: How to Track Internal Links as Goals in Google Analytics

blogjunkie said on 11/06 at 04:26 AM

Josh, do you know how Facebook does it? They use a ‘ref’ variable e.g. http://www.facebook.com/home.php?ref=home
and http://www.facebook.com/home.php?ref=logo

Josh Chambers said on 11/06 at 09:13 AM

Hey blogjunkie: What exactly are you asking? How Facebook tracks its internal links? Or how GA can track links coming from Facebook?

I’m assuming the first… I’m not sure what analytics platform they’re using. BUT, it looks to me like they’re just naming their nav items by appending a unique piece of info to the end of each relevant URL. This looks like it’s hard coded into the site and is irrelevant of their analytics platform.

That is another way to do it if you’ve got the technical expertise. You can append things to your URL’s to make them unique and then filter things in GA.

We (Ben) just came up with another way of doing this, I plan on writing about that soon.

Does that answer your question?

blogjunkie said on 11/06 at 10:10 AM

Hi Josh, sorry for the vague question. But yes you answered my question (I think).

I guess I would hard-code the ref variable of each link on my website (it’s a Flash site so GA’s built-in click maps don’t work). In my main GA profile I would filter out the ref variable. And in a separate profile I would include only the ref variable to only track the internal links.

Sound about right?

Josh Chambers said on 11/06 at 10:38 AM

No worries. What exactly are you trying to track? What’s your goal?

You could hard code those variables into your Flash, or you could use the _trackPageview method. We just implemented it on a site of ours in a flash piece and it worked great. We just had to alter a few things. Check this out

If you are altering URL’s for the sake of tracking internal links, you won’t need to filter those links out of your report as it’s not actually creating additional pageviews.

To view them, all you need to do is search your top content report.

If you’re interested in really understanding that traffic, you could create another profile that only filters in traffic with “internal-links” in the sub-directory or something of that nature. I think one of the pre-built GA filters is “include traffic only from a subdirectory.” Use that filter. Just ensure you’re using the same base keyword for all your variables so you can easily filter them into another profile.

Make sense?

blogjunkie said on 11/06 at 09:14 PM

Hey Josh, big thanks to you. I think I know what to do now.

I also want to tell you that you guys at Viget are a big inspiration for the team here in my company.

Josh Chambers said on 11/06 at 09:27 PM

no worries. happy to help.

here is the client we just implemented some _trackPageview action for in the main flash area on the homepage.

http://healthychild.org/

thanks for the questions, and thanks for the kind words!

ultrasound said on 11/20 at 01:49 PM

Hi Josh, first, thanks for this article, it really helped me setting up internal link tracking via GA. 

However I am having a problem and wanted to see if you have any suggestions.

I put the GA tracking code right after the opening <body> tag.  Then I’ve added the onClick=” ... “ three of my links that I want to track link clicking for. 

When I checked my GA account today, it doesn’t show anything about these pages.  I checked and double-checked everything and I don’t know what could be the problem at this point.

My GA code is ok, I verified it.  The onClick follows exactly what you recommended.  Here is an example: 

onClick="[removed] pageTracker._trackPageview(’/InnerLinks/Onboarding/MainPage’);”

Any ideas?

Josh Chambers said on 11/20 at 01:59 PM

Hey Ultrasound:

I’d be happy to take a look. The easiest way is probably for me to just take a look at the page you’re talking about. What’s the URL of the page, and what link are you trying to tag? If you’d rather, feel free to email me the URL @ josh.chambers@viget.com

Sound good?

ultrasound said on 11/20 at 02:08 PM

Hey Josh thanks for your help.  I just sent you an email with the url (would love to share it, but it’s work related and internal). Let me know if you do not get an email from me for some reason. 

Once we (hopefully) fix my issue, I’d be more than happy to share the resolution with your blog visitors, perhaps through a dummy example webpage.

ultrasound said on 11/25 at 11:54 AM

Thanks Josh, the issue I was experiencing with GA is now fixed.  After days of tests and trials, I found out that the source of my issue was the single quotes around the URL name structure. 

The single quotes were not plain text (I copied the code from the web), so the code was not being read correctly.

So basic lesson learned? Always copy your code into a notepad or other text editor before copying it into your code!

Josh Chambers said on 11/25 at 06:01 PM

Glad I could help (read: be a sounding board) in a small way = ) Email me again if you need anything else!

michelle said on 02/02 at 01:03 PM

Hi Josh, did you write another entry on how to use these pageviews for goal tracking? I can’t seem to find it and would love to hear your thoughts. Thanks!

Josh Chambers said on 02/02 at 03:20 PM

@Michelle: I’ll write it this week! Thanks for reading = )

Vero Tabares said on 02/22 at 11:03 PM

Hey Josh, I have something of a subject related question: would the javascript attribute work for links pointing to my site?

I want to start tracking a few links that are coming in to my site from outside sources that I’ve set up a link exchange with.

I hope I’m asking the right question…

Any insight would be greatly appreciated!

Josh Chambers said on 02/23 at 08:57 AM

@Vero: That makes total sense. You wouldn’t use this JS method. Instead, you would use the UTM method I describe above. Using the Google URL builder, you create a special URL and use that as the destination URL.

Once you’ve created your URL, your data will begin appearing under “Traffic Sources / Campaigns”

If after you builder you URL you still have questions, let me know.

The Google URL builder is here: http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55578

Thanks for reading!

Rebecca said on 05/11 at 12:06 PM

Hey, this is really helpful, I’m going to use it to see if anyone is clicking on links in the related information column of our website. Very helpful instructions.  My only question is....do I really need to move the GA code to the top of the body?  Doesn’t GA only need to load before someone CLICKS on one of the links? I don’t really want to mess with moving the GA code across our whole site to the top of the body tag.

Tony Pitale said on 05/12 at 06:12 PM

@Rebecca: As far as I (a developer) know, yes that should still work. Amazingly, you may still find people click links before the script has loaded. Whether people just click very quickly, or GA is loading abnormally slowly. Moving the script to the top helps to guarantee clicks won’t be missed.

If, like me, you feel a few missed clicks are worth sacrificing for better page loading then I say: leave it be.

Amazon Deals said on 06/09 at 06:55 AM

Great post. One thing though: what about using the utm method and adding nooverride to the link?

Josh said on 06/09 at 08:43 AM

@Amazon Deals: Thanks! Good question. The problem with using the UTM method is that it overrides the original source. So you don’t know where the visitor came from. Also, if you used the noverride that would mean you would be completely ‘blind’ from that point on.

What if they arrive via paid search, remember your brand name and arrive via organic search, then finally return one last time via direct traffic before the purchase? You need to know that to plan your marketing efforts and user experience to match their three stage process.

Sustoo Amazon Discounts said on 06/09 at 09:20 AM

Hmm, the problem is that the CMS solution doesn’t allow us to add javascript to the HTML link code.

Josh said on 06/09 at 10:46 AM

@Sustoo: Seems like you might need a new CMS = )

One thing we’ve done is use unobtrusive JavaScript to retroactively tag links based on a class name. If we place an < a > tag within a specific class, our JS goes back through and appends the tracking automatically. That could be an option for you? Feel free to email me if you’re interested.

Sustoo Amazon Deals said on 06/10 at 05:20 AM

Oh we definitely need a lot of stuff done but there’s no way we’re getting it :-/
And I don’t think our tech guy would let us add an additional js code to an already overloaded and dilapidated site.
Never mind..the sites are going to be down soon anyway.
Thanks again Josh.

Josh said on 06/10 at 09:17 AM

@Sustoo: Have you ever used CrazyEgg? That might be an easy solution for you. I love it:

http://crazyegg.com

Amazon Deals said on 06/10 at 09:22 AM

It’s a flash site though. I’m not sure if site overlays work with it.

Toby Stephenson said on 06/23 at 10:11 AM

This looks exactly what we need but we get this error:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Timestamp: Tue, 23 Jun 2009 14:08:57 UTC

Message: ‘pageTracker’ is undefined
Line: 257
Char: 2
Code: 0
URI: http://www.MYdomainNAME.co.uk/

How do I define it? I’m not a JS guy! Thanks

Josh Chambers said on 06/23 at 10:24 AM

Toby,

Did you move your Google Analytics javascript to the top of your code?

Also, be sure you didn’t copy and paste directly from the blog post. It needs straight quotations, and often copying and pasting makes squiggly quotations. Type it out word for word in notepad, then copy it in.

Let me know if that helps.

Toby said on 06/23 at 10:51 AM

Hi Josh

Thanks for a speedy response. I’ve put the URL in for you to look at the source of the page. It’s right below < BODY >.

Yep, I saw the post above about ` and ‘ being different :-)

It’s probably something very simple, maybe I’m using old GA code?

Thanks!

Josh Chambers said on 06/23 at 10:57 AM

Toby,

You got it! You’re still using the “urchin” tracking script. You need to swap that out with the new script. To do that…
* Logins to GA
* Click “edit” next to your GA profile”
* Click “check status” (tiny link on the top right)
* Copy that code, and replace the “urchin” code

That should do it!

Toby said on 06/23 at 12:06 PM

Josh

The client sent me new code and I pasted in, voila. As far as I can tell that works nicely now. She’ll happily click away and check GA tomorrow to see.

Many thanks and keep up the good work.

matej Borko said on 07/20 at 12:04 PM

Hi Josh, very useful post, but if you can help me with this problem.

I’m tracking outgoing links on website A to website B using [removed] pageTracker._trackPageview(’/outgoing/example.com’) and it works fine.

But, when i compare “Unique views” in Top Content report in Analytics A with “Visits” in Referral Sites in Analytics B, there are different numbers.

Example:
GA account for website A.sk, Top Content, Content detail for “outgoing/B.sk”:
6,105 Pageviews
4,610 Unique Views

GA account for website B.sk, Referring Sites, “A.sk”:
1,761 Visits

I suppose that Unique Views and Visit should be equal, or?

Many thanks!
matej

sandi said on 07/23 at 05:11 AM

Hi Josh,

I was wondering if you could help me! I want to track 1 link.

I put the google analytics code just after the <body> tag

I added the following code to the link I want to track.

<a href="mylink.html" onClick="[removed] pageTracker._trackPageview(’/internallink/mylink’);">MY LINK</a>

I did this on Monday, it is now Thursday - When I type in mylink or internallink into the filter field - it says There is no data for this view.

Can you help me please? What am I doing wrong?

Many Thanks

David Wang said on 07/23 at 05:49 AM

matej, I think you can’t avoid those things. Even when I buy banners on websites the number of clicks don’t always tally with the number of visits. The Viget guys may have more insight into this.

sandi, you should double check that:

1. Your GA code is BEFORE the </head> tag

2. Your link includes the ‘javascript’ part like this:
pageTracker._trackPageview(’/internallink/mylink’);” ]MY LINK

3. Your quotes are not curly quotes. Sometimes when you copy code with quotes off the web they become like this “ (curly) instead of “ (straight). Increase the text size to see what I’m talking about

Sandi said on 07/23 at 06:11 AM

Hi,

Thanks for getting back to me so quickly!

I have put the GA code before the </head> tag.

I also checked the quotes and they were straight quotes; not curly.

Hopefully I will get some results now.

Thank you so much for your help!

Sandi said on 07/27 at 03:53 AM

Hi,

I just tested to see if I get any results in google analytics and still no luck :(

Any more suggestions would be greatly appreciated!

Thanks again

David Doctor said on 07/30 at 09:58 AM

Helpful post. Thanks!

Will Reinhardt said on 08/11 at 05:42 PM

This is a great start for me, thank you. I’m wondering if the rest of Analytic’s eCommerce tracking applies to the pageviews you create? Meaning, if a customer clicks on a link that you’ve assigned to track as you specify above, and then goes on to make a purchase will that information show up in Analytics?

Working on implementing this now. Rock on.

Josh Chambers said on 08/19 at 07:50 AM

@Will: You got it! You’ll be able to see the $Index value for the virtual pageviews you create. You can also include the virtual pageviews as part of your goal funnel, and view the “navigation summary” for each virtual pageview. Basically, GA treats them like real pages.

Let me know if that doesn’t answer your question.

Will Reinhardt said on 08/25 at 05:40 PM

Very cool Josh, thank you. This is working well for us now. One thing to be aware of though, is that many ecommerce sites rely on Analytics for goals and revenue reports. More specifically, we need to know which banners are actually working.  If you apply the filter to only include traffic to a specific directory (for the duplicated profile, as you suggest), it’s likely that the goals will stop working since they aren’t in the same directory as /internal-link.

My solution is to simply leave off the custom filter for the new profile so I can get the ecommerce data I need to figure out which banners are performing well.

Levi Page said on 08/26 at 08:03 PM

So does this mean that there is no way to track banners using the URL builder without messing up (erasing) the original referrer information?

Also how does trackpageview affect bounce rates and time on site? Why do people say it makes the bounce rate and navigation reports useless?

A side note… I didn’t see how the UTM stuff could even work for internal links if it relates to the referrer. I just thought I would ask because I probably missed something.

Josh Chambers said on 09/08 at 05:45 PM

@Will & @Levi: Sorry about the delayed response - vacation.

@Will: Great point. What I’ll do is make a custom filter that uses regular expressions to include my landing page, and the relevant URL. Example subdirectory filter: /landing\-page.*|/internal\-link/landing\-contact.*

That’s only if I’m not using ecommerce though. And I rarely filter the internal links out of my main profile anymore.

@Levi: No, you should still use the URL builder for inbound links - just not internal (on-site) links. What some people do is create a link with the URL builder, then use that as the link href on their own site.

It doesn’t make the bounce rates useless. When someone clicks on a trackPageview link, it says to GA, “They didn’t bounce.” So, it might lower bounce rate because GA no longer considers it a one page visit, but it’s supposed to do that.

People usually complain about the setVar feature jacking up bounce rate, because it does. But that’s another topic altogether.

Thanks for reading!

josh said on 09/23 at 10:51 AM

Do you recommend placing the tracking code for the _trackPageview method in the header and or body or is there a specific reason to place it just inside the body tag?

I am using a cms and so the header file is a logical place to put the tracking script...any thoughts?

Josh Chambers said on 09/23 at 12:54 PM

@Josh: The head is totally fine - that’s what we do as it’s usually a global change.

Check this article out: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55574

Levi said on 09/23 at 02:03 PM

Thanks for your help, Josh.

Levi

josh said on 09/24 at 12:08 AM

When creating a custom filter I saw your instructions read this for the Filter pattern:
^/internal-links/homepage.*

is all that syntax “^” and the “.*” required?

Josh Chambers said on 09/24 at 08:29 AM

@Josh: Yeah. The “^” makes sure “/internal-links” is at the beginning, and the “.*” basically means it doesn’t matter what comes next - count it. Those symbols are regular expressions.

Check this out: http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55582

Josh said on 09/24 at 10:13 AM

Thank you for not only clarifying but pointing me to a resource too!

Josh said on 09/25 at 01:09 PM

If this is done correctly with the Site Overlay now show the results for the newly tracked links.

For example if I have a image and a text link side by side on the page, both of which go to the same link...but me being curious about which is clicked more have tagged them based on your article...will these now register results per their unique tracking tags on the site overlay?

Josh said on 09/27 at 08:50 PM

I am having some trouble with this step:

Step 5 (OPTIONAL): Create a new profile to include only your new links. Analytics = fun.

I am a bit unclear how to do this can you give me a bit of guidance?

Thanks

Jipsa said on 10/10 at 05:24 AM

Thanx for both of your posts regarding internal links. They were really helpfull when setting up trackpageview for my company’s site.

Jipsa

Josh Chambers said on 10/12 at 01:10 PM

@Josh: Check this out: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55496

@Jipsa: Thank you!

Josh said on 11/16 at 01:14 PM

I want to track the clicks on an outbound link to a new url. Additionally I would like to get as much data as possible about how far the user gets through a form on the new url.

Is this possible? What’s involved with this scenario.

I don’t even know what resources to look for to solve this need so if you can point me in a direction that would really be useful.

Thanks again for posting this really helpful article.

Josh Chambers said on 11/19 at 03:16 PM

@Josh: Do you own the second domain you’re sending people to? Can you place Google Analytics tracking script on that page?

This method will tell you clicks, but won’t tell you what they do on that new domain once you send them there. That is possible, provided you can add GA script to the other domain. Let me know.

josh said on 11/20 at 02:18 AM

Josh,
Yes I can place GA script on the second domain. It will have to be the https:// version but should be doable.

My goal is to be able to track that same user from one site through to the next showing how deep they get into the “funnel.”

Any tips about how I can do this?

Josh Chambers said on 11/20 at 09:23 AM

@Josh: Yeah, that’s totally doable.

Check this out:

http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html

http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55503

Also, when you login to GA, you can get new tracking script for crossing multiple domains by going here:

Account --> Edit Profile --> Check Stats (top right) --> Select ‘Multiple Domains’

josh said on 11/20 at 03:07 PM

Josh this is terrific information. Thank you for sharing your knowledge.

BTW: Is this Engage site also EE powered? Really love what your group has done with your sites.

Josh Chambers said on 11/20 at 03:28 PM

@Josh: No problem! Yeah, all five blogs and our .com site is hosted on the same EE build. It’s pretty flexible for what we’re doing. The design team has some pretty cool EE info:

http://www.viget.com/inspire/search_results/c83cd632f38894ff8d1ff0b9c2aed361/

Mandy said on 11/23 at 12:27 AM

Hi Josh, hoping you might be able to help me. I am trying to separately track traffic to eight different sections of our website (each section contains 10-20+ pages). I’ve looked into creating eight profiles and applying filters to each to include subdirectories, but unfortunately when our website was set up by our CMS provider, the pages were assigned numbers in the URL (i.e. blah.site.com/www/html/1234-pagename.asp), rather than directory names (e.g. blah.site.com/dir1). So every page has a different number, and no unifying subdirectory to help me track sections in GA.

I am wondering if I might have to somehow use filters, but I am not sure of the best way. Our site has more than 150 pgs so I was hoping to avoid creating a separate filter for each page… Any ideas?

Josh Chambers said on 11/23 at 10:40 AM

@Mandy: You could do one of two things (I think...):

Write subdirectory filters using regular expressions to include all the relevant page names (i.e.: ^/123.*|^/456.*|^/789.*)

Check this out: http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55582

Or, you could rewrite your page names manually by inserting new page names inside of the “trackPageview” variable in your Google Analytics JavaScript - that would probably require custom JavaScript work. Sort of like this: http://www.google.com/support/googleanalytics/bin/answer.py?answer=55576

Mandy said on 12/11 at 12:12 AM

Hi Josh, Thanks for your suggestions - a bit of a trickier situation that I anticipated so I might see how time consuming those options are and talk to our CMS providers about it. Keep up the great work!

Mandy

Eric Ramos said on 01/04 at 06:13 PM

Correct me if I’m wrong

Take this Example utilizing the onClick="[removed]pageTracker_trackPageview code

2 links on the Home page that go to the same landing page URL

Link 1) Buy Here
Link 2) Click to Join
Landing Page URL: proces.php

If I applied the unique onClick code to the 2 links, the Top Content Report will show me “Clicks (pVs)” by each link.

This information is great; however now say I wanted to see the Navigational Summary of the Home Page; regardless of the unique links. 

Does the top Content Report breakdown because it now is setup to show the navigational summary by Links versus by page?

Thanks
Eric Ramos

As I understand, if I tag my links with the “onClick="[removed]pageTracker_trackPageview" code, The Top Content Report will show me

<a href="http://healthychild.org/get-involved/newsletter/" id="btn-join" title ="Join the List” onClick="[removed] pageTracker._trackPageview(’/internal-links/email_list_header’); “></a>

Josh Chambers said on 01/05 at 11:16 AM

@Eric:

If you’re saying you’d like to see the Navigation Summary without the virtual pageviews, it’s as simple as creating a profile that excludes all virtual pageviews.

If you don’t exclude those virtual pageviews, the Navigation Summary won’t break - those virtual pageviews will appear as “Previous” or “Next” pages in the Navigation Summary report.

Does that answer your question?

Eric Ramos said on 01/05 at 01:10 PM

Hello Josh,

Thanks for your update

I created 3 Profiles:

Profile 1) No Filters
Profile 2) Filter to exclude my new virtual pageviews (Step 4 Optional)
Profile 3) Filter to include my new virtual pageviews (Step 5 Optional)

If I was interested in the Navigation Summary for the following situations: Would these Profile References be accurate.

Situation --> Profile Reference
Home Page to Page A --> Refer to Profile 2 ?

Link A on Home Page to Page A --> Refer to Profile 3 ?
vs
Link B on Home Page to Page A --> Refer to Profile 3 ?

Would Profile serve a purpose in navigational summary.

Thanks for your time.

Josh Chambers said on 01/20 at 01:39 PM

@Eric: Sorry for the delay! Yes on the first, no one the second two.

When you apply the exclude filter on your internal links, they literally don’t get pushed into that profile at all - so they won’t appear on the Nav Summary (Profile 2). you apply the include filter on your internal links profile (Profile 3), you’re excluding every other pageview.

Profile 1 will be the only profile that contains both links in Nav Summary - and even that is a bit odd sometimes when using virtual pageviews.

Does that answer your questions?

Victor Acquah said on 01/25 at 11:15 AM

Josh:  Have you tried this with the new asynchronous code?  I am having some trouble getting it to work - however, the setup is exactly the same as you describe - See the discussion about it here:

http://www.google.com/support/forum/p/Google+Analytics/thread?tid=62b5e24062a9831c&hl=en&fid=62b5e24062a9831c00047dfe8967b795

Josh Chambers said on 01/25 at 11:20 AM

@Victor: Have you checked this post out? I basically just tweaked this post to include async: http://www.viget.com/engage/how-to-track-internal-links-in-google-analytics-using-asynchronous-tracking/

Victor Acquah said on 01/25 at 11:22 AM

I found it after posting here! Reading it now. Thanks for the speedy response!

Lena said on 02/01 at 05:34 PM

Hi Josh,

Thank you for the article.
Please help. I have problem with step #5 - create a new profile to include only new links. ^ character is not valid character for “Subdirectory” input text field.

I’ve chosen Edit Filter > Predefined filter > include only > traffic to the subdirectories > that are equal to > Subdirectory > ^/internal_links/. Beside subdirectory box there is a hint “(e.g. /mydir/)”. The field accepts all kind of special characters but not “^”. If follow the hint nothing is tracked because the folder is not a real folder.

Does that mean that it is not working with the latest version of analytics?.. or I’ve misunderstood something?

Josh Chambers said on 02/02 at 10:53 AM

@Lena: Actually, this article was written before an update in GA. If you use the pre-defined filter of “that are equal to > subdirectory” then you don’t need the ^. The ^ means “make sure this starts at the beginning - make sure nothing comes before this.” When you say “equal to” it’s doing that for you. It’s saying “it has to be this exact URL - nothing before, nothing after.” Make sense?

Name:

Email:

URL:

Not an infant or robot? Please prove it:
What is the third letter in apple?

Some HTML (strong, a, em) is allowed.

Notify me of follow-up comments?

We’re the Marketing Lab at Viget, a full-service web agency with expertise in digital marketing, social media, analytics and SEM.

Contact Us

Have any questions, comments, ideas, or secrets to share? Let us know.


What is the third letter in apple?

Sorry, you need to have Javascript enabled to use this form. (Don't blame us, blame the spammers!) If you'd like to contact us, please visit our Contact page.