![]() | | ||||||||
| | #1 |
| Active Warrior Join Date: Oct 2009
Posts: 36
Thanks: 3
Thanked 1 Time in 1 Post
|
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 |
| | |
| | #2 |
| Advanced Warrior War Room Member Join Date: May 2004 Location: Perth, Australia.
Posts: 717
Thanks: 4
Thanked 182 Times in 138 Posts
|
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> 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> 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 |
| ----------------- Get Your Backlinks indexed quicker at BackLinks2RSS Create Full Text Feeds from Partial RSS Feeds at FeedExpander.com. See the WarriorForum post about it here | |
| | |
| | #3 |
| Active Warrior Join Date: Oct 2009
Posts: 36
Thanks: 3
Thanked 1 Time in 1 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? |
| | |
| | #4 | |
| WebNinja Join Date: Mar 2010 Location: Atlanta GA
Posts: 410
Thanks: 17
Thanked 50 Times in 31 Posts
| Quote:
| |
| | |
| | #5 |
| Warrior Member Join Date: Mar 2010
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
I thought you are looking for promotion strategies... i was wrong...
|
| | |
| | |
![]() |
|
| Tags |
| automate, promotion |
| Thread Tools | |
| |
![]() |