AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

3.9K members online now
3.9K members online now
Welcome to the Official Google Ads Community
Find optimization tips and how-to guides and videos by the Google team, Google Ads Experts and other industry experts
Collaborator ✭ ☆ ☆

Adwords Integration with Lead Management Systems (LMS) & CRM (Customer Relationship Management)

Using Adwords ValueTrack data in 3rd party systems like CRM (Customer relationship management) & LMS (Lead Management Systems)

Let’s take an example of a lead generation campaign where my friend Jim’s objectives are 

  1. Generate leads for product which is sold offline
  2. Generate quality leads which will have high conversion rate for sales
  3. Let’s make Jim’s life more difficult by telling him that same lead generation page will also be used for other sources (direct, affiliates, etc.)


Now here are some challenges you will face with this sort of campaign

  1. All the leads are captured in an Lead Management System so Jim has no way of knowing which leads are generated by Adwords, He will know how many from Adwords conversion but not which ones.
  2. This means Jim has no way of knowing if he is generating quality leads or junk leads
  3. This also means Jim knows which keywords are giving him conversions in terms of leads but he doesn’t know which keywords are giving him final sales conversions
  4. So “keyword a” gives Jim 100 conversions at very low cost per lead and “keyword b” gives him only 10 conversions at higher cost per lead, Jim might end up pausing “keyword b” even if “Keyword a” has given him only 1 final sales and “Keyword b” has given 5 final sales
  5. Jim will need conversion data for the final conversions as per keywords as well J this is where ValueTrack comes in

Jim’s best friend Nik gives him this link to look at

And Jim gets Idea that he can pass on info like

Keyword, Matchtype, Position and many more parameters in the destination URL

But now Jim is stuck again how he can get this info in the LMS which is being used to track leads, so he calls up his buddy Nik again and Nik provides him with JavaSctipt Code which will facilitate this.


var first = getUrlVars()["keyword"];

var second = getUrlVars()["matchtype"];






function getUrlVars() {

    var vars = {};

    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {

        vars[key] = value;


    return vars;


Nik tells him this code will catch parameters like Keyword, Matchtype, etc. from the URL and then coders can pass this information from landing page to the LMS where Jim can track final sales tagged to Keywords, Matchtypes, AdPosition and many more parameters

Here are some of the parameters you can track for normal campaigns via ValueTrack

  • Matchtype
  • Network
  • Ifmobile : if visit is from mobile device
  • Ifsearch: If visit is from search
  • Ifcontent: If visit is from content network
  • Creative: Which adcopy triggered this visit
  • Keyword: Which keyword triggered this visit
  • Placement: Which domain triggered this visit
  • Target: Which placement category triggered this visit
  • Adposition: Position on the page for the ad from where this visit is triggered

There are some other advanced parameters which Nik has promised to Jim he will write later J

Words of caution:

  • This will require help from coders
  • There are other ways to track this as well like Google Analytics Custom Variables
  • Phone integration systems for click to call features
  • This code is session based and is valid only if there is just one page website with lead form. 
  • If its a multi page website then you will need to pass on parameters from URL in to Session or cookie, and retrive them while inserting in to DB.


about Nikhil Parachure

Digital Marketing / Web & App Analytics expert with experience ranging from small businesses to very large portals. Across varied verticals like banking, travel, ecommerce, insurance. Google Adwords top contributor since 2013 and currently working with a leading Indian ecommerce portal. Aspiring writer, wants to be lighter!

November 2012

Good Article Nik.. Will surely try this out soon!Smiley Happy

November 2012

A very helpful article on adword. Just wanted to say I love reading your article and look forward to all your posts! Carry on the fantastic work!

November 2012

Superb. Very informative. Thanks for sharing this Nikhil. Very Helpful Smiley Happy

April 2014

I use a different hack, courtesy of Justin Cutroni. He basically pulls the data from the Google Analytics cookie. This stops you from having to recode that same data into a different cookie just to pull it again - very nifty Smiley Happy

I've used this to pass into CRM's, and it's worked like a charm Smiley Happy


Unfortunately, with Google now blocking paid search queries, it isn't shown live in the GA cookie, but rather (if anything), it's going to be a nightly import from Google Adwords into GA. The only workaround is going to be doing a daily pull of all GA gclid data daily, and storing the gclid variable separately. What a royal bother Smiley Sad

ShashankSingh Rising Star
April 2014

Hi Nik,


A very informative article indeed. I work with a lot of clients that use a LMS to track their lead data. Lately I have been facing an issue on one of my clients accounts where we have been recording leads with no source attributed to them but as I can track the page from which the lead is recorded i know these leads are from dedicated adwords landing pages.


From what we can understand, this is happening becuase these users are traversing through our website and then finally end up again on our landing page where they fill up our lead form.


I have heard of something called as the cookie tracking mechanism which will retain your cookie details until your data is recorded in the database. Is this something that you recommend? or is there any other solution to this problem?


Our coders so far have not been to resolve this issue. Any help on this would be appreciated!