How To Set Up and Track Keyword Origination from Multiple Sources in Salesforce

The holy grail for most marketers I talk to is being able to track a lead – or even a sale – all the way back to the original source keyword. If the marketer knew that, he or she could easily begin to understand what to focus on in terms of keyword targets for organic or paid search.

Are you running a bloated PPC campaign with dozens of ad groups, and hundreds or even thousands of keywords, not knowing which keyword drove the conversion, lead, or months later, the sale?

Are you using and paying for Salesforce, but have not taken the time to properly pipe in your AdWords or Google Analytics data?

Sounds like a no-brainer, but trust me – there are lots of companies out there with revenues in the tens of millions, or hundreds of millions, who are not doing this right.

Their PPC budgets are way into the six figures per month, and the license fees for Salesforce could probably pay for two or three employees in my company.

However, the issue is not piping in AdWords or Analytics – there are tools in the App Exchange which will do this for you – it’s the other sources that are very difficult, such as live chat, external landing pages, or phone calls. What keywords drove those actions?

Sure, the Salesforce web-to-lead forms help make the job easier, but for some websites, chat and phone make up a considerable amount of leads.

Are you relying on your sales team to manually enter the data?

They may know the lead came from “Google” or a “search engine”, but rarely will they know what specific keyword the user typed in, or how to make strategic decisions based on only a generalization of where the lead originated.

Such issues were quite prevalent at Vancouver, B.C.-based PEER 1 Hosting, one of the top 5 managed hosting and colocation companies in the world with revenues upwards of $100MM per year.

One of the feedback loops we wanted as part of the SEO campaign strategy was to understand which searches drove traffic, then leads, then sales. If we could understand the keyword which drove real customers, then we would take those keywords and SEO the hell out of them. Who cares about the rest – they don’t drive sales anyway. Of course, this is much easier said than done.

So the guys at PEER 1 Hosting figured out how to pipe the tracking data into Salesforce to not only track the keyword, but the original source, as well as other information too.

In this post, you’ll learn how to set everything up and track SEO, PPC, live chat and phone calls.

Step 1: Set up your Salesforce lead form fields

All your necessary contact information fields should already be in place, but add a dropdown field for the type of source (Web, Phone, Chat). To help organize information captured from the visitor’s session, create a section for the marketing metrics that will need to be captured. Typical fields for this would be keyword, landing page, referrer URL, SEO or PPC, campaign, ad group, and match type.

Step 2: Determine the URL parameter strings to use for each campaign

In the case of PPC campaigns, most systems allow for a custom URL structure, and this can be tailored to suit your data capture system as well as maintain compatibility with Google Analytics.

In the case of this PPC string, the parameter names are compatible with Google Analytics and PPC ad campaign information is also captured in Google Analytics without any additional effort when it reaches your site. &utm_campaign=July2011promo&source=Google

Step 3: Create a mechanism to capture incoming URL or referrer information and store it so that it stays with the visitor

This can be done with a session or with cookies. Cookies were chosen as the preferred method because the information can be stored with the visitor for a pre-determined length of time, and are still available on subsequent visits.

Store each captured field in a unique cookie variable, and assign the length of time for which it should be remembered. In the case of capturing organic search information, parse the external referrer URL so that it extracts the domain name and typical search parameters, (‘q’ for Google, ‘query’ for AOL, ‘p’ for Yahoo, etc) into cookie variables.

This capture code resides at the top of all site pages globally and is also included on stand-alone landing pages.

Step 4: Submitting information to Salesforce via web form

The web contact form is the simplest of the three capturing mechanisms for gathering user information and submitting to Salesforce since all the interaction between their browser, your website and Salesforce is done by the visitor’s action. Salesforce has two methods available for data transmission, ‘web-to-lead’ for simple form posts and an API for more complex and secure transmission.

On form submission, retrieve the information that has been stored in the cookies in step 3 and send that to Salesforce with the form post, as hidden fields using web-to-lead, or as part of the lead object using the API method, mapped to the Salesforce fields that were created in Step 1.

A visitor searching for “peer 1 hosting” in Google and clicking on a paid link, results in something similar to the following in Salesforce.

Step 5: Add an online chat system to the mix

PEER 1 Hosting uses LivePerson as its live chat platform. This not only allows visitors to ask questions about products and services in real-time, but also serves as a channel for capturing sales leads. In the past, visitor information had to be entered manually into Salesforce if the chat representative wanted to create a lead record.

A LivePerson / Salesforce Integration package exists in the AppExchange, but it didn’t go the full distance in terms of capturing custom metrics from visitors which become new leads. Using LivePerson’s monitor tag, data from the visitor’s cookie is each published as a custom variable and is picked up by LivePerson when a chat session is started.

In this example, LivePerson now has access to search engine, keyword, incoming referrer and landing page for the length of time that you specified in the visitor’s cookie.

lpMTagConfig.sessionVar[lpMTagConfig.sessionVar.length] = '';
lpMTagConfig.sessionVar[lpMTagConfig.sessionVar.length] = 'p1_fc_sekw=peer 1';
lpMTagConfig.sessionVar[lpMTagConfig.sessionVar.length] = 'p1_fc_serefurl=';
lpMTagConfig.sessionVar[lpMTagConfig.sessionVar.length] = '';

Several other visitor variables can be captured using this method.

Step 6: How do you get this chat information into Salesforce?

In LivePerson, an operator alert was created and is triggered every time an active chat is initiated. This alert opens up a LivePerson console window with a link to a web form on’s servers. Since the captured information in the previous step is now available to the LivePerson application, it is sent via this link’s URL string with all the necessary custom variables plus some of LivePerson’s built-in variables back to so that it can be processed via the web form API method.

The advantage here is that the chat operator now simply fills in the lead’s basic contact information and the rest of the captured data is transmitted along with it to Salesforce. This visitor’s information is therefore captured without them needing to fill in a form and allows for the capture of all, and more of, the information that would have been available if they submitted a lead form themselves.

Step 7: What happens if a visitor phones us?

The biggest challenge was to discover a way to track phone leads back to a source without asking each visitor. In the past, a lead would be entered directly into Salesforce by the phone representative, and the lead record flagged as a ‘phone lead’. This was the only additional information captured.

Mongoose Metrics provided a solution that helped add call tracking to our system. By setting up a Mongoose campaign and adding a small piece of JavaScript to our pages, the phone number on our website can be made to change on-the-fly and present a unique phone number to each visitor that has keyword or specific campaign information attached to their visit. This number is reserved temporarily for this user and Mongoose Metrics’ system stores analytics information that pertains specifically to this phone number.

Now, when the visitor calls this unique number and the phone representative enters the visitor’s incoming caller ID into the Salesforce lead form, the Mongoose Metrics / Salesforce integration updates the lead record with several additional fields including keyword, campaign, call duration, and URL information.

Put all these pieces together and the main methods of visitor contact is trackable back to originating source and keyword through web form, chat and phone call. No system is perfect and there are several reasons why data would perhaps not be captured, but if information is available it should not be discarded.

Step 8: Additional considerations

PEER 1 Hosting was comfortable enough with the data transmission process to further identify when a visitor arrived through any combination of PPC and organic sources on subsequent visits and to then determine if first-click or last-click took precedent in the case of multiple entries. In the case of both PPC and organic information being available, both are captured. To do this, set multiple cookies to store first-click and last-click information, and create fields in Salesforce identifying PPC and organic sources.

Since PEER 1 Hosting uses more than one PPC vendor across multiple sites, an additional vendor identifier ‘v=vendor’ was added to PPC URLs, and PEER 1 Hosting added themselves as a unique vendor to their own campaigns, whether it be website, newsletter, or social media efforts.


PEER 1 Hosting is now able to look at several combinations of reports, such as:

  • Which keywords drove the most chat leads
  • Which marketing campaign was most successful for all sources of contact
  • Which PPC vendors drove the most sale value
  • How many Twitter campaigns generated leads last month
  • And much more…

— Ryan Kelly

About Ryan Kelly
Ryan Kelly is founder and CEO of Pear Analytics, and Internet marketing software and services company based in San Antonio, Texas. A mechanical engineer, Ryan has extensive experience in web analytics and search engine optimization. Pear's free website analyzer software has run nearly 1 million websites since it's launch in 2009, and continues to run at nearly one report per minute.
» More blog posts by Ryan Kelly


  1. Mobile Coupons

    Isn’t it amazing how so many don’t track every aspect of the traffic? I too am amazed. With the help of this writing though, many can see not only the value in tracking, but how to do it better.

    I like your notion of adding a chat feature to the page. This is a great thing to do. I’d like to add that it can really help with customer confidence too. I feel that you can’t do too much to make a customer feel comfortable with your website and making a purchase.

  2. Ryan Kelly

    Chat has been an integral part of the lead process for PEER 1 Hosting, and I’m sure for many others. Even purchasing a server or other hosting services, even though it is very commoditized, it’s not a frictionless transaction. Chat is instrumental in getting questions answered, and turning leads into opportunities. Now, with this integration, there is no “guessing” as to where the chat leads came from :)

  3. Sameer

    Interestingly we have been using the web form to salesforce integration for last 5 years at Rackspace and it works perfectly.

    The chat to Salesforce lead integration was done last year as well.

    The biggest challenge with the chat to salesforce is the chat console lead submission form is so small that is rarely used by reps who get multiple chats at one time. It works but is highly unusable.

    • Ryan Kelly

      PEER 1 customized it into the LivePerson interface and pre-populate as much of the form as possible. Seems to work great, and the sales guys aren’t complaining about it!

  4. Pam Achladis

    Ryan, great post and thanks for mentioning Mongoose Metrics. Integrating technologies to accurately track all forms of keyword-search conversions through to sales is the only way to effectively analyze and evolve SEO and PPC campaigns to maximize ROI. In addition, the keyword data you collect can help your marketing campaigns in other ways. For example, if you’re doing any content marketing, you can focus on keyword topics that you know drive visitors that convert into sales. Thanks again for the mention.

  5. How to: Track keywords from mixed sources in Salesforce | Avoid tags that will drag down your site

    […] AdWords or Analytics with, though that is not a biggest emanate for firms, writes Ryan Kelly during a Unbounce Blog. “There are collection in a App Exchange that will do this […]

  6. Yomar Lopez

    I’ve worked with various CRM and SFA platforms and Salesforce seems to be one of the big ones out there, with good reason. For me, it’s something that will have more value when I expand my business ventures and have the volume to justify the investment. That said, this here will be a great resource to keep as a handy-dandy field manual.

    As someone that focuses primarily on online business and projects, I know it’s easy to sometimes overlook things like phone calls and face-to-face meetings. I try to at least take paper notes in all these things to see how things correlate. If you can pipe that data into a software platform like Google Correlate or Salesforce, the job becomes easier.

    You’ve given me much to consider here, Ryan. I love using analytics and such to achieve consistent results.. but it seems Salesforce can be a GREAT asset in the near future for catching those elusive missed opportunities. 8)

  7. Kristi Hines

    Great tips! I’m just barely cracking the surface of Salesforce, but just with the little I’ve seen, it definitely needs a better way to track interactions by keyword.

  8. Conversion Fest Continues @ Unbounce | Atlanta Georgia Marketing

    […] guest post, How To Set Up And Track Keyword Origination From Multiple Sources In SalesForce, is one of those nuts and bolts type of posts that you cannot help but love.  It is rich in the […]

  9. Samir

    Where do you see platforms like Loopfuse, Marketo, and Eloqua fit with all of this? Are you proposing we cut them out since you’re funneling leads directly into The Force, or do you see marketing value within them as well?

  10. Ryan Kelly

    Hi Samir,

    No, I’m not saying to not use Eloqua or Marketo. Each of those have specific marketing automation functions that large organizations need for email/drip campaigns, etc. I am not aware of either of those tools solving the keyword origination problem to figure out which search terms are actually driving sales. Maybe someone from Eloqua or Marketo can comment here.

  11. Deb

    We are experiencing a serious problem right now with an Ad Words/ integration — Ad Words is NOT tracking clicks it is maddening! Your proposal not only would fix that but give us more.
    a. has anyone else had difficulties with Adwords not tracking Salesforce conversions
    b. my concern with this fix is that it would cause conflicts so that nothing would be tracked in Saleforce or Ad Words (because we have seen that too) Very concerned about wigging out two very wiggy services

  12. Conversion-Fest Winners – and the Secret Sauce Behind Blog Post Promotion | Unbounce

    […] Ryan Kelly@pearanalyticsHow To Set Up and Track Keyword Origination from Multiple Sources in Salesforce […]

  13. Lucas

    I am right in the middle of setting up a new launch to track leads by traffic source and it’s doing my head in!! Do I just need to store the source/medium/keyword data in the cookie and then extract it at the point of form submission?

  14. Conversion-Fest Winners – and the Secret Sauce Behind Blog Post Promotion | Vevosi Marketing Blog

    […] Ryan Kelly@pearanalyticsHow To Set Up and Track Keyword Origination from Multiple Sources in Salesforce […]

  15. dx format

    Hello my family member! I want to say that this article is awesome, great written and come with almost all significant infos. I?d like to peer more posts like this .

  16. Dave

    So when building URLs in adwords do we need to switch off the automatic tagging and build out unique urls for each ad with all the different variables? It seems the auto tag just puts a glid variable.

  17. Usman

    My company has just started using Salesforce and I’m finding it difficult to cope with the software. I’ve starred this tutorial for future references. Thanks.

  18. David Madden

    In Step 2 – Do we need to create a custom tagged URL for every Ad and every Ad Group? It seems like we should be able to capture variables from Google’s Auto-tagging feature in Adwords.

    Also – for organic traffic – what are the URL variables that can be captured for Yahoo, Google, and MSN?

    I think we understand how to grab the variables out of the URL parameters, but what are the variable names (i’ve heard “q” is the variable for the search term on google, but what about from Adwords or Yahoo, do we have to make cookies to capture them from multiple search engines)?

  19. pot facts

    This design is steller! You obviously know
    how to keep a reader entertained. Between your wit and your videos, I was
    almost moved to start my own blog (well, almost…HaHa!
    ) Great job. I really loved what you had to say, and more than that, how you presented it.

    Too cool!

  20. czerwona herbata

    I’d should test with you here. Which isn’t one thing

  21. cheongsam

    Hi, its good article regarding media print, we all be aware of media is
    a fantastic source of information.

  22. Al Spaulding

    As well as they may well end up being needed for you to
    show his truly worth definitely not merely via his
    musical prowess however additionally by schooling.

  23. Oma

    Attractive component to content. I simply stumbled upon your site and in accession capital to assert that I acquire actually
    loved account your weblog posts. Any way I will be subscribing for your augment and
    even I fulfillment you get admission to persistently fast.

  24. Eusebia

    Testing the waters with an overeager land developer, a much younger second wife who might face an unexplained pregnancy,
    a father in the clutches of a gambling addiction, and a money making scheme unearthed that would have profited her uncle but took advantage of countless horse
    aficionados, there suddenly is no shortage of suspects. You are doing lots of the ‘right’ things
    to achieve those big goals of yours. For that reason, We advocate
    you select among the scaled-down fireplace pickup bed furniture,
    in particular one which uses a new baby’s crib mattress model.

  25. abc

    Hello my loved one! I wish to say that this post is awesome, great written and come with
    approximately all vital infos. I would like to see more posts like
    this .


    Exactly how much time did it take u to post “How To Set Up and Track Keyword Origination from Multiple Sources in Salesforce |
    Unbounce”? It possesses a great deal of good information.
    Thanks -Stephania

  27. caribbean distributors,caribbean cosmetics,caribbean beauty,caribbean distributors,caribbean product distributor,product distributors in the caribbean,cosmetics distributors in the caribbean,distributors in jamaica,distributors in barbaods,distributors in

    Success Beauty Distributors in the Caribbean supplies the region with only the highest quality,
    Beauty products from the best brands. We currently distribute the new Defabulous lines and more recently
    Mizani products. We’re a long established partner with Paul Mitchell professional haircare products, the
    leader in luxury haircare. Thank you for allowing us to post – if you or someone you know is insterested in
    forming new distribution opportunities in the Caribbean please let us know.

  28. Biała Herbata

    Lorenz Books. Green or Oolong tea are perfect with meals because they help digestion, and the subtle flavor of White teas in the evening
    help to calm and unwind my mind after a long day. It costs about $25.
    Biała Herbata

  29. VDS hosting

    I know this if off topic but I’m looking into starting my own blog and was wondering what all is required to get setup? I’m assuming having a
    blog like yours would cost a pretty penny? I’m not very web smart so I’m not 100% positive.
    Any suggestions or advice would be greatly appreciated. Many thanks

  30. How To Figure Out Which Lead Was Generated By Which Conversion

    […] the opening line to a blog post on says it best – “The holy grail for most marketers I talk to is being able to track a lead – or even a sale – all…” Well, you’re in luck because we created Convertable to easily bridge this gap between […]

  31. Charles Bosse

    Great blog! Salesforce CRM system is new to me but it can serve as a vital nerve center to manage the many connections that happen in a growing business. For small businesses, a CRM system may simply help you put your data in the cloud, making it accessible in real time, across any device. I recently had some problems with it and ended up getting some help with this matter from