Is there a way to turn exit pops on and off using a subid in the url? Would be a big help for using 1 lp on multiple networks.
The subid would basically tell the exit pop script whether or not to run.
on page script:
if pop=facebook then exit pop = OFF
if pop=msn then exit pop = ON
if pop=adblade then exit pop = OFF
url
siteaddy.com/?pop=facebook
siteaddy.com/?pop=msn
siteaddy.com/?pop=adblade
can that be done in php?
yes it can
if($_GET['pop'] == "msn") //popscript here
Thanks tap1on, that's awesome,
How would that look for multiple subids? is there a way to do multiple without pasting the postscript in there for each one?
Non Coder Example:
if pop=msn then include pop code in a php or js file here
or
if pop=msn then run script here
This way there could be only 1 exit pop script?
Just use an or operator inside the if statement. E.g. if($_GET['pop'] == "msn" or $_GET['pop'] == "adblade") //insert script after here. Just insert whatever subids you want the popscript to activate into the if statement with the 'or' operator separating them. I'd be inclined to insert something like this into your page:
<?php
$pop = $_GET['pop'] //get the traffic source subid
if($pop == "msn" or $pop == "adblade"){ //if subid any of these execute the below
<script here>
</script>
}
?>
Ok getting really close. I can now get it to echo Hello World if pop = msn or adblade like this:
<?php if($_GET['pop'] == "msn" or $_GET['pop'] == "adblade") //popscript here echo '<p>Hello World</p>'; ?>
<?php
if($_GET['pop'] == "msn" or $_GET['pop'] == "adblade") //popscript here
{
<script type="text/javascript" language="javascript">
var areYouReallySure = false;
var internalLink = false;
function areYouSure() {
if (!areYouReallySure && !internalLink) {
areYouReallySure = true;
location.href="#"
return "WAIT!";
}
}
window.onbeforeunload = areYouSure;
</script>
}
?>
View the source of your page and see if it has spat out the script source. You might need to put echo before the <script ... part to make the PHP actually print that into the page the browser loads. PHP is server side whilst javascript is client side, so as it stands I think the PHP code doesn't actually inject the javascript code into the page that the browser loads. Hence the echo command. So:
<?php
if($_GET['pop'] == "msn" or $_GET['pop'] == "adblade") //popscript here
{
echo '<script type="text/javascript" language="javascript">
var areYouReallySure = false;
var internalLink = false;
function areYouSure() {
if (!areYouReallySure && !internalLink) {
areYouReallySure = true;
location.href="#"
return "WAIT!";
}
}
window.onbeforeunload = areYouSure;
</script>';
}
?>
Big thanks Zeno and tap1on. Works perfectly.
Glad to hear it.