UPDATE: We have posted a new version of the script mentioned in this article at Exact Keyword Tracking for ga.js.

Last November, Jim Newsome of Omega Digital Media and the GA Experts blog, posted a really clever trick on how to view detailed keyword information within Google Analytics. If you’ve ever searched through your AdWords Bid Terms and wondered what the actual Search Terms were, then you know why such a filter was in great demand. For PPC marketers, it’s a great opportunity to weed out ineffectual broad match keyword phrases, and hone in on the most popular user search queries.

Here’s an example: you’ve got a shoe store and you’re running Broad Match AdWords ads for “shoes”. When a visitor searches Google for “blue suede shoes”, your ad shows up. This is all well and good, but what if you don’t sell blue suede shoes?

Read on to find out how to track exactly what your visitors are searching for before they see your PPC ad and click on over to your site…

So, checking your AdWords Analysis report in Google Analytics shows you a hundred visits for the keyword “shoes”. You may wonder why the hell you’re getting such a terrible conversion rate on that particular campaign (and you might want to call a meeting with your PPC manager for targeting a keyword as broad as “shoes,” but that’s beside the point), but you can’t see that the reason you’re doing so poorly with AdWords is because your ads are matching for Search Terms that have absolutely nothing to do with your product. Why? Because, by default, Google Analytics doesn’t give you any information on the actual Search Terms that visitors use when clicking in from PPC ads.

Jim and Omega set up a couple of filters that take the search query from the PPC referrer (Google, Yahoo!, whatever) and plug it in next to the keyword that Google Analytics picks up (usually from a manually tagged ad, or imported directly from AdWords). It’s a great little hack, but we’ve noticed a few shortcomings, so I figured that a slightly different approach might solve some of the problems inherent in the filter method.

My method involves using a script instead of filters. Jim’s method took the existing Google Analytics Campaign Term field, where keyword data is stored, and replaced it with “Bid Term (Search+Term)”. I decided to leave the Campaign Term field alone, and just stored our Search Term in the User
Defined field. So, if you’ve got a site that’s already using __utmSetVar, my apologies. There are lots of great applications for the User Defined variable. This is one of the main reasons that Shawn Purtell chose not to use it with his kick-ass Google Analytics/Google Website Optimizer integration. If you can get by without using it, you can then save the User Defined field for something else that might prove more powerful. Like tracking search terms. 🙂

You can find the script here.

Just replace your existing Google Analytics script with the following:

<script src=”ga_keyword.js” type=”text/javascript”></script>
<script src=”http://www.google-analytics.com/urchin.js” type=”text/javascript”>
</script>
<script type=”text/javascript”>
_uacct = “UA-XXXXX-X”;
urchinTracker();
sleuth();
</script>

The sleuth() function parses through the page’s referrer. If that referrer’s link has been tagged as cpc or ppc, it finds the search query and runs __utmSetVar with that keyword.

What does this mean? Well, you can now cross-segment within Google Analytics’ reports to locate and correlate your visitors’ search terms. One effective way of doing this is via the CPC Vs. Organic Conversion report, found in Marketing Optimization / Search Engine Marketing. You can drill down into any CPC source to view a list of keywords. These are the bid terms.

Now, to see the actual search terms these visitors came to your site on, cross segment a specific bid term by User Defined.

This is especially cool for pinpointing search terms that are in no way related to the bid term. These are completely unqualified visits to your site, where a visitor is searching for something that has nothing to do with your bid term.

Use this information to create effective negative matching keywords and continue to narrow down your matching. Take another look at the cross segment report. I’ve highlighted search terms matching for “shoes” that are clearly inefficient and need to be culled:

I hope this is helpful. If you’ve got questions about the script, please let me know. I’m excited to hear about how people use this information to better their pay-per-click marketing.

Edit: Props to Dr. Brian Clifton, head of the EMEA Web Analytics Team for Google and friend to booth babes everywhere, who, as Jim Newsome points out in our comments, was the primary developer of Omega’s nifty little filter trick.

UPDATE: We have posted a new version of the script mentioned in this article at Exact Keyword Tracking for ga.js.