update
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -389,7 +389,8 @@ if (!Array.prototype.includes) {
|
||||
PRODUCT_VARIABLE : 1,
|
||||
PRODUCT_BUNDLE : 2,
|
||||
PRODUCT_GROUPED : 3,
|
||||
|
||||
utmTerms : utmTerms,
|
||||
utmId : utmId,
|
||||
fireEventForAllPixel:function(functionName,events){
|
||||
if (events.hasOwnProperty(Facebook.tag()))
|
||||
Facebook[functionName](events[Facebook.tag()]);
|
||||
@@ -428,44 +429,137 @@ if (!Array.prototype.includes) {
|
||||
let landing = window.location.href.split('?')[0];
|
||||
try {
|
||||
// save data for first visit
|
||||
if(Cookies.get('pys_first_visit') === undefined) {
|
||||
Cookies.set('pys_first_visit', true, { expires: expires });
|
||||
Cookies.set('pysTrafficSource', getTrafficSource(), { expires: expires });
|
||||
Cookies.set('pys_landing_page',landing,{ expires: expires });
|
||||
$.each(utmTerms, function (index, name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
if(Cookies.get('pys_first_visit') === undefined && (!options.cookie.disabled_all_cookie)) {
|
||||
|
||||
if(!options.cookie.disabled_first_visit_cookie)
|
||||
{
|
||||
Cookies.set('pys_first_visit', true, { expires: expires });
|
||||
}
|
||||
else {
|
||||
Cookies.remove('pys_first_visit')
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_trafficsource_cookie)
|
||||
{
|
||||
Cookies.set('pysTrafficSource', getTrafficSource(), { expires: expires });
|
||||
}
|
||||
else {
|
||||
Cookies.remove('pysTrafficSource')
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_landing_page_cookie)
|
||||
{
|
||||
Cookies.set('pys_landing_page',landing,{ expires: expires });
|
||||
}
|
||||
else {
|
||||
Cookies.remove('pys_landing_page')
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_utmTerms_cookie)
|
||||
{
|
||||
$.each(utmTerms, function (index, name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
Cookies.remove('pys_' + name)
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.each(utmTerms, function (index, name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
}
|
||||
});
|
||||
$.each(utmId,function(index,name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
});
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_utmId_cookie)
|
||||
{
|
||||
$.each(utmId,function(index,name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
Cookies.remove('pys_' + name)
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
$.each(utmId, function (index, name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// save data for last visit if it new session
|
||||
if(isNewSession) {
|
||||
Cookies.set('last_pysTrafficSource', getTrafficSource(), { expires: expires });
|
||||
$.each(utmTerms, function (index, name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('last_pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
if(isNewSession && (!options.cookie.disabled_all_cookie)) {
|
||||
if(!options.cookie.disabled_trafficsource_cookie)
|
||||
{
|
||||
Cookies.set('last_pysTrafficSource', getTrafficSource(), { expires: expires });
|
||||
}
|
||||
else {
|
||||
Cookies.remove('last_pysTrafficSource')
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_landing_page_cookie)
|
||||
{
|
||||
Cookies.set('last_pys_landing_page',landing,{ expires: expires });
|
||||
}
|
||||
else {
|
||||
Cookies.remove('last_pys_landing_page')
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_utmTerms_cookie)
|
||||
{
|
||||
$.each(utmTerms, function (index, name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('last_pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.each(utmTerms, function (index, name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(!options.cookie.disabled_utmId_cookie)
|
||||
{
|
||||
$.each(utmId,function(index,name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('last_pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
$.each(utmId, function (index, name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if(options.cookie.disabled_all_cookie)
|
||||
{
|
||||
Cookies.remove('pys_first_visit')
|
||||
Cookies.remove('pysTrafficSource')
|
||||
Cookies.remove('pys_landing_page')
|
||||
Cookies.remove('last_pys_landing_page')
|
||||
Cookies.remove('last_pysTrafficSource')
|
||||
Cookies.remove('pys_start_session')
|
||||
Cookies.remove('pys_session_limit')
|
||||
$.each(Utils.utmTerms, function (index, name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
});
|
||||
$.each(utmId,function(index,name) {
|
||||
if (queryVars.hasOwnProperty(name)) {
|
||||
Cookies.set('last_pys_' + name, queryVars[name], { expires: expires });
|
||||
} else {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
}
|
||||
$.each(Utils.utmId,function(index,name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
})
|
||||
Cookies.set('last_pys_landing_page',landing,{ expires: expires });
|
||||
$.each(Utils.utmTerms, function (index, name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
$.each(Utils.utmId,function(index,name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -531,28 +625,31 @@ if (!Array.prototype.includes) {
|
||||
|
||||
// Non-default binding used to avoid situations when some code in external js
|
||||
// stopping events propagation, eg. returns false, and our handler will never called
|
||||
$(document).onFirst('mouseover', triggers.join(','), function () {
|
||||
document.addEventListener('mouseover', function(event) {
|
||||
var matchedElements = Array.from(document.querySelectorAll(triggers));
|
||||
if (matchedElements.includes(event.target)) {
|
||||
if (event.target.classList.contains('pys-mouse-over-' + eventId)) {
|
||||
return true;
|
||||
} else {
|
||||
event.target.classList.add('pys-mouse-over-' + eventId);
|
||||
}
|
||||
|
||||
// do not fire event multiple times
|
||||
if ($(this).hasClass('pys-mouse-over-' + eventId)) {
|
||||
return true;
|
||||
} else {
|
||||
$(this).addClass('pys-mouse-over-' + eventId);
|
||||
Utils.fireTriggerEvent(eventId);
|
||||
}
|
||||
|
||||
Utils.fireDynamicEvent(eventId);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setupCSSClickEvents: function (eventId, triggers) {
|
||||
|
||||
// Non-default binding used to avoid situations when some code in external js
|
||||
// stopping events propagation, eg. returns false, and our handler will never called
|
||||
$(document).onFirst('click', triggers.join(','), function () {
|
||||
Utils.fireTriggerEvent(eventId);
|
||||
});
|
||||
document.addEventListener('click', function(event) {
|
||||
var matchedElements = Array.from(document.querySelectorAll(triggers));
|
||||
if (matchedElements.includes(event.target)) {
|
||||
console.log(event.target)
|
||||
Utils.fireTriggerEvent(eventId);
|
||||
}
|
||||
}, true);
|
||||
},
|
||||
|
||||
setupURLClickEvents: function () {
|
||||
@@ -751,6 +848,14 @@ if (!Array.prototype.includes) {
|
||||
options.gdpr.pinterest_disabled_by_api = res.data.pinterest_disabled_by_api;
|
||||
options.gdpr.bing_disabled_by_api = res.data.bing_disabled_by_api;
|
||||
|
||||
options.cookie.externalID_disabled_by_api = res.data.externalID_disabled_by_api;
|
||||
options.cookie.disabled_all_cookie = res.data.disabled_all_cookie;
|
||||
options.cookie.disabled_advanced_form_data_cookie = res.data.disabled_advanced_form_data_cookie;
|
||||
options.cookie.disabled_landing_page_cookie = res.data.disabled_landing_page_cookie;
|
||||
options.cookie.disabled_first_visit_cookie = res.data.disabled_first_visit_cookie;
|
||||
options.cookie.disabled_trafficsource_cookie = res.data.disabled_trafficsource_cookie;
|
||||
options.cookie.disabled_utmTerms_cookie = res.data.disabled_utmTerms_cookie;
|
||||
options.cookie.disabled_utmId_cookie = res.data.disabled_utmId_cookie;
|
||||
}
|
||||
|
||||
loadPixels();
|
||||
@@ -948,8 +1053,8 @@ if (!Array.prototype.includes) {
|
||||
if(cs_cookie_val == 'yes') {
|
||||
if (categoryCookie === CS_Data.cs_script_cat.facebook) {
|
||||
Facebook.loadPixel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.bing) {
|
||||
Bing.loadPixel();
|
||||
}
|
||||
@@ -958,23 +1063,23 @@ if (!Array.prototype.includes) {
|
||||
|
||||
Analytics.loadPixel();
|
||||
}
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.pinterest) {
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.pinterest) {
|
||||
Pinterest.loadPixel();
|
||||
}
|
||||
} else {
|
||||
if (categoryCookie === CS_Data.cs_script_cat.facebook) {
|
||||
Facebook.disable();
|
||||
}
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.bing) {
|
||||
}
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.bing) {
|
||||
Bing.disable();
|
||||
}
|
||||
if (categoryCookie === CS_Data.cs_script_cat.analytics && (typeof CS_Data.cs_google_analytics_consent_mode == "undefined" || CS_Data.cs_google_analytics_consent_mode == 0)) {
|
||||
Analytics.disable();
|
||||
}
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.pinterest) {
|
||||
|
||||
if (categoryCookie === CS_Data.cs_script_cat.pinterest) {
|
||||
Pinterest.disable();
|
||||
}
|
||||
}
|
||||
@@ -1018,6 +1123,8 @@ if (!Array.prototype.includes) {
|
||||
.then(Facebook.loadPixel.bind(Facebook), Facebook.disable.bind(Facebook));
|
||||
consentApi.consent("http", "_pinterest_sess", ".pinterest.com")
|
||||
.then(Pinterest.loadPixel.bind(Pinterest), Pinterest.disable.bind(Pinterest));
|
||||
consentApi.consent("http", "_uetsid", "*")
|
||||
.then(Bing.loadPixel.bind(Bing), Bing.disable.bind(Bing));
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -1138,7 +1245,7 @@ if (!Array.prototype.includes) {
|
||||
* Enrich
|
||||
*/
|
||||
isCheckoutPage: function () {
|
||||
return $('body').hasClass('woocommerce-checkout') ||
|
||||
return $('body').hasClass('woocommerce-checkout') || document.querySelector('.woocommerce-checkout') ||
|
||||
$('body').hasClass('edd-checkout');
|
||||
},
|
||||
addCheckoutFields : function() {
|
||||
@@ -1208,6 +1315,14 @@ if (!Array.prototype.includes) {
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
getAdvancedFormData: function () {
|
||||
let dataStr = Cookies.get("pys_advanced_form_data");
|
||||
if(dataStr === undefined) {
|
||||
return {'first_name':"",'last_name':"",'email':"",'phone':""};
|
||||
} else {
|
||||
return JSON.parse(dataStr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1269,7 +1384,7 @@ if (!Array.prototype.includes) {
|
||||
// web event created by ajax from server
|
||||
}
|
||||
} else {
|
||||
if( options.facebook.ajaxForServerEvent
|
||||
if( options.ajaxForServerEvent
|
||||
|| isApiDisabled
|
||||
|| allData.delay > 0
|
||||
|| allData.type !== "static")
|
||||
@@ -1393,7 +1508,45 @@ if (!Array.prototype.includes) {
|
||||
disable: function () {
|
||||
initialized = false;
|
||||
},
|
||||
advancedMatching: function () {
|
||||
if(options.facebook.advancedMatchingEnabled) {
|
||||
let advancedMatchingForm = Utils.getAdvancedFormData();
|
||||
let advancedMatching = {};
|
||||
if(Object.keys(options.facebook.advancedMatching).length > 0) {
|
||||
advancedMatching = options.facebook.advancedMatching;
|
||||
}
|
||||
|
||||
if(!advancedMatching.hasOwnProperty("em")
|
||||
&& advancedMatchingForm.hasOwnProperty("email") && advancedMatchingForm["email"].length > 0) {
|
||||
advancedMatching["em"] = advancedMatchingForm["email"];
|
||||
}
|
||||
if(!advancedMatching.hasOwnProperty("ph")
|
||||
&& advancedMatchingForm.hasOwnProperty("phone") && advancedMatchingForm["phone"].length > 0) {
|
||||
advancedMatching["ph"] = advancedMatchingForm["phone"];
|
||||
}
|
||||
if(!advancedMatching.hasOwnProperty("fn")
|
||||
&& advancedMatchingForm.hasOwnProperty("first_name") && advancedMatchingForm["first_name"].length > 0) {
|
||||
advancedMatching["fn"] = advancedMatchingForm["first_name"];
|
||||
}
|
||||
if(!advancedMatching.hasOwnProperty("ln")
|
||||
&& advancedMatchingForm.hasOwnProperty("last_name") && advancedMatchingForm["last_name"].length > 0) {
|
||||
advancedMatching["ln"] = advancedMatchingForm["last_name"];
|
||||
}
|
||||
if(!advancedMatching.hasOwnProperty("external_id")){
|
||||
if (Cookies.get('pbid') || (options.hasOwnProperty('pbid') && options.pbid)) {
|
||||
advancedMatching["external_id"] = Cookies.get('pbid') ? Cookies.get('pbid') : options.pbid;
|
||||
}
|
||||
}
|
||||
else if(advancedMatching.external_id != Cookies.get('pbid'))
|
||||
{
|
||||
advancedMatching["external_id"] = Cookies.get('pbid') ? Cookies.get('pbid') : advancedMatching.external_id;
|
||||
}
|
||||
if(Object.keys(advancedMatching).length > 0) {
|
||||
return advancedMatching;
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
/**
|
||||
* Load pixel's JS
|
||||
*/
|
||||
@@ -1425,30 +1578,30 @@ if (!Array.prototype.includes) {
|
||||
|
||||
// initialize pixel
|
||||
options.facebook.pixelIds.forEach(function (pixelId) {
|
||||
|
||||
if (options.facebook.removeMetadata) {
|
||||
fbq('set', 'autoConfig', false, pixelId);
|
||||
}
|
||||
let advancedMatching = Facebook.advancedMatching();
|
||||
if (options.gdpr.consent_magic_integration_enabled && typeof CS_Data !== "undefined") {
|
||||
if(options.facebook.advancedMatching.length === 0) {
|
||||
if(!advancedMatching) {
|
||||
fbq('init', pixelId);
|
||||
} else {
|
||||
var cs_advanced_matching = Cookies.get('cs_enabled_advanced_matching'+test_prefix);
|
||||
if (jQuery('#cs_enabled_advanced_matching'+test_prefix).length > 0) {
|
||||
if (cs_advanced_matching == 'yes') {
|
||||
fbq('init', pixelId, options.facebook.advancedMatching);
|
||||
fbq('init', pixelId, advancedMatching);
|
||||
} else {
|
||||
fbq('init', pixelId);
|
||||
}
|
||||
} else {
|
||||
fbq('init', pixelId, options.facebook.advancedMatching);
|
||||
fbq('init', pixelId, advancedMatching);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (options.facebook.advancedMatching.length === 0) {
|
||||
if(!advancedMatching) {
|
||||
fbq('init', pixelId);
|
||||
} else {
|
||||
fbq('init', pixelId, options.facebook.advancedMatching);
|
||||
} else {
|
||||
fbq('init', pixelId, advancedMatching);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1730,6 +1883,7 @@ if (!Array.prototype.includes) {
|
||||
delete param.ecomm_prodid;
|
||||
delete param.ecomm_pagetype;
|
||||
delete param.ecomm_totalvalue;
|
||||
delete param.non_interaction;
|
||||
if(name === 'search') {
|
||||
param['search'] = param.search_term;
|
||||
delete param.search_term;
|
||||
@@ -1750,7 +1904,7 @@ if (!Array.prototype.includes) {
|
||||
let params = {
|
||||
event_category: "Key Actions",
|
||||
event_action: name,
|
||||
non_interaction: param.non_interaction,
|
||||
non_interaction: param.non_interaction,
|
||||
}
|
||||
return params;
|
||||
}
|
||||
@@ -1771,7 +1925,7 @@ if (!Array.prototype.includes) {
|
||||
event_category: "Key Actions",
|
||||
event_action: name,
|
||||
event_label: param.download_name,
|
||||
non_interaction: param.non_interaction,
|
||||
non_interaction: param.non_interaction,
|
||||
}
|
||||
return params;
|
||||
}
|
||||
@@ -1781,7 +1935,7 @@ if (!Array.prototype.includes) {
|
||||
event_category: "Key Actions",
|
||||
event_action: name,
|
||||
event_label: document.title,
|
||||
non_interaction: param.non_interaction,
|
||||
non_interaction: param.non_interaction,
|
||||
}
|
||||
return params;
|
||||
}
|
||||
@@ -1790,7 +1944,7 @@ if (!Array.prototype.includes) {
|
||||
event_category: "Key Actions",
|
||||
event_action: name,
|
||||
event_label: param.search_term,
|
||||
non_interaction: param.non_interaction,
|
||||
non_interaction: param.non_interaction,
|
||||
}
|
||||
return params;
|
||||
}
|
||||
@@ -1853,7 +2007,20 @@ if (!Array.prototype.includes) {
|
||||
|
||||
// configure tracking ids
|
||||
options.ga.trackingIds.forEach(function (trackingId,index) {
|
||||
config.debug_mode = options.ga.isDebugEnabled.includes("index_" + index);
|
||||
var obj = options.ga.isDebugEnabled;
|
||||
var searchValue = "index_"+index;
|
||||
config.debug_mode = false;
|
||||
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key) && obj[key] === searchValue) {
|
||||
config.debug_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!config.debug_mode)
|
||||
{
|
||||
delete config.debug_mode;
|
||||
}
|
||||
if(isv4(trackingId)) {
|
||||
if(options.ga.disableAdvertisingFeatures) {
|
||||
config.allow_google_signals = false
|
||||
@@ -2089,33 +2256,53 @@ if (!Array.prototype.includes) {
|
||||
var Pinterest = Utils.setupPinterestObject();
|
||||
var Bing = Utils.setupBingObject();
|
||||
|
||||
if((options.woo.enabled || options.edd.enabled) && (options.woo.enabled_save_data_to_orders || options.edd.enabled_save_data_to_orders))
|
||||
if(options.hasOwnProperty('cookie'))
|
||||
{
|
||||
Utils.manageCookies();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cookies.remove('pys_first_visit')
|
||||
Cookies.remove('pysTrafficSource')
|
||||
Cookies.remove('pys_landing_page')
|
||||
Cookies.remove('last_pys_landing_page')
|
||||
Cookies.remove('last_pysTrafficSource')
|
||||
Cookies.remove('pys_start_session')
|
||||
Cookies.remove('pys_session_limit')
|
||||
if(options.cookie.externalID_disabled_by_api || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
Cookies.remove('pbid')
|
||||
}
|
||||
if(options.cookie.disabled_advanced_form_data_cookie || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
Cookies.remove('pys_advanced_form_data')
|
||||
}
|
||||
if(options.cookie.disabled_landing_page_cookie || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
Cookies.remove('pys_landing_page')
|
||||
Cookies.remove('last_pys_landing_page')
|
||||
}
|
||||
if(options.cookie.disabled_trafficsource_cookie || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
Cookies.remove('pysTrafficSource')
|
||||
Cookies.remove('last_pysTrafficSource')
|
||||
}
|
||||
if(options.cookie.disabled_first_visit_cookie || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
Cookies.remove('pys_first_visit')
|
||||
|
||||
$.each(Utils.utmTerms, function (index, name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
});
|
||||
$.each(Utils.utmId,function(index,name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
})
|
||||
$.each(Utils.utmTerms, function (index, name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
$.each(Utils.utmId,function(index,name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
}
|
||||
if(options.cookie.disabled_utmTerms_cookie || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
$.each(Utils.utmTerms, function (index, name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
});
|
||||
$.each(Utils.utmTerms, function (index, name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
}
|
||||
if(options.cookie.disabled_utmId_cookie || options.cookie.disabled_all_cookie)
|
||||
{
|
||||
$.each(Utils.utmId,function(index,name) {
|
||||
Cookies.remove('pys_' + name)
|
||||
})
|
||||
$.each(Utils.utmId,function(index,name) {
|
||||
Cookies.remove('last_pys_' + name)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Utils.manageCookies();
|
||||
Utils.setupGdprCallbacks();
|
||||
// page scroll event
|
||||
if ( options.dynamicEvents.hasOwnProperty("automatic_event_scroll")
|
||||
@@ -2622,7 +2809,24 @@ if (!Array.prototype.includes) {
|
||||
}
|
||||
|
||||
}(jQuery, pysOptions);
|
||||
|
||||
if (pysOptions.ajaxForServerEvent && !Cookies.get('pbid')) {
|
||||
jQuery.ajax({
|
||||
url: pysOptions.ajaxUrl,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'pys_get_pbid'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.data && res.data.pbid != false && pysOptions.send_external_id) {
|
||||
var expires = parseInt(pysOptions.external_id_expire || 180);
|
||||
Cookies.set('pbid', res.data.pbid, { expires: expires, path: '/' });
|
||||
if(pysOptions.hasOwnProperty('facebook')) {
|
||||
pysOptions.facebook.advancedMatching.external_id = res.data.pbid;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function pys_generate_token(length){
|
||||
//edit the token allowed characters
|
||||
var a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".split("");
|
||||
|
||||
Reference in New Issue
Block a user