PageSourceSearch

https://www.todopatuweb.net/wp-content/plugins/solid_affiliate/assets/js/visits.js?ver=11.7.2

js todopatuweb.net collected 2026-09-25 22:55:19 UTC 3,461 bytes, 105 lines download raw bytes

1///////////////////////////////////////////////////////////
2// Solid Affiliate v1.2.0
3// SolidAffiliate JS
4window.SolidAffiliate = {
5  ajaxurl: sld_affiliate_js_variables.ajaxurl,
6  affiliate_param: sld_affiliate_js_variables.affiliate_param,
7  visit_cookie_key: sld_affiliate_js_variables.visit_cookie_key,
8  visit_cookie_expiration_in_days:
9    sld_affiliate_js_variables.visit_cookie_expiration_in_days,
10  is_landing_pages_enabled: sld_affiliate_js_variables.landing_pages.is_landing_pages_enabled,
11  is_home_page_a_landing_page: sld_affiliate_js_variables.landing_pages.is_home_page_a_landing_page,
12  is_cookies_disabled: sld_affiliate_js_variables.is_cookies_disabled,
13
14  get_affiliate_slug_from_url: function () {
15    var url = window.location.href;
16    var affiliate_param = this.affiliate_param;
17
18    var url_string = window.location.href;
19    var url = new URL(url_string);
20    return url.searchParams.get(affiliate_param);
21  },
22
23  maybe_track_visit: function () {
24    maybe_affiliate_slug = this.get_affiliate_slug_from_url();
25
26    // Does query variable exist in url?
27    is_slug_missing_from_url = (maybe_affiliate_slug == null || maybe_affiliate_slug == "");
28
29    // check if current url is the home directory
30    is_currently_on_home_page = (window.location.pathname == "/")
31
32    if (this.is_cookies_disabled) {
33      return;
34    } 
35
36    if (this.getCookie(this.visit_cookie_key) != null) {
37      return;
38    } else if (is_slug_missing_from_url && !this.is_landing_pages_enabled) {
39      return;
40    } else if (is_slug_missing_from_url && this.is_landing_pages_enabled && (!this.is_home_page_a_landing_page && is_currently_on_home_page)) {
41      return;
42    } else {
43      var data = {
44        action: "sld_affiliate_track_visit", // wp ajax action
45        affiliate_slug: maybe_affiliate_slug,
46        landing_url: window.location.href,
47        http_referer: document.referrer,
48        visit_ip: "",
49        previous_visit_id: 0,
50      };
51
52      jQuery.ajax({
53        url: this.ajaxurl, // this will point to admin-ajax.php
54        type: "POST",
55        data: data,
56        success: function (response) {
57          if (response["success"] && response["data"]["created_visit_id"]) {
58            SolidAffiliate.setCookie(
59              SolidAffiliate.visit_cookie_key,
60              parseInt(response["data"]["visit_id"]),
61              SolidAffiliate.visit_cookie_expiration_in_days
62            );
63          }
64        },
65      });
66    }
67  },
68
69  setCookie: function (name, value, days) {
70    if (this.is_cookies_disabled) {
71      return;
72    }
73    var expires = "";
74    if (days) {
75      var date = new Date();
76      date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
77      expires = "; expires=" + date.toUTCString();
78    }
79    document.cookie = name + "=" + (value || "") + expires + "; path=/";
80  },
81
82  getCookie: function (name) {
83    var nameEQ = name + "=";
84    var ca = document.cookie.split(";");
85    for (var i = 0; i < ca.length; i++) {
86      var c = ca[i];
87      while (c.charAt(0) == " ") c = c.substring(1, c.length);
88      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
89    }
90    return null;
91  },
92
93  eraseCookie: function (name) {
94    document.cookie =
95      name + "=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
96  },
97};
98
99jQuery(window).on("load", function () {
100  if (window.SolidAffiliate && window.SolidAffiliate.maybe_track_visit) {
101    window.SolidAffiliate.maybe_track_visit();
102  }
103});
104
105

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.