Guide PropellerAds: S2S sales tracking for SaaS sites [with JS]

1win

Alukard_X

Super Contributor
Joined
Oct 3, 2020
Messages
116
For initial page (landing):
HTML:
<html>
     <head>

     </head>
    <body>
<script>
   // at LP


// parameter in  url for clickid e.g. https://yoursite.com/?clickid=${SUBID}
var clickid  = 'clickid';
// default cookie time 1  day
var cookietime = '1';

function getURLParameter(name) {
     return decodeURI(
     (RegExp(name + '=' +  '(.+?)(&|$)').exec(location.search)||[,null])[1] || ''
     );
    }

function createCookie(name,  value, days) {
     var expires;
    if  (days) {
         var date =  new Date();
         date.setTime(date.getTime() + (days  * 24 * 60 * 60  * 1000));
         expires = ";  expires=" + date.toGMTString();
     }
    else {
          expires = "";
     }
    document.cookie  = name + "=" + value  + expires + "; path=/";
}



if (getURLParameter(clickid))  {
    createCookie('clickid',getURLParameter(clickid),cookietime);
}
// at  LP
</script>

    </body>
</html>

For "Thank you" page:

HTML:
<html>
     <head>

     </head>
    <body>
<script>

//  parameter in url for clickid e.g.  https://yoursite.com/?clickid=${SUBID}
var clickid = 'clickid';
// Your aid  from postback url at https://partners.propellerads.com/#/tracking
var aid  = 'REPLACE_ME';
// Your tid from postback  url at https://partners.propellerads.com/#/tracking
var tid = 'REPLACE_ME';

function  getCookie(c_name) {
    if  (document.cookie.length > 0) {
         c_start  = document.cookie.indexOf(c_name + "=");
         if  (c_start != -1) {
              c_start = c_start  + c_name.length + 1;
              c_end = document.cookie.indexOf(";",  c_start);
              if (c_end == -1) {
                   c_end = document.cookie.length;
              }
              return unescape(document.cookie.substring(c_start,  c_end));
         }
     }
    return "";
}

var  s2surl = 'http://ad.propellerads.com/conversion.php?aid=' + aid +  '&pid=&tid=' + tid + '&visitor_id=' +
 
Last edited:
To view the premium content in our affiliate marketing forum (including this awesome thread), you must first register and upgrade your account. Register today and become a part of our amazing community!
Top