How to split traffic [CPA]

Sadorus

Registered Member
Joined
Mar 9, 2013
Messages
83
Reaction score
45
Hello,

I want to split my traffic and redirect desktop users to CPAGrip and mobile users to Ogads. I found few methods with I can use, but I don't really know how to set them up properly.

Here are two examples of methods, which I'm trying to setup. Anyone can help me?

Code:
<html>
 
<head>
  <script type="text/javascript">
    function myFoo() {
      var lck = false;
      src = "https://blissinstalls.com/script_include.php?id=xxxx"
    };
 
  </script>
 
  <script type="text/javascript">
    var ogblock = true;
 
  </script>
  <script type="text/javascript" src="https://www.liveappsearch.com/contentlockers/load.php?id=xxxxxx"></script>
  <script type="text/javascript">
    if (ogblock) window.location.href = "https://www.liveappsearch.com/contentlockers/adblock.php";
 
  </script>
  <?php
 
// At this point, we are checking user agent string for most used mobile devices
 
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
 
$mob = strpos($ua,"mobile");
$iphone = strpos($ua,"iphone");
$android = strpos($ua,"android");
$win = strpos($ua,"windows phone");
$palmpre = strpos($ua,"webos");
$berry = strpos($ua,"blackberry");
$ipod = strpos($ua,"ipod");
$ipad = strpos($ua,"ipad");
 
if ($mob || $iphone || $android || $palmpre || $ipod || $berry || $win || $ipad == true) {
   $url = 'myFoo();'; // If mobile is detected, we will choose mobile URL
}
else
{
   $url = echo "<script> myFoo(); </script>"; // If no mobile detected, we will choose non-mobile URL
}
 
header("Location: $url"); // Redirect the visitor to chosen URL
?>
</head>
 
<body></body>
 
</html>

Code:
.....
<script src="js/main.js"></script>
<!-- *** GATEWAY CODE ***_______________________________________________ -->
        <script>function myFunction() {
            var lck = false;
            src="https://blissinstalls.com/script_include.php?id=xxxxx"
            if(!lck){top.location = 'https://blissinstalls.com/help/ablk.php';
          }
          }
  </script>
                  
<!-- *** /GATEWAY CODE ***_______________________________________________ -->
 
<script type="text/javascript">var ogblock=true;</script>
<script type="text/javascript" src="https://www.liveappsearch.com/contentlockers/load.php?id=xxxxxxxxxxxx"></script>
<script type="text/javascript">if(ogblock) window.location.href = "https://www.liveappsearch.com/contentlockers/adblock.php";</script>
<!-- *** GATEWAY CODE ***_______________________________________________ -->
  <?php
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
 
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
 $locker = 'http://google.com';
}
else
{
   $locker = 'myFunction();'; // If no mobile detected, we will choose non-mobile URL
 
}
   header("Location: $locker");
 
?>
<script>
$("#humanverification").click(function(e) {
    e.preventDefault();
    <?php echo $locker ?>
 
});
</script>
<!-- *** /GATEWAY CODE ***_______________________________________________ --> 
 
</body>
</html>

Someone suggested me to use smartURL. It looks very nice, but if I put link from CPAGrip (this one: blissinstalls.com/script_include.php?id=xxxxx) it will redirect me to wall of text (probably code of locker).
 
I have done this in the past. I recommend using detectmobilebrowsers.com (can not post links sadly) instead of creating these scripts yourself. Saves you a lot of time. :)

They provide scripts for several programming languages.
 
Back
Top