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 ="?")+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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lucas BishopClick TrackerCommented:
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:
smuralisankarAuthor Commented:
What if I don't want the kw, adgroup or campaign name in the URL?

Everyone can see it then.
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Internet / Email Software

From novice to tech pro — start learning today.