Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // Retrieves gclid value from cookie and stores in hidden form field id='gclid_field'
  2. <script>
  3. function readCookie(name) {
  4. var n = name + "=";
  5. var cookie = document.cookie.split(';');
  6. for(var i=0;i < cookie.length;i++) {
  7. var c = cookie[i];
  8. while (c.charAt(0)==' '){c = c.substring(1,c.length);}
  9. if (c.indexOf(n) == 0){return c.substring(n.length,c.length);}
  10. }
  11. return null;
  12. }
  13.  
  14. window.onload = function() {
  15. document.getElementById('gclid_field').value =
  16. readCookie('gclid');
  17. }
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement