How to get the parameters I need into the URL

This is the normal URL of the page:
http://freshservice.com/compare-it-service-desk

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:
http://freshservice.com/compare-it-service-desk?kw=sysaid

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["servicenow"]="ServiceNow";
apps["service now"]="ServiceNow";
apps["cherwell"]="Cherwell";
apps["landesk"]="Landesk";
apps["connectwise"]="Connectwise";
apps["sysaid"]="Sysaid";
apps["track it"]="Track-It";
apps["ibm tivoli"]="IBM Tivoli";
apps["ca unicenter"]="CA Unicenter";
apps["frontrange heat"]="FrontRange Heat";
apps["frontrange"]="FrontRange";
apps["servicedesk plus"]="ServiceDesk Plus";
apps["autotask"]="Autotask";
apps["bmc remedy"]="BMC Remedy";
apps["bmc remedyforce"]="BMC RemedyForce";
apps["samanage"]="Samanage";
apps["hp service manager"]="HP Service Manager";
apps["topdesk"]="TopDesk";
apps["dell kace"]="Dell Kace";
apps["dellkace"]="DellKace";         
apps["manageengine"]="ManageEngine";
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");  
  }
  else{
    $('#replace_text1').html(process_keyword(sname).toUpperCase()+" Vs FRESHSERVICE");  
  }
  
}
</script>

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:

http://freshservice.com/compare-it-service-desk?otm_kw=sysaid&otm_adgroup=competition&otm_campaign=search_US


What is the code to get this done?
smuralisankarAsked:
Who is Participating?
 
Lucas BishopClick TrackerCommented:
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.
0
 
Lucas BishopClick TrackerCommented:
Nice landing page!

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

{campaignid}
{adgroupid}
{keyword}

You'll setup your "Final URL" in Adwords as:
http://freshservice.com/compare-it-service-desk

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}?otm_kwid={keyword}&otm_adgroup={adgroupid}&otm_campaign={campaignid}

{lpurl} will be replaced with the Final URL, hence the result will be:
http://freshservice.com/compare-it-service-desk?otm_kw=sysaid&otm_adgroup=competition&otm_campaign=search_US

I should mention though, that your script does not parse "otm_kw" as you can see by testing this:
http://freshservice.com/compare-it-service-desk?otm_kw=sysaid
0
 
smuralisankarAuthor Commented:
What if I don't want the kw, adgroup or campaign name in the URL?

Everyone can see it then.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.