We help IT Professionals succeed at work.

How to get the parameters I need into the URL

This is the normal URL of the page:

This is a landing page for a Google adwords campaign.

A developer was able to write a script that allowed the pulling of a keywords from Google adwords campaign and put it into the URL as query parameters.

He said that the original code does it using the Google API.

The script on this page pulls in the keyword that the user searched (Google adwords API) and populates it in the URL and then takes that KW and makes a change on the page.

For eg:

If someone searches for sysaid and sees/clicks on the ad and gets to the landing page, we see this:

This was the result:

This is the code/script:

<script type="text/javascript">
function getParam ( sname )
  var params = location.search.substr(location.search.indexOf("?")+1);
  var sval = "";
  params = params.split("&");
    for (var i=0; i<params.length; i++)
         temp = params[i].split("=");
         if ( [temp[0]] == sname ) { sval = temp[1]; }
  return sval;

function process_keyword (sname)
  var apps = {};
apps["service now"]="ServiceNow";
apps["track it"]="Track-It";
apps["ibm tivoli"]="IBM Tivoli";
apps["ca unicenter"]="CA Unicenter";
apps["frontrange heat"]="FrontRange Heat";
apps["servicedesk plus"]="ServiceDesk Plus";
apps["bmc remedy"]="BMC Remedy";
apps["bmc remedyforce"]="BMC RemedyForce";
apps["hp service manager"]="HP Service Manager";
apps["dell kace"]="Dell Kace";
apps["citrix gotoassist"]="Citrix GoToAssist";
apps["jira service desk"]="JIRA Service Desk";
apps["numara footprints"]="Numara Footprints";
apps["zendesk for it"]="Zendesk for IT";
  keyword = unescape(getParam(sname));
  for (key in apps){
    if (keyword.toLowerCase().contains(key)){
      return apps[key];
  return "other Service Desks";

function set_data(sname){
  $('#replace_text').html("Why Freshservice is better than "+process_keyword(sname));
  var keyw = process_keyword(sname);
  if( keyw == "other Service Desks"){
  	$('#replace_text1').html("IT SERVICE DESK SOFTWARE");  
    $('#replace_text1').html(process_keyword(sname).toUpperCase()+" Vs FRESHSERVICE");  

Open in new window

This is the result that I am looking to achieve.
I would like to get the keyword, ad group name and campaign name into the URL.

This is the result I am looking for:


What is the code to get this done?
Watch Question

Lucas BishopMarketing Technologist
Nice landing page!

First, you'll be using Valuetrack parameters in your URL configuration within adwords. Specifically:


You'll setup your "Final URL" in Adwords as:

Within the "Ad URL Options" you'll setup a Tracking Template.
adwords tracking template
You'll insert this string into the "Tracking Template" field as:

{lpurl} will be replaced with the Final URL, hence the result will be:

I should mention though, that your script does not parse "otm_kw" as you can see by testing this:


What if I don't want the kw, adgroup or campaign name in the URL?

Everyone can see it then.
Marketing Technologist
Including this data in the URL is how adwords allows you to parse it.

You could always change the names of campaigns/adgroups to not be human readable (ie. change Competition adgroup name to "CMP", Change Search US campaign name to "SUS"). The keyword is something they typed into their browser, so obfuscating it seem unnecessary.

If you don't want to parse the data, adwords sends it by default in an encrypted format when you use auto-tagging. However, the only place you can access the data with this setup is via Analytics reporting. This would be the only way to completely hide all of this data from the user.