Add to Google Add to Bloglines Add to Newsgator Add to Yahoo! Contact ROI Revolution Sign Up for the ROI Newsletter Unofficial Google Analytics Blog Feed Unofficial Google Analytics Blog
Unofficial Google Analytics Blog by ROI Revolution

Categories Search This Blog Blogroll Archive

| |

February 14, 2008

Exact Keyword Tracking with ga.js

By Michael Harrison, Google Analytics Support Tech

Sleuth! Magnifying glass icon.Last April, I posted a script that allowed paid search advertisers to view the exact search queries of their visitors. This was essentially a free tool that gave website owners the ability to weed out ineffective keywords and put more money toward the precise phrases that were really driving their business.

Google Analytics doesn't do this out of the box. It will tell you exact search queries for visits from organic listings, but for paid search, you're stuck with the keywords that you're bidding on. With broad and phrase matching, these could vary pretty drastically from what the visitors typed into the search engine.

We've gotten a lot of requests to update the script for the new version of the Google Analytics JavaScript, ga.js. Always happy to oblige, we've been hard at work on our new version of the Google Analytics Keyword Sleuth. Call it a Valentine's Day gift from ROI Revolution to you.

Using ga.js?

If you've upgraded to ga.js, then you'll need to grab the new ga_keyword2.js file from our server and upload it to yours. Make a note of where you put it.

Now, update your Google Analytics Tracking Code:



The only addition is <script src="/path/to/ga_keyword2.js" type="text/javascript"></script>. Be sure to update this line so that it actually points to the script. And, of course, be sure to update the UA-XXXXXX-1 number with your own Google Analytics profile number.

Still Using urchin.js?

If you haven't updated to the new version of the Google Analytics JavaScript, fear not. We're still working on ways to improve our script for urchin.js. So, since we've made a few improvements to the script, you'll probably want to update yours with the most recent version.

You can get the latest ga_keyword.js file from our server and upload it to yours. Make a note of where you put it.

Then update your Google Analytics Tracking Code:



Again, the only addition is the line: <script src="/path/to/ga_keyword.js" type="text/javascript"></script>. Be sure to update it so that it points to the script. Also, update the UA-XXXXXX-1 number with your own Google Analytics profile number.

Please bear in mind that this script is presented as-is. We've tested it extensively with our own Google Analytics accounts, but your mileage may vary. If you have any major problems, let me know in the comments. We're always working to improve the script, so keep posted on the blog for updates. You can sign up for our email newsletter, or keep track via RSS.

As a quick aside, I knew there was demand for this tool when I developed it, but I'm still amazed at its popularity. Internally, it is one of the most widely requested features from our pay-per-click teams, and I love that they're using it to really help our clients maximize their ad spend. There's a rumor going around that they're planning on unveiling some of the cool ways that they use exact keyword data right here on the blog, so... all the more reason to add the RSS feed to your reader of choice so you don't miss it.

How about you? How are you using our script to better your paid search campaigns? Any suggestions or requests?

Find The Secret To Solid, Sustainable Improvements To Your Website
Learn the insider secrets to making more money from your website than ever before – Guaranteed! Get started right away with the Google Analytics Training Course..
Posted by Michael Harrison at 1:48 PM









Filed under: ,
Technorati Tags:

TrackBack

TrackBack URL for this entry:
/mt/mt-tb.cgi/281.

Comments

This stuff is great! Keep up the good work team, I really appreciate you sharing this with the community. You are an excellent resource for us PPC guys out there looking to maximize our spend.
My clients will thank you!

Posted by: PPC Whiz at February 14, 2008 3:25 PM

@PPC Whiz: Glad we could help out! Definitely keep posted here on any additions or updates, and like I said in my post, our own team will be posting some of their tips and tricks in the coming weeks.

Posted by: Michael Harrison, Google Analytics Support Tech Author Profile Page at February 14, 2008 4:22 PM

Hey Michael,

Thanks for the update, have been on the lookout for it! I've tried another method from another blog but that doesn't seem to work, at least for me, so now I've updated to the new code I'm going to test this out.

Thanks again!

Posted by: Jesse DaCosta at February 14, 2008 4:37 PM

@Jesse: Great! Let me know how it works for you. We're always trying to improve it.

Posted by: Michael Harrison, Google Analytics Support Tech Author Profile Page at February 14, 2008 5:54 PM

Thanks for updating the ga.js script with this! I only saw the original change for the old urchin code yesterday after your webinar. I've already changed the GA code on both our site and looking forward to seeing the results in the coming days.

I do have a question... In the Traffic Sources::Keywords section, their are toggles for Show: total | paid | non-paid and then the Segment listbox.

On first glance, it would seem GA is providing everything without the script. Am I being simplistic in my cursory look?

Thanks again!

Posted by: Christian Martin at February 14, 2008 7:06 PM

@Christian: Unfortunately, the Keywords report will only show you the bid terms for your paid search. Basically, it will show you the keyword phrase that you bid upon, but not the one that visitors actually typed into the search engine. Hope that makes sense.

Posted by: Michael Harrison, Google Analytics Support Tech Author Profile Page at February 15, 2008 9:32 AM

Thanks for updating this script and sharing it with the community.

I'm curious - why the "UA-1" in this line of the script:
_gat._getTracker("UA-1");

Posted by: Dave Cardwell at February 15, 2008 11:51 AM

@Dave: It's just a precaution, due to the way that setVar operates, and we've found that it leads to more accurate usage stats.

Posted by: Michael Harrison, Google Analytics Support Tech Author Profile Page at February 15, 2008 1:57 PM

Doesn't it seem strange that Google wouldn't make this a feature in G Analytics early on? It's clear any smart marketer's gonna want to know which queries within phrase or broad matched keywords are working and not working.

Google gets 70% of its revenue from phrase and broad match.

Posted by: Searchquant at February 15, 2008 4:53 PM

Hi,

This quiet cool. I already saw that the previous script wasn't working anymore. Going to try this one now!

Posted by: Sonja Bakker at February 18, 2008 11:27 AM

Hi Michael,

thanks a lot for this new version of the script, I was using the old filter hacks but it doesn't work anymore...

One question: the script as it is now doesn't seem to work if I manually tag my link (I almost always tag my links instead of using the auto-tagging to gain more control over the utm_campaign variable...) so I was wondering if there were a quick fix fo manual link tagger like myself?

Thanks again,
Julien

Posted by: Julien Raby at February 19, 2008 6:54 PM

@Julien: While we definitely don't recommend that you manually tag AdWords ads (it causes problems when Analytics links up the data between your two accounts), this method should work for manually tagged links, so long as those links are tagged with utm_medium=cpc and the visits are coming from a search engine with a plainly visible search query in the URL (e.g., q=search+query, p=search+query, query=search+query).

Posted by: Michael Harrison, Google Analytics Support Tech Author Profile Page at February 22, 2008 3:28 PM

Thanks for this, I just tried the other method last week and didn't get it to work so this comes at a great time for me but I do have one question..

Should I upload the script to my root directory?

Posted by: Chris Bradley at February 24, 2008 2:41 PM

@Chris:

You can upload the file wherever you like. Most websites have a specific place where scripts are stored, but it's different for everybody. The important thing is to make sure the call to the .js script is pointing to the right place.

Posted by: Shawn Purtell, Google Analytics Support Tech Author Profile Page at February 25, 2008 9:29 AM

The actual ga_keyword2.js script contains the following lines


var pageTracker = _gat._getTracker("UA-XXXXXX-X");

The page says not to edit the script, but should I be changing the [yoursitehere] and UA-XXXX lines so that they correspond to our tracking codes?

Posted by: Charles Meaden at March 17, 2008 10:40 AM

@Charles: Those lines are just a re-iteration of the installation instructions as given in the article. They are just comments, so you don't need to change it.

Posted by: Jeremy Aube, Google Analytics Support Tech Author Profile Page at March 18, 2008 10:48 AM

Jeremy,

Thank you. Two more questions if I may.

1. Does it make any difference if I have amended the code to use our details
2. Can I use remove the commented section from the ga_keyword2.js file then

Posted by: Charles Meaden at March 19, 2008 6:55 AM

@Charles: You really shouldn't be making any changes to the javascript file. If you're just making changes to or removing the comment section, that won't affect the functionality of the script, but it would be best to leave it as is. Then anyone who looks at the script will have the version number, author, general instructions (rather than specific to a single site's setup), and when it was last modified. Any changes to the script itself could negatively affect its functionality. Michael has written this script very precisely so that it needs no modification to work with your site.

Posted by: Jeremy Aube, Google Analytics Support Tech Author Profile Page at March 19, 2008 9:52 AM

ok, I really want to get this data from my analytics and I have upgraded to ga and installed the tracking code...but I can't for the life of me understand where I find the detailed keyword search data in my analytics account. Can someone point me in the right direction?

Posted by: Ron at April 2, 2008 4:21 PM

@Ron: The Exact Keyword Data for the site will be in the User Defined Report. You can also segment various reports by the User Defined Variable to see this information for specific visitor traffic segments. See Michael's previous post for more information.

Posted by: Jeremy Aube, Google Analytics Support Tech Author Profile Page at April 2, 2008 4:39 PM

So if I look in the tab "Visitor/UserDefined" and all I see under the user defined values is "not set" then it's safe to assume I screwed up in inserting the tracking code?

Posted by: Ron at April 2, 2008 5:35 PM

@Ron: Well, it either means that you screwed up, or that you don't have any paid search traffic coming into your site. The traffic has to be auto-tagged AdWords clicks or manually tagged clicks with utm_medium=cpc.

Good luck!

Posted by: Michael Harrison, Google Analytics Support Tech Author Profile Page at April 3, 2008 10:59 AM

Post Your Comments

Post a comment




Tell a Friend

Email this entry to:

Your email address:

Message (optional):

Contacting ROI Revolution

Telephone Number:
(919) 832.3233
ask for Meredith Smith

Office Fax:
(919) 828.3282

Address:
400 Oberlin Road
Suite 200
Raleigh, NC 27605


Authorized Google Analytics Consultant

Google Analytics Certified Service and Support Consultant


Free Webinar!

Join a Live FREE Google Analytics Training Webinar
Register now to learn how to
turn Google Analytics into
pure profit! You'll learn how to use many of the key reports, a ten-step system for properly configuring Google Analytics on your website, and how to apply what you learn to the attainment of your online goals. Register for our free Google Analytics training webinar today.


Subscribe to the
ROI Revolution Google
Analytics Newsletter today

Free monthly email publication that contains valuable, practical tips, secrets, and much more! Subscribe to our free Google Analytics newsletter today.


Looking to Purchase
Urchin 5 Software or Fee
Based Support?

We are a Urchin software certified service and support partner! Buy Urchin 5 software, profile packs, load balancing modules, campaign tracking, or fee-based support today.