A Quick SEO Tool to Fill in "(Not Provided)" Results in Google Analytics

As a business owner I occasionally wonder if Google is a valued partner or a hated foe. More and more it seems to be leaning toward the latter.

For example, half of my time spent marketing recently has been trying to appease the “Google Beast” (that’s my nick name for Google), rather than writing great content or optimizing our visitor’s user experience.

Google says it would prefer I spend my time writing and optimizing experiences, but I don’t think they really mean that.

If they did, they wouldn’t have taken away valuable information I need to make content choices for my website – the keywords our visitors use to find our website!

Instead, all we get is “(Not Provided)” for over 60% of our search terms! (It’s not this bad for everyone).

A Solution to the Problem!

It occurred to me last week, that if Google won’t give me the keywords why don’t I just ask for them instead!

So I wrote a nifty little script that can be used on any website to re-capture missing keywords from Google and toss them back into Google Analytics.

Survey to collect keywords that would otherwise come into Google Analytics as "Not Provided"

Adding the code snippet below to bottom of your site’s HTML will popup a small “survey” in the corner of your visitor’s screen if they come from a Google Search and are lacking keyword data.

If they complete the survey, the script sends the keywords back to Google Analytics as part of a custom event, there by adding them to the organic keywords that it already collects!

Example Keyword Data from Google Analytics (Not Provided)

The nice thing about this solution is it’s free, easy and doesn’t require an account with SurveyGizmo (although you can still signup if you’d like). ;)

Here’s the Code

Instructions: Place this code (everything between the script tags — including them) in the footer of your website (after all other content). The survey will begin immediately for new visitors to your site from Google.

<script type="text/javascript">
var __sg_np_tool_percentage_np_visitors = 100; //ask 100% of visitors that lack Google keywords
(function() {
var ganp = document.createElement('script');
ganp.type = 'text/javascript'; ganp.async = true;
ganp.src = '//d34wpjv4rf3nwa.cloudfront.net/www1/ganp.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ganp, s);

The “Features”:

  • The survey only appears if the visitor is from Google and has no search keywords.
  • The script posts an event if they complete called “NotProvided Survey”.
  • A visitor will be cookied when the form closes, so they’ll never be asked again.

Note: The script doesn’t send the data to a third party, it’s free and it only requires that you use Google Analytics.

The tool does include a link to this article (it’s a nofollow link) — but if you’d like to hide it you can use CSS to do so in your style sheet!

Here’s the CSS to hide it:

.sg_np_infolink { display: none; }

Of course I hope you’ll find this tool useful and spread the use of this tool by leaving the link in — but it’s totally up to you.

Comments, Suggestions, Requests?

If you’d like me to make changes to the script, just let me know. That’s the benefit of hosting the script on the cloud (the code above just loads it)…

If we fix something or tweak it, everyone get’s the benefit!


Join the Conversation
  • http://www.twitter.com/ebellity Emmanuel Bellity

    Awesome … I definitely have the same problem but use another tool than GA for analytics. I guess the important question is what % of visitors do answer the survey ?

    Small secret : we did the same on our iOS app to improve app store optimization !

    • Christian Vanek

      Oh! Great idea. Do you ask the end use what they searched the store for?

      The only other tool I know well is Omniture. It would be pretty simple to provide an alternate snippet for that tool if you use it instead. :)

      • http://www.twitter.com/ebellity Emmanuel Bellity

        We ask them an open ended question on how they discovered the app – generally when it’s through the app store they say which keywords they used. But we’re a social polling app, so it’s easy to ask these kind of questions without it being weird for the end user or changing our code.

        As for web analytics we use Clicky, but they do have a good API so maybe I could write a similar snippet !

        • Christian Vanek

          Cool! If you do, let me know. I’m happy to host it and add it to the article (with full credit naturally). I didn’t minify the code so people could see what was going on. The only part that relies on GA is the event handler for the submit button. This part:

          _gaq.push(["_setReferrerOverride",startURL + elm.value]);
          _gaq.push(["_trackEvent", "NotProvided", 'Survey', elm.value]); _gaq.push(['_trackPageview', document.location.pathname]);

          For any non-techie marketers reading this — don’t worry, you don’t need to know what this means. I’m just geeking out. :)

        • aspiandore

          Was written by someone this version of the plugin that uses the brilliant idea described above?

    • Christian Vanek

      Oh, in regards to your first question: I don’t have enough data to predict that. The responses started coming in almost immediately (I watched using the RealTime tool).

      I’ll update the post with more information as we gain more information.

  • Michael Green

    Great idea! How do you think this would affect your bounce rate for non-branded visitors?

    • Christian Vanek

      Michael, great question. Looking at the calls I used, if they complete the survey it will effect bounce metrics. It will be seen as another interaction.

      On the bright side, if that’s not desirable I can add a setting to both calls that should keep your bounce metrics pure. I’ll test it out on our site tomorrow if you’re interested.


      • Michael Green

        Hey Christian,

        Thanks for the quick response. I guess I was thinking more along the lines of — will the popup form increase the bounce rate, because people tend to flee when seeing popups on a website?

        • Christian Vanek

          Michael, I haven’t see any change yet — but I’ll keep an eye out for it. I tried to keep the popup out of the way of main content and scrolling to reduce that possibility as much as possible.

          • Michael Green

            That’s great. I’m interested to see if you start to see an increased bounce rate in non-branded organic traffic. Please keep me up to date — I’m really interested in employing your great script!


          • Christian Vanek


            We’ve only been using this for a week. However comparing it to last week I don’t see any meaningful change in bounce rate.

            The percentage of folks filling out the survey is pretty low (~5-10% per day) but the data we’ve gotten back so far has been very useful… and not what we expected. We expected that our name would still be a top search term… but all of the keywords are actually content related.

            That’s why Google hiding these keywords can be so damaging. For a year we’ve been basing content marketing decisions off incomplete and inaccurate data!

  • Mary Butlin

    Brilliant idea! Thanks for sharing this – it’s hard to bring insight from various data sources together but this is a great example of overcoming a gap in one system with survey data.

    • Christian Vanek

      You’re welcome! I hope it’s useful to you! If you have any suggestions feel free. I’m happy to upgrade it. We’ve found the data to be very actionable already.


    como alguém acha que é uma brilhante ideia alguém tirar aquilo que não é seu,eu parabenizo alguém quando é para criar algo que vai ajudar, e não prejudicar, isso parte de mentes vazias, de pessoas sem senso de responsabilidade, sem caráter sem amor ao próximo, eu sou pobre mais jamais serei rica ou elogiarem alguém que o único intuito é prejudicar a vida das pessoas, que mentes pequenas, se quer aparecer apareça fazendo o bem e não praticando o mal

  • Josh Hamit

    Great idea, didn’t expect to see it here!

  • Spook SEO

    Indeed this is Good idea. Thank you Christian Vanek you share your knowledge and very useful information. This increases my knowledge. Thank for sharing.

    • sgizmo

      We are glad you found this useful!