Quantcast
Channel: Topliners: Message List
Viewing all articles
Browse latest Browse all 3431

Capturing Referring source using querry string

$
0
0

I have been working capturing a referring source through my form and have yet to see success.The article I've been using is:How to Capture Referring Sources to Landing Pages and in Forms using Query Strings  My form name is "LSG_Webinar_SustainingDevelopment" , Query string is "source" and hidden field html " source". I've placed my script below in hopes of someone with a little more experience finding my error.

 

 

 

<script type="text/javascript">var defaultHiddenFieldNameValue = "source";

 

 

 

function getQueryStringParamValue(strQStrParam) {

 

 

 

var strURL = document.location.href;

 

 

 

var strQStrParamValue = "";

 

 

 

           if (strURL.indexOf('?') != -1)

 

           {

 

                       strQStrParamValue = strURL.substr(strURL.indexOf('?') + 1);

 

                       if (strQStrParamValue.indexOf(strQStrParam) != -1)

 

                       {

 

                                   strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf(strQStrParam));

 

                                   strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf('=') + 1);

 

                                   if (strQStrParamValue.indexOf('&') != -1)

 

                                   strQStrParamValue = strQStrParamValue.substr(0, strQStrParamValue.indexOf('&'));

 

                                   return strQStrParamValue;

 

                       }else{

 

                                   strQStrParamValue = defaultHiddenFieldNameValue;

 

                                   return strQStrParamValue;

                       }

 

           }else{

 

                       strQStrParamValue = defaultHiddenFieldNameValue;

                       return strQStrParamValue;

           }

 

}

// Form name goes here

var form = "LSG_Webinar_SustainingDevelopment";

function setCampaign(){

   var elqForm = document.forms[LSG_Webinar_SustainingDevelopment];

   //repeat for each field to populate

 

  elqForm.elements['Campaign_ID'].value = getQueryStringParamValue('source');

 

}

 

window.onload = setCampaign; </script>

 

 

 

Thank you- Danielle


Viewing all articles
Browse latest Browse all 3431

Trending Articles