Hi there
Historically, I've been using a separate campaign to track my backbutton conversions. However, I've realized that by doing that, I'm not getting a complete picture of where the backbutton conversions are coming from.
So what I want to do now is to pass my traffic source tokens through my campaign so that whenever a backbutton conversion occurs, I know exactly which placement it came from while at the same time, have the ability to rotate my landers so that when the user hits the backbutton, they will see a different lander.
The script I have been using for my backbutton is:
<script type="text/javascript">
window.history.pushState('other.html', 'Other Page', 'other.html');
window.history.pushState('initial.html', 'Initial Page', 'initial.html');
</script>
<script type="text/javascript">
window.addEventListener("popstate", function(e) {
if(document.URL.indexOf("other.html") >= 0){
document.location.href = document.location;
}
});
</script>
<html>
<head><meta http-equiv="refresh" content="0;url=http://trackinglink.com?tokens={tokens}" /></head>
<body>
</body>
</html>
Hello xkjonz,
you can use the following script to do that:
<script type="text/javascript">function appendqs(t,n){var e=t&&-1!==t.indexOf("?"),o="";return n&&(o=e?"&":"?",t+=o+n),t}var pageInfo={title:document.title,url:location.href},backPageInfo={title:null,url:appendqs("index.html",location.search.substring(1))};window.history.pushState(backPageInfo,null,backPageInfo.url),window.history.pushState(pageInfo,pageInfo.title,pageInfo.url),window.addEventListener("popstate",function(){document.URL.indexOf("index.html")>=0&&(document.location.href=document.location)});</script>
I think it could be in other folder as well, but I always included it in the same folder.
Awesome! Thanks for the reply. I'll give it a try and see how it goes.
Yo,
To rotate your redirect lander you can use something along the lines of this:
<script>
// Push a bunch of fake state
window.history.pushState('http://...', null, null);
window.history.pushState('http://...', null, null);
var potentialLanders = [
"http://...",
"http://...",
"http://...",
"http://..."
];
var selectedLander = potentialLanders[Math.floor(Math.random() * potentialLanders.length)];
window.onpopstate = function() {
window.location.href = selectedLander;
};
</script>
Nice tip! I'll give that one a try too 