PageSourceSearch

https://www.purevpn.com/wp-content/plugins/affilliate-management/assets/js/pap.js?ver=v3.4.74

js purevpn.com collected 2026-10-01 09:20:35 UTC 7,055 bytes, 195 lines download raw bytes

1// Ensure the script is executed after the document is fully loaded
2document.addEventListener("DOMContentLoaded", function() {
3    //Ensure if pap click script is loaded if not then load here
4    if(typeof PostAffTracker == "undefined"){
5        // Create a new script element
6        var aff_pap_script = document.createElement('script');
7        // Set the src attribute to the URL of the script to load
8        aff_pap_script.src = 'https://affiliates.purevpn.com/scripts/6hj82wqa21';
9        // Set an ID for the script
10        aff_pap_script.id = 'pap_x2s6df8d';
11        // Set the onload attribute to call the trackPap function
12        aff_pap_script.onload = function() {
13            trackPap();
14        };
15        // Append the script to the document body
16        document.body.appendChild(aff_pap_script);
17    }
18    else{
19        trackPap();
20    }
21});
22
23function readCookie(name) {
24    var nameEQ = name + "=";
25    var ca = document.cookie.split(';');
26    for (var i = 0; i < ca.length; i++) {
27        var c = ca[i];
28        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
29        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
30    }
31    return null;
32}
33
34function getRegionalDomain() {
35    var vars = [], hash;
36    var hashes = window.location.host.split('.');
37    if(hashes.length > 3){
38        hashes = hashes.slice(-3);
39    } else {
40        hashes = hashes.slice(-2);
41    }
42    return hashes.join('.');
43}
44
45function getAffiliateID(){
46    const query_params = window.location.search.substr(1); // Remove the leading "?" character;
47    const affParam = query_params.split('&').find(param => param.startsWith('aff='));
48    if (affParam) {
49        return affParam.split('=')[1];
50    }
51    return null;
52}
53
54function getCampaignID(){
55    const query_params = window.location.search.substr(1); // Remove the leading "?" character;
56    const affCampId = query_params.split('&').find(param => param.startsWith('pap_campaign_id='));
57    if (affCampId) {
58        return affCampId.split('=')[1];
59    }
60    return null;
61}
62function getChannel(){
63    const query_params = window.location.search.substr(1); // Remove the leading "?" character;
64    const affChan = query_params.split('&').find(param => param.startsWith('chan='));
65    if (affChan) {
66        return affChan.split('=')[1];
67    }
68    return null;
69}
70function getData1(){
71    const query_params = window.location.search.substr(1); // Remove the leading "?" character;
72    const affdata1 = query_params.split('&').find(param => param.startsWith('data1='));
73    if (affdata1) {
74        return affdata1.split('=')[1];
75    }
76    return null;
77}
78function getData2(){
79    const query_params = window.location.search.substr(1); // Remove the leading "?" character;
80    const affdata2 = query_params.split('&').find(param => param.startsWith('data2='));
81    if (affdata2) {
82        return affdata2.split('=')[1];
83    }
84    return null;
85}
86function callApplySettingApi(){
87        var base_url = window.location.origin;
88        var iframe_apply_setting = document.createElement('iframe');
89        iframe_apply_setting.src = base_url + '/wp-json/affilliate-management/applysettings'+query_string;
90        iframe_apply_setting.style.display = 'none';
91        document.body.appendChild(iframe_apply_setting);
92}
93var AffiliateID = "";
94var Channel = "";
95var CampaignID = '11111111';
96var regional_domain = '.'+getRegionalDomain();
97var Data1 = "";
98var Data2 = "";
99var aff = "";
100var camp_id = "";
101var data1 = "";
102var data2 = "";
103var chan = "";
104var visitor_id ="";
105var data3 = "";
106var query_string = "";
107function trackPap(){
108    PostAffTracker.setAccountId('default1');
109    try {
110        aff = getAffiliateID();
111        camp_id = getCampaignID();
112        data1 = getData1();
113        data2 = getData2();
114        chan = getChannel();
115        visitor_id= readCookie('PAPVisitorId');
116        data3= readCookie('data3');
117        if (aff === null) {
118            AffiliateID = readCookie('affiliate_id');
119        }else{
120            AffiliateID = aff;
121        }
122        if (camp_id === null) {
123            CampaignID = readCookie('pap_campaign_id') || '11111111';
124        }else{
125            CampaignID = camp_id;
126        }
127        if (data1 === null) {
128            Data1 = readCookie('data1');
129        }else{
130            Data1 = data1;
131        }
132        if (data2 === null) {
133            Data2 = readCookie('data2');
134        }else{
135            Data2 = data2;
136        }
137        if (chan === null) {
138            Channel = readCookie('chan');
139        }else{
140            Channel = chan;
141        }
142
143        PostAffTracker.setCookieDomain(regional_domain);
144        PostAffTracker.track();
145        PostAffTracker.writeCookieToCustomField('PAPVisitorId', '', '', false);
146        var d = new Date();
147        d.setTime(d.getTime() + (90 * 24 * 60 * 60 * 1000));
148        var expires = "expires=" + d.toUTCString();
149        var all_query_params = window.location.search;
150        document.cookie = "PAPAffiliateId=" + AffiliateID + ";" + expires + "  ;path=/;domain="+regional_domain;
151        query_string = 'aff='+AffiliateID+'&affiliate_id='+AffiliateID+'&PAPAffiliateId='+AffiliateID;
152        if(chan !== null && !all_query_params.includes('chan=')){
153            query_string = query_string + '&chan='+Channel;
154        }
155        if(data1 !== null && !all_query_params.includes('data1=')){
156            query_string = query_string + '&data1='+Data1;
157        }
158        if(data2 !== null && !all_query_params.includes('data2=')){
159            query_string = query_string + '&data2='+Data2;
160        }
161        if(data3 !== null && !all_query_params.includes('data3=')){
162            query_string = query_string + '&data3='+data3;
163        }
164        if(CampaignID !== '11111111' && !all_query_params.includes('pap_campaign_id=')){
165            query_string = query_string + '&pap_campaign_id='+CampaignID;
166        }
167        if(all_query_params !== ''){
168            query_string = all_query_params + '&'+ query_string ;
169        }else{
170            query_string = '?'+ query_string ;
171        }
172        if(visitor_id !== null){
173            query_string = query_string+'&PAPVisitorId='+visitor_id+'&click-type=2';
174            if(query_string !== ""){
175                if(AffiliateID != null)
176                {
177                    callApplySettingApi();
178                }
179            }
180        }
181        PostAffTracker.executeOnResponceFinished.push(function () {
182            document.cookie = "newVisitorId=" + PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue() + ";" + expires + "  ;path=/;domain="+regional_domain;
183            document.cookie = "PAPVisitorId=" + PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue() + ";" + expires + "  ;path=/;domain="+regional_domain;
184
185            query_string = query_string+'&PAPVisitorId='+PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue()+'&click-type=1';
186            if(query_string !== ""){
187                if(AffiliateID != null)
188                {
189                    callApplySettingApi();
190                }
191            }
192        });
193    } catch (err) {
194    }
195}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.