SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tough problem: Remember user info of an abandoned cart

    Hi,

    I am trying to improve retention from my shipping page (that also captures an email) to my billing page by using an email capture system that emails the customer to try to get them back. I notice some other pages do this and are highly effective. My checkout is built in javascript.

    The problem is retaining the customer's information so he doesn't have to enter it again (this way I could direct link him back to the final page) I have no idea how to pull this off. Does anyone know a good way to do this?

  2. #2
    SitePoint Zealot Kayarc's Avatar
    Join Date
    Sep 2009
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Delta223 View Post
    Hi,

    I am trying to improve retention from my shipping page (that also captures an email) to my billing page by using an email capture system that emails the customer to try to get them back. I notice some other pages do this and are highly effective. My checkout is built in javascript.

    The problem is retaining the customer's information so he doesn't have to enter it again (this way I could direct link him back to the final page) I have no idea how to pull this off. Does anyone know a good way to do this?
    Use a database with that information linked to the unique customer / session ID
    Phoenix Arizona Web Design | info *at* kayarc.com | 602.633.2676

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have that much figured out. But without the ability to have a custom link in the email (since the auto-responder can't take it) how can the customer click a generic link to my site and have all the previously entered info "remembered?"

  4. #4
    SitePoint Zealot Kayarc's Avatar
    Join Date
    Sep 2009
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Delta223 View Post
    I have that much figured out. But without the ability to have a custom link in the email (since the auto-responder can't take it) how can the customer click a generic link to my site and have all the previously entered info "remembered?"
    Without that custom link it's not going to happen unless you are lucky enough to drop a long-term cookie on their system the first time around and they use the same system to click the link.
    Phoenix Arizona Web Design | info *at* kayarc.com | 602.633.2676

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. I did some reading on cookies but only found how they work from the consumer perspective. It seems that most users will have cookies enabled, so is it a fairly simple job to have my programmer store their 1st page entered information inside of a cookie?

  6. #6
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cookies can only store a small amount of data, so instead of storing the full customer info in a cookie, you just store a userID and some sort of authentication string so that you can relate the cookie owner to the full information stored in your server side database.

    You don't want to use a simple userID on its own, because someone could fake a cookie with different values (1, 2, 3, 1000) and extract your customers private data.

    example:
    PHP Code:
    //Authentication string
    $auth sha1(mt_rand(1,999999) . time() . microtime(false));

    /* Save customer data to DB
    (assumes variables already validated, escaped, sanitized, filtered etc.) */
    $query "INSERT INTO `customers` (name, email, auth) VALUES ('$name', '$email', '$auth'";

    if(
    mysql_query($query)) {
       
    $userID mysql_insert_id();

       
    //Store userID and auth in cookie to link with customer data
       
    $cookieValue $userID '|' $auth;
       
    set_cookie('customer_info'$cookieValuetime()+5*365*24*3600);

    Then to restore the customer data
    PHP Code:
    if(isset($_COOKIE['customer_info'])) {
        
    $cookieValue explode('|'$_COOKIE['customer_info']);
        
    $userID = (int)$cookieValue[0];
        
    $auth mysql_real_escape_string($cookieValue[1]);

       
    //Get data from DB
       
    $query "SELECT name, email FROM `customers` WHERE ID = $userID AND auth='$auth'";
       if(
    $result mysql_query($query) AND
       
    $row mysql_fetch_assoc($result)) {
          echo 
    "<h1>Welcome back " $row['name'] . "</h1>",
                 
    "<p>Still enjoying email at " $row['email'] . "?</p>";
        }


  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...And then I assume I can redirect him to a "special" link (mysite.com/retention) which should check the database against his special userID and autofill his information. Thanks for the help, I didn't think I could pull this off!

  8. #8
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once the cookie has been set it will be passed by the browser with all HTTP requests (on your domain). So once you set it, any page on your domain can check for $_COOKIE['customer_info'] and use the info get the database info and pre-populate forms.
    Just be sure to validate the cookie data before using it in an SQL query as it can be altered by users.


Bookmarks

Posting Permissions

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