Last active
September 8, 2024 08:18
-
-
Save hunty/9b5cfe419d3dbb28e131fd100ce51d77 to your computer and use it in GitHub Desktop.
Revisions
-
hunty revised this gist
Oct 20, 2017 . 1 changed file with 18 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,20 @@ window.onload = function() { // Parse the URL function getParameterByName(name) { var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } // Give the URL parameters variable names var source = getParameterByName('utm_source'); var medium = getParameterByName('utm_medium'); var campaign = getParameterByName('utm_campaign'); // Put the variable names into the hidden fields in the form. document.getElementById("property_utm_source").value = source; document.getElementById("property_utm_medium").value = medium; document.getElementById("property_utm_campaign").value = campaign; //U Can use it with Expertsender Forms } -
hunty created this gist
Oct 10, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ // Parse the URL function getParameterByName(name) { var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } // Give the URL parameters variable names var source = getParameterByName('utm_source'); var medium = getParameterByName('utm_medium'); var campaign = getParameterByName('utm_campaign'); // Put the variable names into the hidden fields in the form. document.getElementById("property_utm_source").value = source; document.getElementById("property_utm_medium").value = medium; document.getElementById("property_utm_campaign").value = campaign; //U Can use it with Expertsender Forms