Hi!
Trying to implement back button script, this shit's confusing.
Here's my code:
window.addEventListener("popstate", function(e) {
if(document.URL.indexOf("other.html") >= 0){
document.location.href = document.location;
}
});
window.history.pushState('other.html', 'Other Page', 'other.html');
window.history.pushState('first.html', 'Initial Page', 'first.html');
This one works for me.
Copy this one in your <head>
<script type="text/javascript" src="backfix.min.js"></script>
<script language="javascript" type="text/javascript">
bajb_backdetect.OnBack = function(){
window.history.back=function(){document.location=' http://xxxx.voluumtrk.com/YourUniqueCampaignURL'}
}
</script>
Thank aaart! I'm sure there's a better way though.
Can anyone be kind enough to share?
This one works. Upload other.html into the same directory. I saw some people doing some pretty hilarious/creative shit with this while spying.
<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>
shakeddown I think you misunderstand, I mean without redirecting through other.html but sending em straight to
Btw guys how do you tracking
As if you redirect straight to a "middle page" (eg. back.html) you lose all the data like Site ID and you will not able to optimize on those data anymore.
Do you have solution for this?
You can set-up a new campaign exclusively to track your back button redirect clicks and set rules based on each geo.
Then set your redirect URL to your new
That's exactly what I'm doing, but as I'm sending people from my LP instead of traffic source I lose my tokens. Don't know how to carry them so in the end it got tracked. This way I just see them as "Unknown" in
Ah ok. Getting that granular on a back button redirect will get more tricky.
The only way I can think to do it - and I haven't tried this - would be to pull the whatever variables you need into the query string of your landing pages then extract that information using javascript in a similar way to how you would call out model, browser, city etc.
<script>
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] || ''
);
}
</script>
Maybe you should put these codes on your other.html page: http://stmforum.com/forum/showthread...s-querystrings
I have a sophisticated back button redirect script with CPC monetization if anybody is interested. Send me a PM for details
Works all browsers even mobile 
I find it to fire duplicate conversions with the redirect campaign. does it happen to you as well?
The one from aaart works for me " <script type="text/javascript" src="backfix.min.js"></script>"
But I am also trying to make the other script work. I have it like this:
---
<script type="text/javascript">
window.history.pushState('http://google.com', 'Other Page', 'http://google.com');
window.history.pushState('inex.html', 'Initial Page', 'index.html');
</script>
<script type="text/javascript">
window.addEventListener("popstate", function(e) {
if(document.URL.indexOf("http://google.com") >= 0){
document.location.href = document.location;
}
});
</script>
---
I want the back redirect with this script to go to an offer, not to an html or php file in the same directory. To get it to work to redirect to an offer url, I made a back.php file with a redirect to offer url.
Seeing this on a few landers I'm trying to mod, don't really understand what the code is doing. Further insight is very welcomed..
It's called a back trap script. It redirects to click url when the user hits back.
Thx Sleen. So basically you throw in your
Just put the click url. The same url you use for your cta
Depends. It's a little better when you add an exit popup and then redirect them
Thanks again Sleen..
Here's one I found on StackOverFlow that worked well in Chrome. Place above the closing </body> tag and make sure you are calling the jquery library.
<script>
jQuery(document).ready(function($) {
if (window.history && window.history.pushState) {
$(window).on('popstate', function() {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '') {
alert('Back button was pressed.');
window.location='www.example.com';
return false;
}
}
});
window.history.pushState('forward', null, './#forward');
}
});
</script>
Just want to report that aaaart's method worked for me as well! Thanks so much!
Amy
It's not a specific URL but from what I noticed if I put http://myurl.com it works and if I put http://myurl.com?s1=z&s2=b it doesn't work for example. I thought maybe it had to do with tokens or something but it looks more that from a certain length it gives me problems, just my guess I have zero clue in programming (:
[QUOTE=vortex;227365]My team member has just told me the same problem you experienced - that parameters passed via url were "getting messed up" by the backbutton code. His solution? Just put the backbutton code at the very end of the lander and it should work! Good luck and please let me know if it doesn't fix the problem - we'll figure it out!
Thank you Amy
Honestly I don't know at this point if it helped or not. testing it on different browsers and devices made me a bit confused-sometimes it works sometimes not. I have been seeing conversions however. Maybe sometime it's a cookie issue.
We'll stick with it for now (:
Yeah I've noticed that a lot of code will only work for some browsers and not others....as long as implementing the code makes the lander perform better than before overall speaking, then the purposes is served. It may also help to look into stats to see whether the lander's performing especially poorly for certain browsers/devices and try to track down the problem for these specifically.
Alternatively, we could just spend the time testing new offers...
Depends on how keen of a problem-solver you are I guess! 
Amy
**Quick Update**
I have been using the redirect back function for the past 2 weeks or so and it added another $150 to my revenue that I wouldn't have seen otherwise. Think of smart ways to incorporate it into the funnel, meaning the back page needs to make sense even though that's not the page the user meant to go to.
Example:
anti virus lp
hits back button
JS alert : "virus attack in progress, click ok to remove viruses"
Offer
Technically what I would like to know is how use the imobitrax landing page link as the back link
"<?php echo $offer; ?>"
Wow thanks for that update orisin!!
Regarding flow/funnel, I have some additional food for thought: If you're using pop traffic, remember that it's "interrupt" marketing, meaning whatever it is you're promoting on your first lander, the visitor did NOT ask for it! What I'm trying to say is that it may work better to direct them to a totally different lander when they hit the backbutton - something promoting an entirely different offer - because chances are if they've hit the backbutton in the first place it's because that type of offer didn't appeal to them, so we hit them with a different offer! 
Of course ultimately everything will depend on how good your particular landers and offers are...
Stats don't lie so only testing will tell.
Amy
OK, this will pass all current campaign tokens except voluumdata token.
var redirect_camp_link="your_link";
var querystring=window.location.search;
function removePar(name,qString){
el=decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(qString)||[,null])[0] ||'' );
new_st=qString.replace(el,'');
return new_st;
}
history.replaceState(null, document.title, location.pathname +querystring+ "#!/stackthatmoney");
history.pushState(null, document.title, location.pathname+querystring);
window.addEventListener("popstate", function() {
if (location.hash === "#!/stackthatmoney") setTimeout(function() {
location.replace(redirect_camp_link+removePar('voluumdata',querystring))
}, 0)
}, false);
redirect_camp_link='http://xxxx.voluumtrk.com/23369d27-b2ad-4b3a-9c4d-27542914e176b'
redirect_camp_link='http://xxxx.voluumtrk.com/23369d27-b2ad-4b3a-9c4d-27542914e176b?ad={ad}'
I've put together another script that will pass only needed tokens.
I've intentionally make it long and added comments. Enjoy!
<script>
//redirect campaign link, without tokens
var redirect_camp_link="your_link";
//put your tokens to pass to back btn campaign here, respect the format.
var tokens_to_pass=['ad','taffic_source'];
//get tokens part of the link
var querystring=window.location.search;
// put tokens in a readable and reusable array
var urlParams;
function getURLPars() {
var match,pl=/\+/g, search=/([^&=]+)=?([^&]*)/g, decode=function (s){ return decodeURIComponent(s.replace(pl, " "));},query = querystring.substring(1);
urlParams = {};
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
}
getURLPars();
//create a new tokens string
function addPars(parrArray){
var new_pars='';
if(urlParams[parrArray[0]]) new_pars=new_pars+'?'+parrArray[0]+'='+urlParams[parrArray[0]];
for(i=1;i<parrArray.length;i++){
if(urlParams[parrArray[i]]) new_pars=new_pars+'&'+parrArray[i]+'='+urlParams[parrArray[i]];
}
return new_pars;
}
//back button hack
history.replaceState(null, document.title, location.pathname +querystring+ "#!/stackthatmoney");
history.pushState(null, document.title, location.pathname+querystring);
window.addEventListener("popstate", function() {
if (location.hash === "#!/stackthatmoney") setTimeout(function() {
//setup redirect link + tokens
location.replace(redirect_camp_link+addPars(tokens_to_pass))
}, 0)
}, false);
</script>
hm... you confuse me
Let's brake it down:
Your initial campaign link
http://xxx.voluumtrk.com/some_code1?ad=ad1&placement=reddit
http://xxx.voluumtrk.com/some_code2
tokens_to_pass=['ad','placement'];
http://xxx.voluumtrk.com/some_code2?ad=ad1&placement=reddit
Didnt try your solution, but I bought the script from affkit few months ago that exactly solved my issues with passing tokens above.
Thanks Shogun. The 2nd script where I passed my chosen tokens works for me.
awesome!