Anyone know how to automate a promotion?

4 replies
I'm looking for a way to automate a promotion.

I want to send a link to a page in an autoresponder with a special offer that is available for only 4 days.

But after 4 days, I don't want the promotion to be available to that user any more.

Does anyone know how to automate this? Can I set a cookie that expires 4 days after the user has first visited the page, and then gives them different page content that says the promotion is no longer available after 4 days?

I've seen these kinds of things before. How do people do this?

Anyone?

Thanks!
Elliott
#automate #promotion
  • Profile picture of the author Bruce Hearder
    Hi Elliott,

    The simpliest method would be the cookie method, though its not very secure, becuase all the user has to do is clear cookies on their browser and then they have access to that page again.

    But if thats not a major problem then go the cookie mthod..

    Some simple javascript placed on the landing page will do the job nicely..

    Here's some JS that will do the job for you:

    Place this code just before your page's </head> tag
    Code:
    <script type="text/javascript" language="javascript">
    <!--
     var days_page_valid_for = 4;
     var exp = new Date();
     exp.setTime(exp.getTime() + (9999*24*60*60*1000));
    
     function getCookieVal (offset) 
     {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
       endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
     }
     
     function GetCookie (name) 
     {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen) 
      {
       var j = i + alen;
       if (document.cookie.substring(i, j) == arg)
        return getCookieVal (j);
       i = document.cookie.indexOf(" ", i) + 1;
       if (i == 0) break;
      }
     return null;
     }
     
     function SetCookie (name, value) 
     {
      var argv = SetCookie.arguments;
      var argc = SetCookie.arguments.length;
      var expires = (argc > 2) ? argv[2] : null;
      var path = (argc > 3) ? argv[3] : null;
      var domain = (argc > 4) ? argv[4] : null;
      var secure = (argc > 5) ? argv[5] : false;
      document.cookie = name + "=" + escape (value) +
      ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
      ((path == null) ? "" : ("; path=" + path)) +
      ((domain == null) ? "" : ("; domain=" + domain)) +
      ((secure == true) ? "; secure" : "");
     }
     
     function DeleteCookie (name) 
     {
      var exp = new Date();
      exp.setTime (exp.getTime() - 1);
      var cval = GetCookie (name);
      document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); 
     }
    -->
    </script>
    Now place this code, directly after your pages </body> tage

    Code:
    <script type="text/javascript" language="javascript">
     var thecookie = GetCookie('beenhere');
     var today=new Date(); 
     if (thecookie != null) 
     {
      //Set 1 day in milliseconds
      var one_day=1000*60*60*24;
      var ct = thecookie;
      var tt = today.getTime();
      
      var diff = Math.ceil((tt-ct)/one_day);
      
      if (diff > days_page_valid_for)
      {
       location.href = "http://www.google.com"; 
      }
      else
      {
       SetCookie('beenhere', today.getTime(), exp); 
      } 
     }
     else
     {
       SetCookie('beenhere', today.getTime(), exp);   
     }  
    </script>
    Change the line of code that reads :

    var days_page_valid_for = 4;

    To how long you want the page to remain valid for.

    Change the line of code that reads :

    http://www.google.com

    and replace with the full location of the page you want to redirect the visitor to, when the page has expired..


    I hope this helps
    Bruce
    {{ DiscussionBoard.errors[1859453].message }}
  • Thanks for that, Bruce.. I'm playing around with this code right now.

    Does anyone have any idea what internet marketers usually use when they send out email promos through automated systems that give you a certain period of time to purchase a product? Is it something like this? Or is there something else more automated that I can plug and play.

    I want to automate a promotion through my email auto-responders.. Surely this is something that people are doing....no?
    {{ DiscussionBoard.errors[1862815].message }}
    • Profile picture of the author jminkler
      Originally Posted by SetYourselfFreelance View Post

      Thanks for that, Bruce.. I'm playing around with this code right now.

      Does anyone have any idea what internet marketers usually use when they send out email promos through automated systems that give you a certain period of time to purchase a product? Is it something like this? Or is there something else more automated that I can plug and play.

      I want to automate a promotion through my email auto-responders.. Surely this is something that people are doing....no?
      If you use a CMS there is usually a Exipres date for the content.
      {{ DiscussionBoard.errors[1867043].message }}
      • Profile picture of the author outbackking
        Banned
        [DELETED]
        {{ DiscussionBoard.errors[1875425].message }}
        • Profile picture of the author lyn_lee05
          I thought you are looking for promotion strategies... i was wrong...
          {{ DiscussionBoard.errors[1875477].message }}

Trending Topics