Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow using a cookie (possibly) to verify that a visitor did something?

    Hi all,

    This has been plagueing me for sometime now. I realise that I cannot use a cookie across two different domains. But I need to find out that firstly a visitor has been to website A and then from that site has navigated to website B and made a purchase. Therefore website B can know that website A made the initial refering link.

    My guess is that on website B there is a cookie script that on the landing page(site B's homepage), this script creates a cookie and sends it to the visitors machine. This cookie would somehow capture the refering address from the HTTP get request and store this info in the cookie. The cookie would expire after about two hours, but if the visitor then subsequently made a booking, the cookie could be pulled from the visitors machine and the referer info taken out and stored in a hidden booking form field? I hope that my theory is there more or less, id really just appriciate anyone pointing me in the right direction. Thank you for taking the time to read this.

    All the Best,

    Andalucia.

  2. #2
    Regular Coder
    Join Date
    Mar 2004
    Location
    Norway
    Posts
    204
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In NN you can acces the history array, where history[0] would be the previous url, but this requires a signed script and is not supported by IE.... My guess is that you'll need a server side language.
    <JPM />

  3. #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,079
    Thanks
    0
    Thanked 257 Times in 253 Posts
    You can use document.referrer to get the referring page or get it in the server-side but that's not reliable. Another alternative is to set the window.name property from website A then check it in website B. That property is persistent accross windows regardless of domain.

    website A:
    Code:
    var marker = "websiteBreferrer:";
    window.name = marker+location.href;
    alert(window.name);
    website B:
    Code:
    alert(window.name);
    var marker = "websiteBreferrer:";
    if (window.name.indexOf(marker)==0){ //make sure it's the first string
      alert("The user came from "+window.name.substring(marker.length));
       //...
    }
    The caveat of this is if javascript is disabled, you won't be able to track it and NS4 doesn't allow invalid characters in window.name.
    Last edited by glenngv; Jul 22nd, 2004 at 12:18 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •