Home > Programming, Servers & Scripts >

Mobile Script that redirects instead of goes back (19)


12-26-2013 10:06 PM #1 francis (Member)
Mobile Script that redirects instead of goes back

My Code guy is on vacation, so I was hoping someone could help me out.

I'm looking for a script that redirects users to multiple offers in a chain when they attempt to click the back button in mobile safari, or chrome. Any mobile browser.

The one I used to use only works with specific web browsers, see below.


Code:
<?php

$URL = "http://www.google.com";


if ($_GET["i"] == "1") { print "<html><head><title></title><script type=\"text/javascript\">parent.location.href='$URL';</script></head><body onLoad=\"x();\"></body></html>"; exit; }

?>
<html>
<head>
  <title>please wait...</title>
  <script type="text/javascript">
      window.history.forward();
      function noBack() { 
        window.history.forward(); 
      }
  </script>
</head>
<body onLoad="noBack();" onpageshow="if (event.persisted) noBack();" onUnload="">
<div style="display:none"><iframe src="?i=1" width="1" height="1"></iframe></div>
</body>
</html>


12-26-2013 10:36 PM #2 maximallimit ()

I don't know if this is the most efficient way of doing it, but this is what I'm using and it works

Code:

Code:
<html>
<head>
    <title>Back button test</title>
</head>
<body>
    <script type="text/javascript">
         window.history.pushState('other.html', 'Other Page', 'other.html');
         window.history.pushState('initial.html', 'Initial Page', 'initial.html');
    </script>

    Initial page <br />

    <script type="text/javascript">

         window.addEventListener("popstate", function(e) {
            if(document.URL.indexOf("other.html") >= 0){
                document.location.href = document.location;
            }
         });

    </script>
</body>
</html>
P.S. I was able to squeeze an extra 10% -15% profit on some mobile camps by using this script


Paul.


12-26-2013 10:48 PM #3 francis (Member)

Thanks man exactly what I needed


12-30-2013 03:30 AM #4 stackman (Administrator)

Nice! Have any stats on how effective this is?


12-30-2013 04:21 AM #5 francis (Member)

^^Been testing this and getting a lot of extra clicks, as you would expect. Sending them directly to an offer when they go back isn't very high;y converting. There are many, many angles you can test tho and I'm having some pages made that will hopefully improve conversions.


01-23-2014 02:45 PM #6 jimclark (Member)

Hi Paul

You know where it reads 'other.html' is that where I put the link that I want to send them to? And if they click back again, I add the second back link to 'other page',?

For the initial.html section, do I leave that as it is or is that where I put the link to my main url?

What goes in this section?

if(document.URL.indexOf("other.html") >= 0){
document.location.href = document.location;

Thanks

Quote Originally Posted by maximallimit View Post
I don't know if this is the most efficient way of doing it, but this is what I'm using and it works

Code:
Code:
<html>
<head>
    <title>Back button test</title>
</head>
<body>
    <script type="text/javascript">
         window.history.pushState('other.html', 'Other Page', 'other.html');
         window.history.pushState('initial.html', 'Initial Page', 'initial.html');
    </script>

    Initial page <br />

    <script type="text/javascript">

         window.addEventListener("popstate", function(e) {
            if(document.URL.indexOf("other.html") >= 0){
                document.location.href = document.location;
            }
         });

    </script>
</body>
</html>
P.S. I was able to squeeze an extra 10% -15% profit on some mobile camps by using this script


Paul.


01-24-2014 09:47 PM #7 bbrock32 (Administrator)

Quote Originally Posted by francis View Post
^^Been testing this and getting a lot of extra clicks, as you would expect. Sending them directly to an offer when they go back isn't very high;y converting. There are many, many angles you can test tho and I'm having some pages made that will hopefully improve conversions.
Did you notice any change in your original offer CR after this?


01-25-2014 10:37 PM #8 maximallimit ()

Quote Originally Posted by jimclark View Post
Hi Paul

You know where it reads 'other.html' is that where I put the link that I want to send them to? And if they click back again, I add the second back link to 'other page',?

For the initial.html section, do I leave that as it is or is that where I put the link to my main url?

What goes in this section?

if(document.URL.indexOf("other.html") >= 0){
document.location.href = document.location;

Thanks
Yes, replace other.html with your "back" page and initial.html with the page the script sits on.


Quote Originally Posted by bbrock32 View Post
Did you notice any change in your original offer CR after this?
Not really, but depends on the niche/campaign I guess.


Quote Originally Posted by stackman View Post
Nice! Have any stats on how effective this is?
I managed to squeeze an extra 10% -15% ROI on some campaigns, depends very much on how one is using it, sending the user straight to an offer won't make any difference. I am testing something different atm with this and seeing great results.


01-25-2014 10:59 PM #9 stackman (Administrator)

I could see this doing very well with virus campaigns, as a 2nd notice of urgency.


01-26-2014 10:55 AM #10 maximallimit ()

Yep, also think battery/wifi boosters


02-03-2014 09:21 AM #11 grandtheftpixel (Senior Member)

If you got creative you could also use it to further legitimise the campaign/offer.


08-20-2014 05:54 PM #12 stackman (Administrator)

Quote Originally Posted by grandtheftpixel View Post
If you got creative you could also use it to further legitimise the campaign/offer.
A 2nd notice of awareness really works well.


09-03-2014 10:39 AM #13 ivancy (Member)

We have that feature built in for our affiliates and they can chose to enable/disable it for every campaign link, as some ad networks/publishers don't allow you to block the back button and in fact can ban you for doing it, so be careful.

If it's enabled, we send the back button traffic to other offers on a cascading system and it can generate from 10% to 20% extra revenue depending on the country/carrier that of course is credited to the affiliate as the click ID and all the attribution is carried over all the offers.


11-14-2014 02:42 PM #14 Philwil (Member)

At the moment I have it like this in my html file of my landingpage, in the body tags.

<script type="text/javascript">
window.history.pushState('http:www.offerpage.com', 'Other Page', 'http:www.offerpage.com');
window.history.pushState('http:www.script-on-landingpage.com', 'Initial Page', 'http:www.script-on-landingpage.com');
</script>

Initial page <br />

<script type="text/javascript">

window.addEventListener("popstate", function(e) {
if(document.URL.indexOf("http:www.offerpage.com") >= 0){
document.location.href = document.location;
}
});

</script>


Not sure which initial.html and otherpage.html im supposed to edit. But clearly I am doing something stupid :P


11-15-2014 03:19 AM #15 zeno (Administrator)

In index.html you should have the following code:

Code:
<script type="text/javascript">
window.history.pushState('back.html', 'Back page', 'back.html');
window.history.pushState('index.html', 'Initial Page', 'index.html');
</script>
<script type="text/javascript">
window.addEventListener("popstate", function(e) {
if(document.URL.indexOf("back.html") >= 0){
document.location.href = document.location;
}
});
</script>
Then you just need to make a back.htmk.

Your code is weird, why do you have http:domain.com in there? That's not even a valid syntax for a page - it should be http://domain.com

You should also replace only back.html with a full URL, not index.html - otherwise you would have to change it arduously for every different index.html page that you used.


11-15-2014 02:21 PM #16 ramzinator (Member)

Or here one more way.

<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://tracker.com/click'}
}
</script>
backfix.min.js - https://code.google.com/p/group97230...ix.min.js?r=61


11-18-2014 03:24 AM #17 Nigel (Member)

how can I pass Voluum variables to the 2nd lander (back.html) as well? The variables are not passing on to the 2nd lander properly and are showing blanks.


11-18-2014 03:44 AM #18 zeno (Administrator)

Pass the variables to the lander by putting them explicitly in the URL of the lander in Voluum.

Then use some javascript to get these and plug them into the above code http://stmforum.com/forum/showthread...s-querystrings!

You will need to place this code before the 2nd script above so that you can insert the variables (e.g. +var+) into the back URL properly.


11-27-2014 09:08 PM #19 Philwil (Member)

Quote Originally Posted by zeno View Post
In index.html you should have the following code:

Code:
<script type="text/javascript">
window.history.pushState('back.html', 'Back page', 'back.html');
window.history.pushState('index.html', 'Initial Page', 'index.html');
</script>
<script type="text/javascript">
window.addEventListener("popstate", function(e) {
if(document.URL.indexOf("back.html") >= 0){
document.location.href = document.location;
}
});
</script>
Then you just need to make a back.htmk.

Your code is weird, why do you have http:domain.com in there? That's not even a valid syntax for a page - it should be http://domain.com

You should also replace only back.html with a full URL, not index.html - otherwise you would have to change it arduously for every different index.html page that you used.
Getting back to this, cheers for the answer Zeno! Yeah I was being stupid, I put that in there as an example and just forgot to do "http://". Hope can make it work now.


Home > Programming, Servers & Scripts >