Pixel Caffeine - Version 2.3.2

Version Description

  • 2021-03-16 =
  • Add - Option to enable server-side tracking through AJAX in order to resolve issues with cache systems (server and/or third-party plugins)
  • Enhancement - Avoid to pass eventID if server-side tracking is disabled
  • Update - Facebook API SDK to v10
Download this release

Release Info

Developer antoscarface
Plugin Icon 128x128 Pixel Caffeine
Version 2.3.2
Comparing to
See all releases

Code changes from version 2.3.1 to 2.3.2

build/frontend.js CHANGED
@@ -1 +1 @@
1
- !function(){var t={1989:function(t,n,e){var r=e(1789),o=e(401),c=e(7667),a=e(1327),i=e(1866);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=c,u.prototype.has=a,u.prototype.set=i,t.exports=u},8407:function(t,n,e){var r=e(7040),o=e(4125),c=e(2117),a=e(7518),i=e(4705);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=c,u.prototype.has=a,u.prototype.set=i,t.exports=u},7071:function(t,n,e){var r=e(852)(e(5639),"Map");t.exports=r},3369:function(t,n,e){var r=e(4785),o=e(1285),c=e(6e3),a=e(9916),i=e(5265);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=c,u.prototype.has=a,u.prototype.set=i,t.exports=u},2705:function(t,n,e){var r=e(5639).Symbol;t.exports=r},6874:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},9932:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},2488:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},4865:function(t,n,e){var r=e(9465),o=e(7813),c=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var a=t[n];c.call(t,n)&&o(a,e)&&(void 0!==e||n in t)||r(t,n,e)}},8470:function(t,n,e){var r=e(7813);t.exports=function(t,n){for(var e=t.length;e--;)if(r(t[e][0],n))return e;return-1}},9465:function(t,n,e){var r=e(8777);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},1078:function(t,n,e){var r=e(2488),o=e(7285);t.exports=function t(n,e,c,a,i){var u=-1,s=n.length;for(c||(c=o),i||(i=[]);++u<s;){var f=n[u];e>0&&c(f)?e>1?t(f,e-1,c,a,i):r(i,f):a||(i[i.length]=f)}return i}},7786:function(t,n,e){var r=e(1811),o=e(327);t.exports=function(t,n){for(var e=0,c=(n=r(n,t)).length;null!=t&&e<c;)t=t[o(n[e++])];return e&&e==c?t:void 0}},4239:function(t,n,e){var r=e(2705),o=e(9607),c=e(2333),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):c(t)}},13:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},9454:function(t,n,e){var r=e(4239),o=e(7005);t.exports=function(t){return o(t)&&"[object Arguments]"==r(t)}},8458:function(t,n,e){var r=e(3560),o=e(5346),c=e(3218),a=e(346),i=/^\[object .+?Constructor\]$/,u=Function.prototype,s=Object.prototype,f=u.toString,p=s.hasOwnProperty,l=RegExp("^"+f.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!c(t)||o(t))&&(r(t)?l:i).test(a(t))}},5970:function(t,n,e){var r=e(3012),o=e(9095);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},3012:function(t,n,e){var r=e(7786),o=e(611),c=e(1811);t.exports=function(t,n,e){for(var a=-1,i=n.length,u={};++a<i;){var s=n[a],f=r(t,s);e(f,s)&&o(u,c(s,t),f)}return u}},611:function(t,n,e){var r=e(4865),o=e(1811),c=e(5776),a=e(3218),i=e(327);t.exports=function(t,n,e,u){if(!a(t))return t;for(var s=-1,f=(n=o(n,t)).length,p=f-1,l=t;null!=l&&++s<f;){var v=i(n[s]),d=e;if(s!=p){var _=l[v];void 0===(d=u?u(_,v,l):void 0)&&(d=a(_)?_:c(n[s+1])?[]:{})}r(l,v,d),l=l[v]}return t}},6560:function(t,n,e){var r=e(5703),o=e(8777),c=e(6557),a=o?function(t,n){return o(t,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:c;t.exports=a},531:function(t,n,e){var r=e(2705),o=e(9932),c=e(1469),a=e(3448),i=r?r.prototype:void 0,u=i?i.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(c(n))return o(n,t)+"";if(a(n))return u?u.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},1811:function(t,n,e){var r=e(1469),o=e(5403),c=e(5514),a=e(9833);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:c(a(t))}},4429:function(t,n,e){var r=e(5639)["__core-js_shared__"];t.exports=r},8777:function(t,n,e){var r=e(852),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},9021:function(t,n,e){var r=e(5564),o=e(5357),c=e(61);t.exports=function(t){return c(o(t,void 0,r),t+"")}},1957:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},5050:function(t,n,e){var r=e(7019);t.exports=function(t,n){var e=t.__data__;return r(n)?e["string"==typeof n?"string":"hash"]:e.map}},852:function(t,n,e){var r=e(8458),o=e(7801);t.exports=function(t,n){var e=o(t,n);return r(e)?e:void 0}},9607:function(t,n,e){var r=e(2705),o=Object.prototype,c=o.hasOwnProperty,a=o.toString,i=r?r.toStringTag:void 0;t.exports=function(t){var n=c.call(t,i),e=t[i];try{t[i]=void 0;var r=!0}catch(t){}var o=a.call(t);return r&&(n?t[i]=e:delete t[i]),o}},7801:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},222:function(t,n,e){var r=e(1811),o=e(5694),c=e(1469),a=e(5776),i=e(1780),u=e(327);t.exports=function(t,n,e){for(var s=-1,f=(n=r(n,t)).length,p=!1;++s<f;){var l=u(n[s]);if(!(p=null!=t&&e(t,l)))break;t=t[l]}return p||++s!=f?p:!!(f=null==t?0:t.length)&&i(f)&&a(l,f)&&(c(t)||o(t))}},1789:function(t,n,e){var r=e(4536);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},401:function(t){t.exports=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}},7667:function(t,n,e){var r=e(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var n=this.__data__;if(r){var e=n[t];return"__lodash_hash_undefined__"===e?void 0:e}return o.call(n,t)?n[t]:void 0}},1327:function(t,n,e){var r=e(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var n=this.__data__;return r?void 0!==n[t]:o.call(n,t)}},1866:function(t,n,e){var r=e(4536);t.exports=function(t,n){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=r&&void 0===n?"__lodash_hash_undefined__":n,this}},7285:function(t,n,e){var r=e(2705),o=e(5694),c=e(1469),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return c(t)||o(t)||!!(a&&t&&t[a])}},5776:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},5403:function(t,n,e){var r=e(1469),o=e(3448),c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||a.test(t)||!c.test(t)||null!=n&&t in Object(n)}},7019:function(t){t.exports=function(t){var n=typeof t;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==t:null===t}},5346:function(t,n,e){var r,o=e(4429),c=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!c&&c in t}},7040:function(t){t.exports=function(){this.__data__=[],this.size=0}},4125:function(t,n,e){var r=e(8470),o=Array.prototype.splice;t.exports=function(t){var n=this.__data__,e=r(n,t);return!(e<0||(e==n.length-1?n.pop():o.call(n,e,1),--this.size,0))}},2117:function(t,n,e){var r=e(8470);t.exports=function(t){var n=this.__data__,e=r(n,t);return e<0?void 0:n[e][1]}},7518:function(t,n,e){var r=e(8470);t.exports=function(t){return r(this.__data__,t)>-1}},4705:function(t,n,e){var r=e(8470);t.exports=function(t,n){var e=this.__data__,o=r(e,t);return o<0?(++this.size,e.push([t,n])):e[o][1]=n,this}},4785:function(t,n,e){var r=e(1989),o=e(8407),c=e(7071);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(c||o),string:new r}}},1285:function(t,n,e){var r=e(5050);t.exports=function(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}},6e3:function(t,n,e){var r=e(5050);t.exports=function(t){return r(this,t).get(t)}},9916:function(t,n,e){var r=e(5050);t.exports=function(t){return r(this,t).has(t)}},5265:function(t,n,e){var r=e(5050);t.exports=function(t,n){var e=r(this,t),o=e.size;return e.set(t,n),this.size+=e.size==o?0:1,this}},4523:function(t,n,e){var r=e(8306);t.exports=function(t){var n=r(t,(function(t){return 500===e.size&&e.clear(),t})),e=n.cache;return n}},4536:function(t,n,e){var r=e(852)(Object,"create");t.exports=r},2333:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},5357:function(t,n,e){var r=e(6874),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var c=arguments,a=-1,i=o(c.length-n,0),u=Array(i);++a<i;)u[a]=c[n+a];a=-1;for(var s=Array(n+1);++a<n;)s[a]=c[a];return s[n]=e(u),r(t,this,s)}}},5639:function(t,n,e){var r=e(1957),o="object"==typeof self&&self&&self.Object===Object&&self,c=r||o||Function("return this")();t.exports=c},61:function(t,n,e){var r=e(6560),o=e(1275)(r);t.exports=o},1275:function(t){var n=Date.now;t.exports=function(t){var e=0,r=0;return function(){var o=n(),c=16-(o-r);if(r=o,c>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},5514:function(t,n,e){var r=e(4523),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,a=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(c,"$1"):e||t)})),n}));t.exports=a},327:function(t,n,e){var r=e(3448);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},346:function(t){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},5703:function(t){t.exports=function(t){return function(){return t}}},7813:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},5564:function(t,n,e){var r=e(1078);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},9095:function(t,n,e){var r=e(13),o=e(222);t.exports=function(t,n){return null!=t&&o(t,n,r)}},6557:function(t){t.exports=function(t){return t}},5694:function(t,n,e){var r=e(9454),o=e(7005),c=Object.prototype,a=c.hasOwnProperty,i=c.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&a.call(t,"callee")&&!i.call(t,"callee")};t.exports=u},1469:function(t){var n=Array.isArray;t.exports=n},3560:function(t,n,e){var r=e(4239),o=e(3218);t.exports=function(t){if(!o(t))return!1;var n=r(t);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}},1780:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},3218:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},7005:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},3448:function(t,n,e){var r=e(4239),o=e(7005);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},8306:function(t,n,e){var r=e(3369);function o(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var e=function(){var r=arguments,o=n?n.apply(this,r):r[0],c=e.cache;if(c.has(o))return c.get(o);var a=t.apply(this,r);return e.cache=c.set(o,a)||c,a};return e.cache=new(o.Cache||r),e}o.Cache=r,t.exports=o},8718:function(t,n,e){var r=e(5970),o=e(9021)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},9833:function(t,n,e){var r=e(531);t.exports=function(t){return null==t?"":r(t)}},3609:function(t){"use strict";t.exports=jQuery}},n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{}};return t[r](o,o.exports,e),o.exports}e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},e.d=function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},function(){"use strict";var t=function t(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];var o;window.fbq?(o=window).fbq.apply(o,e):setTimeout((function(){return t.apply(void 0,e)}),500)},n=e(8718),r=e.n(n);e(3609)(document).ready((function(n){n(document.body);var e=function(t){return aepc_extend_args(t)},o=function(t,n){n?setTimeout(t,1e3*n):t()};aepc_pixel_events.standard_events&&n.each(aepc_pixel_events.standard_events,(function(r,c){n.each(c,(function(n,c){o((function(){t("track",r,e(c.params?c.params:{}),c.event_id?{eventID:c.event_id}:{})}),c.delay)}))})),void 0!==aepc_pixel_events.custom_events&&n.each(aepc_pixel_events.custom_events,(function(r,c){n.each(c,(function(n,c){o((function(){t("trackCustom",r,e(c.params?c.params:{}),c.event_id?{eventID:c.event_id}:{})}),c.delay)}))})),void 0!==aepc_pixel_events.css_events&&n.each(aepc_pixel_events.css_events,(function(r,o){n.each(o,(function(o,c){n(r).on("click",(function(){t(c.trackType,c.trackName,e(c.trackParams))}))}))})),void 0!==aepc_pixel_events.link_clicks&&n.each(aepc_pixel_events.link_clicks,(function(r,o){n.each(o,(function(o,c){n("a").filter((function(){var t=n(this).attr("href");if(void 0===t)return!1;if("contains"===o)return t.match(new RegExp(r.replace(/\*/g,"[^/]+").replace(/([./?])/gm,"\\$1")));if("exact"===o){var e=r+(r.match(/\/+$/)?"":"/");return e.match(/^http(s)?:\/\//)||(e="/"+e.replace(/^\/+/,""),e=window.location.protocol+"//"+window.location.host+e),(t+=t.match(/\/+$/)?"":"/").match(/^http(s)?:\/\//)||(t="/"+t.replace(/^\/+/,""),t=window.location.protocol+"//"+window.location.host+t),e===t}return!1})).on("click",(function(r){n.each(c,(function(n,r){t(r.trackType,r.trackName,e(r.trackParams))}))}))}))})),void 0!==aepc_pixel_events.js_events&&n.each(aepc_pixel_events.js_events,(function(r,o){n.each(o,(function(o,c){n(r).on(o,(function(){n.each(c,(function(n,r){t(r.trackType,r.trackName,e(r.trackParams))}))}))}))})),n(document.body).on("added_to_cart",(function(n,o,c,a){if("no"===aepc_pixel.enable_addtocart)return n;var i=a.closest(".product, .wc-block-grid__product"),u="yes"===aepc_pixel.can_use_sku&&a.data("product_sku")?a.data("product_sku"):a.data("product_id"),s=i.find('input[name="quantity"]').length?i.find('input[name="quantity"]').val():1;t("track","AddToCart",e(r()({content_ids:[u],content_type:"product",content_name:i.find("h3, .woocommerce-loop-product__title, .wc-block-grid__product-title").text(),content_category:i.find("span[data-content_category]").data("content_category"),value:parseFloat(i.find("span.amount:last, span.amount:last bdi").clone().children().remove().end().text())*s,currency:woocommerce_params.currency},aepc_pixel.allowed_params.AddToCart)),{eventID:c})})),n(".add_to_wishlist, .wl-add-to").on("click",(function(r){if("no"===aepc_pixel.enable_wishlist)return r;var o=n(this),c=o.data("product-sku")?o.data("product-sku"):o.data("product-id");t("track","AddToWishlist",e(aepc_wc_add_to_wishlist[c]))})),n("body.woocommerce-page form.checkout").on("checkout_place_order",(function(n){"yes"===aepc_pixel.enable_addpaymentinfo&&t("track","AddPaymentInfo",e(aepc_add_payment_info_params))})),n(document.body).on("edd_cart_item_added",(function(n,r){var o=r.pixel;if("no"===aepc_pixel.enable_addtocart)return n;t("track","AddToCart",e(o.params?o.params:{}),o.event_id?{eventID:o.event_id}:{})})),n(".edd-checkout").on("click",'form#edd_purchase_form input[type="submit"]',(function(n){return"no"===aepc_pixel.enable_addpaymentinfo?n:(t("track","AddPaymentInfo",e(aepc_add_payment_info_params)),!0)}))}))}()}();
1
+ !function(){var t={1989:function(t,n,e){var r=e(1789),o=e(401),a=e(7667),c=e(1327),i=e(1866);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=c,u.prototype.set=i,t.exports=u},8407:function(t,n,e){var r=e(7040),o=e(4125),a=e(2117),c=e(7518),i=e(4705);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=c,u.prototype.set=i,t.exports=u},7071:function(t,n,e){var r=e(852)(e(5639),"Map");t.exports=r},3369:function(t,n,e){var r=e(4785),o=e(1285),a=e(6e3),c=e(9916),i=e(5265);function u(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=c,u.prototype.set=i,t.exports=u},2705:function(t,n,e){var r=e(5639).Symbol;t.exports=r},6874:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},9932:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},2488:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},4865:function(t,n,e){var r=e(9465),o=e(7813),a=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var c=t[n];a.call(t,n)&&o(c,e)&&(void 0!==e||n in t)||r(t,n,e)}},8470:function(t,n,e){var r=e(7813);t.exports=function(t,n){for(var e=t.length;e--;)if(r(t[e][0],n))return e;return-1}},9465:function(t,n,e){var r=e(8777);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},1078:function(t,n,e){var r=e(2488),o=e(7285);t.exports=function t(n,e,a,c,i){var u=-1,s=n.length;for(a||(a=o),i||(i=[]);++u<s;){var p=n[u];e>0&&a(p)?e>1?t(p,e-1,a,c,i):r(i,p):c||(i[i.length]=p)}return i}},7786:function(t,n,e){var r=e(1811),o=e(327);t.exports=function(t,n){for(var e=0,a=(n=r(n,t)).length;null!=t&&e<a;)t=t[o(n[e++])];return e&&e==a?t:void 0}},4239:function(t,n,e){var r=e(2705),o=e(9607),a=e(2333),c=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":c&&c in Object(t)?o(t):a(t)}},13:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},9454:function(t,n,e){var r=e(4239),o=e(7005);t.exports=function(t){return o(t)&&"[object Arguments]"==r(t)}},8458:function(t,n,e){var r=e(3560),o=e(5346),a=e(3218),c=e(346),i=/^\[object .+?Constructor\]$/,u=Function.prototype,s=Object.prototype,p=u.toString,f=s.hasOwnProperty,l=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!a(t)||o(t))&&(r(t)?l:i).test(c(t))}},5970:function(t,n,e){var r=e(3012),o=e(9095);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},3012:function(t,n,e){var r=e(7786),o=e(611),a=e(1811);t.exports=function(t,n,e){for(var c=-1,i=n.length,u={};++c<i;){var s=n[c],p=r(t,s);e(p,s)&&o(u,a(s,t),p)}return u}},611:function(t,n,e){var r=e(4865),o=e(1811),a=e(5776),c=e(3218),i=e(327);t.exports=function(t,n,e,u){if(!c(t))return t;for(var s=-1,p=(n=o(n,t)).length,f=p-1,l=t;null!=l&&++s<p;){var v=i(n[s]),d=e;if(s!=f){var _=l[v];void 0===(d=u?u(_,v,l):void 0)&&(d=c(_)?_:a(n[s+1])?[]:{})}r(l,v,d),l=l[v]}return t}},6560:function(t,n,e){var r=e(5703),o=e(8777),a=e(6557),c=o?function(t,n){return o(t,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:a;t.exports=c},531:function(t,n,e){var r=e(2705),o=e(9932),a=e(1469),c=e(3448),i=r?r.prototype:void 0,u=i?i.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(a(n))return o(n,t)+"";if(c(n))return u?u.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},1811:function(t,n,e){var r=e(1469),o=e(5403),a=e(5514),c=e(9833);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:a(c(t))}},4429:function(t,n,e){var r=e(5639)["__core-js_shared__"];t.exports=r},8777:function(t,n,e){var r=e(852),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},9021:function(t,n,e){var r=e(5564),o=e(5357),a=e(61);t.exports=function(t){return a(o(t,void 0,r),t+"")}},1957:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},5050:function(t,n,e){var r=e(7019);t.exports=function(t,n){var e=t.__data__;return r(n)?e["string"==typeof n?"string":"hash"]:e.map}},852:function(t,n,e){var r=e(8458),o=e(7801);t.exports=function(t,n){var e=o(t,n);return r(e)?e:void 0}},9607:function(t,n,e){var r=e(2705),o=Object.prototype,a=o.hasOwnProperty,c=o.toString,i=r?r.toStringTag:void 0;t.exports=function(t){var n=a.call(t,i),e=t[i];try{t[i]=void 0;var r=!0}catch(t){}var o=c.call(t);return r&&(n?t[i]=e:delete t[i]),o}},7801:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},222:function(t,n,e){var r=e(1811),o=e(5694),a=e(1469),c=e(5776),i=e(1780),u=e(327);t.exports=function(t,n,e){for(var s=-1,p=(n=r(n,t)).length,f=!1;++s<p;){var l=u(n[s]);if(!(f=null!=t&&e(t,l)))break;t=t[l]}return f||++s!=p?f:!!(p=null==t?0:t.length)&&i(p)&&c(l,p)&&(a(t)||o(t))}},1789:function(t,n,e){var r=e(4536);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},401:function(t){t.exports=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}},7667:function(t,n,e){var r=e(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var n=this.__data__;if(r){var e=n[t];return"__lodash_hash_undefined__"===e?void 0:e}return o.call(n,t)?n[t]:void 0}},1327:function(t,n,e){var r=e(4536),o=Object.prototype.hasOwnProperty;t.exports=function(t){var n=this.__data__;return r?void 0!==n[t]:o.call(n,t)}},1866:function(t,n,e){var r=e(4536);t.exports=function(t,n){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=r&&void 0===n?"__lodash_hash_undefined__":n,this}},7285:function(t,n,e){var r=e(2705),o=e(5694),a=e(1469),c=r?r.isConcatSpreadable:void 0;t.exports=function(t){return a(t)||o(t)||!!(c&&t&&t[c])}},5776:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},5403:function(t,n,e){var r=e(1469),o=e(3448),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||c.test(t)||!a.test(t)||null!=n&&t in Object(n)}},7019:function(t){t.exports=function(t){var n=typeof t;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==t:null===t}},5346:function(t,n,e){var r,o=e(4429),a=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!a&&a in t}},7040:function(t){t.exports=function(){this.__data__=[],this.size=0}},4125:function(t,n,e){var r=e(8470),o=Array.prototype.splice;t.exports=function(t){var n=this.__data__,e=r(n,t);return!(e<0||(e==n.length-1?n.pop():o.call(n,e,1),--this.size,0))}},2117:function(t,n,e){var r=e(8470);t.exports=function(t){var n=this.__data__,e=r(n,t);return e<0?void 0:n[e][1]}},7518:function(t,n,e){var r=e(8470);t.exports=function(t){return r(this.__data__,t)>-1}},4705:function(t,n,e){var r=e(8470);t.exports=function(t,n){var e=this.__data__,o=r(e,t);return o<0?(++this.size,e.push([t,n])):e[o][1]=n,this}},4785:function(t,n,e){var r=e(1989),o=e(8407),a=e(7071);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(a||o),string:new r}}},1285:function(t,n,e){var r=e(5050);t.exports=function(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}},6e3:function(t,n,e){var r=e(5050);t.exports=function(t){return r(this,t).get(t)}},9916:function(t,n,e){var r=e(5050);t.exports=function(t){return r(this,t).has(t)}},5265:function(t,n,e){var r=e(5050);t.exports=function(t,n){var e=r(this,t),o=e.size;return e.set(t,n),this.size+=e.size==o?0:1,this}},4523:function(t,n,e){var r=e(8306);t.exports=function(t){var n=r(t,(function(t){return 500===e.size&&e.clear(),t})),e=n.cache;return n}},4536:function(t,n,e){var r=e(852)(Object,"create");t.exports=r},2333:function(t){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},5357:function(t,n,e){var r=e(6874),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var a=arguments,c=-1,i=o(a.length-n,0),u=Array(i);++c<i;)u[c]=a[n+c];c=-1;for(var s=Array(n+1);++c<n;)s[c]=a[c];return s[n]=e(u),r(t,this,s)}}},5639:function(t,n,e){var r=e(1957),o="object"==typeof self&&self&&self.Object===Object&&self,a=r||o||Function("return this")();t.exports=a},61:function(t,n,e){var r=e(6560),o=e(1275)(r);t.exports=o},1275:function(t){var n=Date.now;t.exports=function(t){var e=0,r=0;return function(){var o=n(),a=16-(o-r);if(r=o,a>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},5514:function(t,n,e){var r=e(4523),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,c=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(a,"$1"):e||t)})),n}));t.exports=c},327:function(t,n,e){var r=e(3448);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},346:function(t){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},5703:function(t){t.exports=function(t){return function(){return t}}},7813:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},5564:function(t,n,e){var r=e(1078);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},9095:function(t,n,e){var r=e(13),o=e(222);t.exports=function(t,n){return null!=t&&o(t,n,r)}},6557:function(t){t.exports=function(t){return t}},5694:function(t,n,e){var r=e(9454),o=e(7005),a=Object.prototype,c=a.hasOwnProperty,i=a.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&c.call(t,"callee")&&!i.call(t,"callee")};t.exports=u},1469:function(t){var n=Array.isArray;t.exports=n},3560:function(t,n,e){var r=e(4239),o=e(3218);t.exports=function(t){if(!o(t))return!1;var n=r(t);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}},1780:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},3218:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},7005:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},3448:function(t,n,e){var r=e(4239),o=e(7005);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},8306:function(t,n,e){var r=e(3369);function o(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var e=function(){var r=arguments,o=n?n.apply(this,r):r[0],a=e.cache;if(a.has(o))return a.get(o);var c=t.apply(this,r);return e.cache=a.set(o,c)||a,c};return e.cache=new(o.Cache||r),e}o.Cache=r,t.exports=o},8718:function(t,n,e){var r=e(5970),o=e(9021)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},9833:function(t,n,e){var r=e(531);t.exports=function(t){return null==t?"":r(t)}},3609:function(t){"use strict";t.exports=jQuery}},n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{}};return t[r](o,o.exports,e),o.exports}e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},e.d=function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},function(){"use strict";var t=e(3609),n=e.n(t),r=function t(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];var a;window.fbq?((a=window).fbq.apply(a,r),aepc_pixel_events.ss_in_ajax&&n().ajax({url:aepc_pixel_events.api.root+"aepc/v1/fbq",method:"POST",dataType:"json",beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",aepc_pixel_events.api.nonce)},data:{query:r}})):setTimeout((function(){return t.apply(void 0,r)}),500)},o=e(8718),a=e.n(o);e(3609)(document).ready((function(t){t(document.body);var n=function(t){return aepc_extend_args(t)},e=function(t,n){n?setTimeout(t,1e3*n):t()};aepc_pixel_events.standard_events&&t.each(aepc_pixel_events.standard_events,(function(o,a){t.each(a,(function(t,a){e((function(){r("track",o,n(a.params?a.params:{}),a.event_id?{eventID:a.event_id}:{})}),a.delay)}))})),void 0!==aepc_pixel_events.custom_events&&t.each(aepc_pixel_events.custom_events,(function(o,a){t.each(a,(function(t,a){e((function(){r("trackCustom",o,n(a.params?a.params:{}),a.event_id?{eventID:a.event_id}:{})}),a.delay)}))})),void 0!==aepc_pixel_events.css_events&&t.each(aepc_pixel_events.css_events,(function(e,o){t.each(o,(function(o,a){t(e).on("click",(function(){r(a.trackType,a.trackName,n(a.trackParams))}))}))})),void 0!==aepc_pixel_events.link_clicks&&t.each(aepc_pixel_events.link_clicks,(function(e,o){t.each(o,(function(o,a){t("a").filter((function(){var n=t(this).attr("href");if(void 0===n)return!1;if("contains"===o)return n.match(new RegExp(e.replace(/\*/g,"[^/]+").replace(/([./?])/gm,"\\$1")));if("exact"===o){var r=e+(e.match(/\/+$/)?"":"/");return r.match(/^http(s)?:\/\//)||(r="/"+r.replace(/^\/+/,""),r=window.location.protocol+"//"+window.location.host+r),(n+=n.match(/\/+$/)?"":"/").match(/^http(s)?:\/\//)||(n="/"+n.replace(/^\/+/,""),n=window.location.protocol+"//"+window.location.host+n),r===n}return!1})).on("click",(function(e){t.each(a,(function(t,e){r(e.trackType,e.trackName,n(e.trackParams))}))}))}))})),void 0!==aepc_pixel_events.js_events&&t.each(aepc_pixel_events.js_events,(function(e,o){t.each(o,(function(o,a){t(e).on(o,(function(){t.each(a,(function(t,e){r(e.trackType,e.trackName,n(e.trackParams))}))}))}))})),t(document.body).on("added_to_cart",(function(t,e,o,c){if("no"===aepc_pixel.enable_addtocart)return t;var i=c.closest(".product, .wc-block-grid__product"),u="yes"===aepc_pixel.can_use_sku&&c.data("product_sku")?c.data("product_sku"):c.data("product_id"),s=i.find('input[name="quantity"]').length?i.find('input[name="quantity"]').val():1;r("track","AddToCart",n(a()({content_ids:[u],content_type:"product",content_name:i.find("h3, .woocommerce-loop-product__title, .wc-block-grid__product-title").text(),content_category:i.find("span[data-content_category]").data("content_category"),value:parseFloat(i.find("span.amount:last, span.amount:last bdi").clone().children().remove().end().text())*s,currency:woocommerce_params.currency},aepc_pixel.allowed_params.AddToCart)),{eventID:o})})),t(".add_to_wishlist, .wl-add-to").on("click",(function(e){if("no"===aepc_pixel.enable_wishlist)return e;var o=t(this),a=o.data("product-sku")?o.data("product-sku"):o.data("product-id");r("track","AddToWishlist",n(aepc_wc_add_to_wishlist[a]))})),t("body.woocommerce-page form.checkout").on("checkout_place_order",(function(t){"yes"===aepc_pixel.enable_addpaymentinfo&&r("track","AddPaymentInfo",n(aepc_add_payment_info_params))})),t(document.body).on("edd_cart_item_added",(function(t,e){var o=e.pixel;if("no"===aepc_pixel.enable_addtocart)return t;r("track","AddToCart",n(o.params?o.params:{}),o.event_id?{eventID:o.event_id}:{})})),t(".edd-checkout").on("click",'form#edd_purchase_form input[type="submit"]',(function(t){return"no"===aepc_pixel.enable_addpaymentinfo?t:(r("track","AddPaymentInfo",n(aepc_add_payment_info_params)),!0)}))}))}()}();
includes/admin/class-aepc-admin.php CHANGED
@@ -868,6 +868,7 @@ class AEPC_Admin {
868
  'aepc_fb_users',
869
  'aepc_account_name_%',
870
  'aepc_pixel_name_%',
 
871
  );
872
 
873
  // Convert wildcard in complete transient name, in order to use the function delete_transient after.
868
  'aepc_fb_users',
869
  'aepc_account_name_%',
870
  'aepc_pixel_name_%',
871
+ 'aepc_event_%',
872
  );
873
 
874
  // Convert wildcard in complete transient name, in order to use the function delete_transient after.
includes/admin/class-aepc-facebook-adapter.php CHANGED
@@ -13,7 +13,6 @@ use PixelCaffeine\Dependencies\Firebase\JWT\JWT;
13
  use PixelCaffeine\Admin\Exception\FBAPIException;
14
  use PixelCaffeine\Admin\Exception\FBAPILoginException;
15
  use PixelCaffeine\Dependencies\Ramsey\Uuid\Uuid;
16
- use Symfony\Component\Yaml\Yaml;
17
 
18
  /**
19
  * Adapter for facebook API
@@ -107,24 +106,9 @@ class AEPC_Facebook_Adapter {
107
  * @return void
108
  */
109
  public function connect() {
110
- // Load local configuration, if defined the file resources/fb.yml.
111
- if ( file_exists( PixelCaffeine()->plugin_path() . '/includes/resources/fb.dev.yml' ) && class_exists( '\Symfony\Component\Yaml\Yaml' ) ) {
112
- if ( ! function_exists( 'WP_Filesystem' ) ) {
113
- require_once ABSPATH . 'wp-admin/includes/file.php';
114
- }
115
-
116
- if ( WP_Filesystem() ) {
117
- global $wp_filesystem;
118
- /**
119
- * Get the global filesystem layer from WP
120
- *
121
- * @var WP_Filesystem_Base $wp_filesystem
122
- */
123
-
124
- $local_config = Yaml::parse( $wp_filesystem->get_contents( PixelCaffeine()->plugin_path() . '/includes/resources/fb.dev.yml' ) );
125
- $this->api_url = $local_config['fb']['api_url'];
126
- $this->api_stage = $local_config['fb']['api_stage'];
127
- }
128
  }
129
 
130
  // Get access token, it means logged in to facebook if it's not empty.
13
  use PixelCaffeine\Admin\Exception\FBAPIException;
14
  use PixelCaffeine\Admin\Exception\FBAPILoginException;
15
  use PixelCaffeine\Dependencies\Ramsey\Uuid\Uuid;
 
16
 
17
  /**
18
  * Adapter for facebook API
106
  * @return void
107
  */
108
  public function connect() {
109
+ if ( defined( 'AEPC_API_URL' ) && defined( 'AEPC_API_STAGE' ) ) {
110
+ $this->api_url = AEPC_API_URL;
111
+ $this->api_stage = AEPC_API_STAGE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
 
114
  // Get access token, it means logged in to facebook if it's not empty.
includes/admin/settings/general-settings.php CHANGED
@@ -50,6 +50,11 @@ return array(
50
  'default' => 'no',
51
  ),
52
 
 
 
 
 
 
53
  'aepc_enable_dpa' => array(
54
  'type' => 'checkbox',
55
  'default' => 'no',
50
  'default' => 'no',
51
  ),
52
 
53
+ 'aepc_server_side_track_in_ajax' => array(
54
+ 'type' => 'checkbox',
55
+ 'default' => 'no',
56
+ ),
57
+
58
  'aepc_enable_dpa' => array(
59
  'type' => 'checkbox',
60
  'default' => 'no',
includes/admin/templates/parts/panels/server-side-settings.php CHANGED
@@ -90,5 +90,21 @@ if ( ! defined( 'ABSPATH' ) ) {
90
  </div><!-- ./control-wrap -->
91
  </div><!-- ./form-group -->
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  </div>
94
  </div>
90
  </div><!-- ./control-wrap -->
91
  </div><!-- ./form-group -->
92
 
93
+ <div class="form-group">
94
+ <div class="control-wrap">
95
+ <div class="checkbox">
96
+ <label>
97
+ <input
98
+ type="checkbox"
99
+ name="<?php $page->field_name( 'aepc_server_side_track_in_ajax' ); ?>"
100
+ id="<?php $page->field_id( 'aepc_server_side_track_in_ajax' ); ?>"
101
+ <?php checked( $page->get_value( 'aepc_server_side_track_in_ajax' ), 'yes' ); ?>>
102
+ <?php esc_html_e( 'Track through AJAX', 'pixel-caffeine' ); ?>
103
+ </label>
104
+ <small class="text"><?php esc_html_e( 'This tracks all server-side events through an AJAX request in order to avoid any server side and/or any page cache enabled by hostings and/or caching plugins.', 'pixel-caffeine' ); ?></small>
105
+ </div>
106
+ </div><!-- ./control-wrap -->
107
+ </div><!-- ./form-group -->
108
+
109
  </div>
110
  </div>
includes/class-aepc-pixel-scripts.php CHANGED
@@ -251,6 +251,11 @@ class AEPC_Pixel_Scripts {
251
  'css_events' => self::track_css_events(),
252
  'link_clicks' => self::track_link_click_events(),
253
  'js_events' => self::track_js_event_events(),
 
 
 
 
 
254
  )
255
  )
256
  );
251
  'css_events' => self::track_css_events(),
252
  'link_clicks' => self::track_link_click_events(),
253
  'js_events' => self::track_js_event_events(),
254
+ 'ss_in_ajax' => AEPC_Track::is_server_side_tracking_enabled() && Server_Side_Tracking::must_track_in_ajax(),
255
+ 'api' => array(
256
+ 'root' => esc_url_raw( rest_url() ),
257
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
258
+ ),
259
  )
260
  )
261
  );
includes/class-aepc-track.php CHANGED
@@ -77,23 +77,25 @@ class AEPC_Track {
77
  */
78
  public static function track( $event, $args = array(), $custom_params = array(), $user_data = null, $delay = false ) {
79
  $event_params = array();
80
- try {
81
- $event_id = Uuid::uuid4()->toString();
82
- } catch ( Exception $e ) {
83
- $logger = new \AEPC_Admin_Logger();
84
- $logger->log(
85
- sprintf( 'Unable to generate event_id: %s', $e->getMessage() ),
86
- array(
87
- 'exception' => $e,
88
- )
89
- );
90
- $event_id = null;
91
- }
92
 
93
- // Get the event_id if any.
94
- if ( ! empty( $args['event_id'] ) ) {
 
 
95
  $event_id = $args['event_id'];
96
  unset( $args['event_id'] );
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
 
99
  // Check if it must be unique.
@@ -162,18 +164,26 @@ class AEPC_Track {
162
 
163
  $track_type = self::get_track_type( $event );
164
 
165
- $pixel = ( new Pixel_Event( $event_id, $event ) )
166
  ->set_event_data( $event_params ?: array() )
167
  ->set_user_data( $user_data )
168
  ->set_delay( (int) $delay )
169
  ->must_be_unique( $unique );
170
 
 
 
 
 
171
  // Register event track.
172
  if ( $pixel->can_be_tracked( Pixel_Event::TYPE_BROWSER ) ) {
173
  if ( ! isset( self::$tracked[ $track_type ][ $event ] ) ) {
174
- self::$tracked[ $track_type ][ $event ] = array( $pixel->get_event_id() => $pixel );
 
 
 
 
175
  } else {
176
- self::$tracked[ $track_type ][ $event ][ $pixel->get_event_id() ] = $pixel;
177
  }
178
  }
179
 
77
  */
78
  public static function track( $event, $args = array(), $custom_params = array(), $user_data = null, $delay = false ) {
79
  $event_params = array();
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ $event_id = null;
82
+ if ( ! self::is_server_side_tracking_enabled() ) {
83
+ unset( $args['event_id'] );
84
+ } elseif ( ! empty( $args['event_id'] ) ) {
85
  $event_id = $args['event_id'];
86
  unset( $args['event_id'] );
87
+ } else {
88
+ try {
89
+ $event_id = Uuid::uuid4()->toString();
90
+ } catch ( Exception $e ) {
91
+ $logger = new \AEPC_Admin_Logger();
92
+ $logger->log(
93
+ sprintf( 'Unable to generate event_id: %s', $e->getMessage() ),
94
+ array(
95
+ 'exception' => $e,
96
+ )
97
+ );
98
+ }
99
  }
100
 
101
  // Check if it must be unique.
164
 
165
  $track_type = self::get_track_type( $event );
166
 
167
+ $pixel = ( new Pixel_Event( $event ) )
168
  ->set_event_data( $event_params ?: array() )
169
  ->set_user_data( $user_data )
170
  ->set_delay( (int) $delay )
171
  ->must_be_unique( $unique );
172
 
173
+ if ( $event_id ) {
174
+ $pixel->set_event_id( $event_id );
175
+ }
176
+
177
  // Register event track.
178
  if ( $pixel->can_be_tracked( Pixel_Event::TYPE_BROWSER ) ) {
179
  if ( ! isset( self::$tracked[ $track_type ][ $event ] ) ) {
180
+ self::$tracked[ $track_type ][ $event ] = array();
181
+ }
182
+
183
+ if ( $event_id ) {
184
+ self::$tracked[ $track_type ][ $event ][ $event_id ] = $pixel;
185
  } else {
186
+ self::$tracked[ $track_type ][ $event ][] = $pixel;
187
  }
188
  }
189
 
includes/server-side/class-conversions-api.php CHANGED
@@ -55,7 +55,7 @@ class Conversions_API {
55
  * @param Event_Factory $event_factory The event factory to help for event instance creation.
56
  * @param bool $log_events True if we need to log every events sent (and not only the failed one).
57
  */
58
- public function __construct( $pixel_id, Api $api, Event_Factory $event_factory, bool $log_events = false ) {
59
  $this->api = $api;
60
  $this->event_factory = $event_factory;
61
  $this->pixel_id = $pixel_id;
55
  * @param Event_Factory $event_factory The event factory to help for event instance creation.
56
  * @param bool $log_events True if we need to log every events sent (and not only the failed one).
57
  */
58
+ public function __construct( $pixel_id, Api $api, Event_Factory $event_factory, $log_events = false ) {
59
  $this->api = $api;
60
  $this->event_factory = $event_factory;
61
  $this->pixel_id = $pixel_id;
includes/server-side/class-event-factory.php CHANGED
@@ -23,19 +23,24 @@ class Event_Factory {
23
  /**
24
  * Create the event object instance
25
  *
26
- * @param Pixel_Event $event The event instance.
27
  *
28
  * @return Event
29
  */
30
- public function create_event( Pixel_Event $event ) {
31
  $event = ( new Event() )
32
- ->setEventId( $event->get_event_id() )
33
- ->setEventName( $event->get_event_name() )
34
  ->setEventTime( time() )
35
  ->setEventSourceUrl( Util::getRequestUri() )
36
  ->setActionSource( ActionSource::WEBSITE )
37
- ->setUserData( User_Data_Factory::decorate_server_side( $event->get_user_data() ) )
38
- ->setCustomData( $this->create_custom_data( $event->get_event_data() ) );
 
 
 
 
 
 
39
 
40
  return $event;
41
  }
23
  /**
24
  * Create the event object instance
25
  *
26
+ * @param Pixel_Event $pixel The event instance.
27
  *
28
  * @return Event
29
  */
30
+ public function create_event( Pixel_Event $pixel ) {
31
  $event = ( new Event() )
32
+ ->setEventName( $pixel->get_event_name() )
 
33
  ->setEventTime( time() )
34
  ->setEventSourceUrl( Util::getRequestUri() )
35
  ->setActionSource( ActionSource::WEBSITE )
36
+ ->setUserData( User_Data_Factory::decorate_server_side( $pixel->get_user_data() ) )
37
+ ->setCustomData( $this->create_custom_data( $pixel->get_event_data() ) );
38
+
39
+ $event_id = $pixel->get_event_id();
40
+
41
+ if ( null !== $event_id ) {
42
+ $event->setEventId( $event_id );
43
+ }
44
 
45
  return $event;
46
  }
includes/server-side/class-pixel-event.php CHANGED
@@ -22,9 +22,9 @@ class Pixel_Event {
22
  /**
23
  * The event ID
24
  *
25
- * @var string
26
  */
27
- protected $event_id;
28
 
29
  /**
30
  * The event name
@@ -64,23 +64,34 @@ class Pixel_Event {
64
  /**
65
  * Pixel_Event constructor.
66
  *
67
- * @param string $event_id The event ID.
68
  * @param string $event_name The event name.
69
  */
70
- public function __construct( $event_id, $event_name ) {
71
- $this->event_id = $event_id;
72
  $this->event_name = $event_name;
73
  }
74
 
75
  /**
76
  * Get the event id
77
  *
78
- * @return string
79
  */
80
  public function get_event_id() {
81
  return $this->event_id;
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  /**
85
  * Get the event name
86
  *
@@ -258,10 +269,12 @@ class Pixel_Event {
258
  public function to_array() {
259
  return apply_filters(
260
  'aepc_track_event_data',
261
- array(
262
- 'params' => $this->get_event_data() ?: array(),
263
- 'delay' => $this->get_delay(),
264
- 'event_id' => $this->get_event_id(),
 
 
265
  ),
266
  $this->get_event_name()
267
  );
22
  /**
23
  * The event ID
24
  *
25
+ * @var null|string
26
  */
27
+ protected $event_id = null;
28
 
29
  /**
30
  * The event name
64
  /**
65
  * Pixel_Event constructor.
66
  *
 
67
  * @param string $event_name The event name.
68
  */
69
+ public function __construct( $event_name ) {
 
70
  $this->event_name = $event_name;
71
  }
72
 
73
  /**
74
  * Get the event id
75
  *
76
+ * @return string|null
77
  */
78
  public function get_event_id() {
79
  return $this->event_id;
80
  }
81
 
82
+ /**
83
+ * Set the event ID
84
+ *
85
+ * @param string $event_id The event ID to set.
86
+ *
87
+ * @return Pixel_Event
88
+ */
89
+ public function set_event_id( $event_id ) {
90
+ $this->event_id = $event_id;
91
+
92
+ return $this;
93
+ }
94
+
95
  /**
96
  * Get the event name
97
  *
269
  public function to_array() {
270
  return apply_filters(
271
  'aepc_track_event_data',
272
+ array_filter(
273
+ array(
274
+ 'params' => $this->get_event_data() ?: array(),
275
+ 'delay' => $this->get_delay(),
276
+ 'event_id' => $this->get_event_id(),
277
+ )
278
  ),
279
  $this->get_event_name()
280
  );
includes/server-side/class-server-side-tracking.php CHANGED
@@ -38,6 +38,24 @@ final class Server_Side_Tracking {
38
  public static function init( $access_token = null ) {
39
  add_action( 'template_redirect', array( __CLASS__, 'send_events' ) );
40
  add_action( 'shutdown', array( __CLASS__, 'send_events' ) ); // Try another time if any other events will be added.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
 
43
  /**
@@ -75,7 +93,7 @@ final class Server_Side_Tracking {
75
  * @return void
76
  */
77
  public static function send_events() {
78
- if ( empty( self::$events ) ) {
79
  return;
80
  }
81
 
@@ -87,6 +105,33 @@ final class Server_Side_Tracking {
87
  }
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  /**
91
  * Get the server side access token (if defined)
92
  *
@@ -104,4 +149,13 @@ final class Server_Side_Tracking {
104
  public static function must_log_all_events() {
105
  return 'yes' === get_option( 'aepc_server_side_log_events' );
106
  }
 
 
 
 
 
 
 
 
 
107
  }
38
  public static function init( $access_token = null ) {
39
  add_action( 'template_redirect', array( __CLASS__, 'send_events' ) );
40
  add_action( 'shutdown', array( __CLASS__, 'send_events' ) ); // Try another time if any other events will be added.
41
+
42
+ // Server-side tracking through AJAX.
43
+ if ( self::must_track_in_ajax() ) {
44
+ add_action(
45
+ 'rest_api_init',
46
+ function () {
47
+ register_rest_route(
48
+ 'aepc/v1',
49
+ '/fbq',
50
+ array(
51
+ 'methods' => \WP_REST_Server::CREATABLE,
52
+ 'callback' => array( __CLASS__, 'server_side_fbq' ),
53
+ 'permission_callback' => '__return_true',
54
+ )
55
+ );
56
+ }
57
+ );
58
+ }
59
  }
60
 
61
  /**
93
  * @return void
94
  */
95
  public static function send_events() {
96
+ if ( empty( self::$events ) || ( self::must_track_in_ajax() && ! defined( 'REST_REQUEST' ) ) ) {
97
  return;
98
  }
99
 
105
  }
106
  }
107
 
108
+ /**
109
+ * Handle the AJAX request to send server-side events
110
+ *
111
+ * @param \WP_REST_Request $request The AJAX request.
112
+ *
113
+ * @return \WP_REST_Response|\WP_Error
114
+ */
115
+ public static function server_side_fbq( \WP_REST_Request $request ) {
116
+ $query = $request->get_param( 'query' );
117
+
118
+ if ( ! isset( $query[1], $query[3]['eventID'] ) ) {
119
+ return new \WP_Error( 'fbq_unexpected_query', 'Invalid query for fbq server-side', array( 'status' => 422 ) );
120
+ }
121
+
122
+ \AEPC_Track::track(
123
+ $query[1],
124
+ array_merge(
125
+ isset( $query[2] ) ? $query[2] : array(),
126
+ array(
127
+ 'event_id' => $query[3]['eventID'],
128
+ )
129
+ )
130
+ );
131
+
132
+ return new \WP_REST_Response( null, 204 );
133
+ }
134
+
135
  /**
136
  * Get the server side access token (if defined)
137
  *
149
  public static function must_log_all_events() {
150
  return 'yes' === get_option( 'aepc_server_side_log_events' );
151
  }
152
+
153
+ /**
154
+ * Check if the server-side events must be track through AJAX (fixes cache plugin conflicts)
155
+ *
156
+ * @return bool
157
+ */
158
+ public static function must_track_in_ajax() {
159
+ return 'yes' === get_option( 'aepc_server_side_track_in_ajax' );
160
+ }
161
  }
languages/pixel-caffeine.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Pixel Caffeine package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Pixel Caffeine 2.3.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pixel-caffeine\n"
7
- "POT-Creation-Date: 2021-02-25 08:47:43+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -882,45 +882,45 @@ msgid ""
882
  "later."
883
  msgstr ""
884
 
885
- #: includes/admin/class-aepc-facebook-adapter.php:203
886
  msgid "Empty Token"
887
  msgstr ""
888
 
889
- #: includes/admin/class-aepc-facebook-adapter.php:213
890
  msgid "Expired Token"
891
  msgstr ""
892
 
893
- #: includes/admin/class-aepc-facebook-adapter.php:221
894
  msgid "Invalid login, please try again."
895
  msgstr ""
896
 
897
- #: includes/admin/class-aepc-facebook-adapter.php:260
898
  msgid "Please, grant the permissions requested"
899
  msgstr ""
900
 
901
- #: includes/admin/class-aepc-facebook-adapter.php:263
902
  #. translators: %s: the error from facebook when permission errors occurs
903
  #. during the facebook connection.
904
  msgid "Please, grant the permissions: %s"
905
  msgstr ""
906
 
907
- #: includes/admin/class-aepc-facebook-adapter.php:266
908
  msgid "Facebook authentication error"
909
  msgstr ""
910
 
911
- #: includes/admin/class-aepc-facebook-adapter.php:280
912
  msgid ""
913
  "<strong>Facebook connected</strong> Your facebook account is properly "
914
  "connected now."
915
  msgstr ""
916
 
917
- #: includes/admin/class-aepc-facebook-adapter.php:445
918
  msgid ""
919
  "Please, connect your facebook account to make operations to the custom "
920
  "audiences of your Ad account."
921
  msgstr ""
922
 
923
- #: includes/admin/class-aepc-facebook-adapter.php:525
924
  #. translators: 1: opening tag for the link to the current page in order to
925
  #. invite the user to refresh, 2: closing tag.
926
  msgid ""
@@ -928,13 +928,13 @@ msgid ""
928
  "to %1$srefresh the page%2$s."
929
  msgstr ""
930
 
931
- #: includes/admin/class-aepc-facebook-adapter.php:543
932
  msgid ""
933
  "Cannot save on facebook account because of something gone wrong during "
934
  "facebook connection."
935
  msgstr ""
936
 
937
- #: includes/admin/class-aepc-facebook-adapter.php:549
938
  msgid ""
939
  "The request goes in error from your server due by some oldest version of "
940
  "\"cUrl\" package. Please, ask to your hosting to upgrade it in order to fix "
@@ -943,13 +943,13 @@ msgid ""
943
  "service, to give their more details about the issue."
944
  msgstr ""
945
 
946
- #: includes/admin/class-aepc-facebook-adapter.php:564
947
  #. translators: 1: opening tag for the link to the general setting page where
948
  #. he can login again to facebook, 2: closing tag.
949
  msgid "Facebook connection timed out. Please, login again from %1$shere%2$s"
950
  msgstr ""
951
 
952
- #: includes/admin/class-aepc-facebook-adapter.php:588
953
  #. translators: 1: opening tag for the link to the general settings where the
954
  #. user can connect to Facebook again, 2: closing tag.
955
  msgid ""
@@ -957,77 +957,77 @@ msgid ""
957
  "again from %1$shere%2$s"
958
  msgstr ""
959
 
960
- #: includes/admin/class-aepc-facebook-adapter.php:590
961
  #. translators: %s: the error message from the Facebook API.
962
  msgid "Permission error: %s"
963
  msgstr ""
964
 
965
- #: includes/admin/class-aepc-facebook-adapter.php:591
966
  msgid "This Ads action requires the user to be admin of the application."
967
  msgstr ""
968
 
969
- #: includes/admin/class-aepc-facebook-adapter.php:592
970
  msgid "This Ads action requires the user to be admin of the ad account."
971
  msgstr ""
972
 
973
- #: includes/admin/class-aepc-facebook-adapter.php:593
974
  msgid ""
975
  "The ad account is not enabled for usage in Ads API. Please add it in "
976
  "developers.facebook.com/apps -> select your app -> settings -> advanced -> "
977
  "advertising accounts -> Ads API."
978
  msgstr ""
979
 
980
- #: includes/admin/class-aepc-facebook-adapter.php:594
981
  msgid "The facebook object you are trying to use does not exist."
982
  msgstr ""
983
 
984
- #: includes/admin/class-aepc-facebook-adapter.php:595
985
  msgid "You have to extend permission for ads_read to complete the action."
986
  msgstr ""
987
 
988
- #: includes/admin/class-aepc-facebook-adapter.php:596
989
  msgid "You have to extend permission for ads_management to complete the action."
990
  msgstr ""
991
 
992
- #: includes/admin/class-aepc-facebook-adapter.php:597
993
  msgid "Failed to update the custom audience."
994
  msgstr ""
995
 
996
- #: includes/admin/class-aepc-facebook-adapter.php:598
997
  msgid "Failed to create lookalike custom audience."
998
  msgstr ""
999
 
1000
- #: includes/admin/class-aepc-facebook-adapter.php:599
1001
  msgid "Failed to create custom audience on your facebook account."
1002
  msgstr ""
1003
 
1004
- #: includes/admin/class-aepc-facebook-adapter.php:600
1005
  msgid ""
1006
  "Terms of service has not been accepted. To accept, go to "
1007
  "https://www.facebook.com/ads/manage/customaudiences/tos.php"
1008
  msgstr ""
1009
 
1010
- #: includes/admin/class-aepc-facebook-adapter.php:601
1011
  msgid "Failed to delete custom audience because associated lookalikes exist."
1012
  msgstr ""
1013
 
1014
- #: includes/admin/class-aepc-facebook-adapter.php:602
1015
  msgid ""
1016
  "Terms of service has not been accepted. To accept, go to "
1017
  "https://www.facebook.com/customaudiences/app/tos"
1018
  msgstr ""
1019
 
1020
- #: includes/admin/class-aepc-facebook-adapter.php:603
1021
  msgid ""
1022
  "The corporate terms of service has not been accepted. To accept, go to "
1023
  "https://business.facebook.com/ads/manage/customaudiences/tos.php"
1024
  msgstr ""
1025
 
1026
- #: includes/admin/class-aepc-facebook-adapter.php:604
1027
  msgid "Specified audience is too small."
1028
  msgstr ""
1029
 
1030
- #: includes/admin/class-aepc-facebook-adapter.php:1253
1031
  msgid ""
1032
  "Unable to create a product catalog because there isn't any business ID "
1033
  "associated to your Ad account."
@@ -2530,6 +2530,17 @@ msgid ""
2530
  "keep it disabled normally."
2531
  msgstr ""
2532
 
 
 
 
 
 
 
 
 
 
 
 
2533
  #: includes/admin/templates/parts/panels/set-facebook-pixel.php:21
2534
  msgid "Facebook Pixel Setup"
2535
  msgstr ""
2
  # This file is distributed under the same license as the Pixel Caffeine package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Pixel Caffeine 2.3.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pixel-caffeine\n"
7
+ "POT-Creation-Date: 2021-03-16 14:33:37+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
882
  "later."
883
  msgstr ""
884
 
885
+ #: includes/admin/class-aepc-facebook-adapter.php:187
886
  msgid "Empty Token"
887
  msgstr ""
888
 
889
+ #: includes/admin/class-aepc-facebook-adapter.php:197
890
  msgid "Expired Token"
891
  msgstr ""
892
 
893
+ #: includes/admin/class-aepc-facebook-adapter.php:205
894
  msgid "Invalid login, please try again."
895
  msgstr ""
896
 
897
+ #: includes/admin/class-aepc-facebook-adapter.php:244
898
  msgid "Please, grant the permissions requested"
899
  msgstr ""
900
 
901
+ #: includes/admin/class-aepc-facebook-adapter.php:247
902
  #. translators: %s: the error from facebook when permission errors occurs
903
  #. during the facebook connection.
904
  msgid "Please, grant the permissions: %s"
905
  msgstr ""
906
 
907
+ #: includes/admin/class-aepc-facebook-adapter.php:250
908
  msgid "Facebook authentication error"
909
  msgstr ""
910
 
911
+ #: includes/admin/class-aepc-facebook-adapter.php:264
912
  msgid ""
913
  "<strong>Facebook connected</strong> Your facebook account is properly "
914
  "connected now."
915
  msgstr ""
916
 
917
+ #: includes/admin/class-aepc-facebook-adapter.php:429
918
  msgid ""
919
  "Please, connect your facebook account to make operations to the custom "
920
  "audiences of your Ad account."
921
  msgstr ""
922
 
923
+ #: includes/admin/class-aepc-facebook-adapter.php:509
924
  #. translators: 1: opening tag for the link to the current page in order to
925
  #. invite the user to refresh, 2: closing tag.
926
  msgid ""
928
  "to %1$srefresh the page%2$s."
929
  msgstr ""
930
 
931
+ #: includes/admin/class-aepc-facebook-adapter.php:527
932
  msgid ""
933
  "Cannot save on facebook account because of something gone wrong during "
934
  "facebook connection."
935
  msgstr ""
936
 
937
+ #: includes/admin/class-aepc-facebook-adapter.php:533
938
  msgid ""
939
  "The request goes in error from your server due by some oldest version of "
940
  "\"cUrl\" package. Please, ask to your hosting to upgrade it in order to fix "
943
  "service, to give their more details about the issue."
944
  msgstr ""
945
 
946
+ #: includes/admin/class-aepc-facebook-adapter.php:548
947
  #. translators: 1: opening tag for the link to the general setting page where
948
  #. he can login again to facebook, 2: closing tag.
949
  msgid "Facebook connection timed out. Please, login again from %1$shere%2$s"
950
  msgstr ""
951
 
952
+ #: includes/admin/class-aepc-facebook-adapter.php:572
953
  #. translators: 1: opening tag for the link to the general settings where the
954
  #. user can connect to Facebook again, 2: closing tag.
955
  msgid ""
957
  "again from %1$shere%2$s"
958
  msgstr ""
959
 
960
+ #: includes/admin/class-aepc-facebook-adapter.php:574
961
  #. translators: %s: the error message from the Facebook API.
962
  msgid "Permission error: %s"
963
  msgstr ""
964
 
965
+ #: includes/admin/class-aepc-facebook-adapter.php:575
966
  msgid "This Ads action requires the user to be admin of the application."
967
  msgstr ""
968
 
969
+ #: includes/admin/class-aepc-facebook-adapter.php:576
970
  msgid "This Ads action requires the user to be admin of the ad account."
971
  msgstr ""
972
 
973
+ #: includes/admin/class-aepc-facebook-adapter.php:577
974
  msgid ""
975
  "The ad account is not enabled for usage in Ads API. Please add it in "
976
  "developers.facebook.com/apps -> select your app -> settings -> advanced -> "
977
  "advertising accounts -> Ads API."
978
  msgstr ""
979
 
980
+ #: includes/admin/class-aepc-facebook-adapter.php:578
981
  msgid "The facebook object you are trying to use does not exist."
982
  msgstr ""
983
 
984
+ #: includes/admin/class-aepc-facebook-adapter.php:579
985
  msgid "You have to extend permission for ads_read to complete the action."
986
  msgstr ""
987
 
988
+ #: includes/admin/class-aepc-facebook-adapter.php:580
989
  msgid "You have to extend permission for ads_management to complete the action."
990
  msgstr ""
991
 
992
+ #: includes/admin/class-aepc-facebook-adapter.php:581
993
  msgid "Failed to update the custom audience."
994
  msgstr ""
995
 
996
+ #: includes/admin/class-aepc-facebook-adapter.php:582
997
  msgid "Failed to create lookalike custom audience."
998
  msgstr ""
999
 
1000
+ #: includes/admin/class-aepc-facebook-adapter.php:583
1001
  msgid "Failed to create custom audience on your facebook account."
1002
  msgstr ""
1003
 
1004
+ #: includes/admin/class-aepc-facebook-adapter.php:584
1005
  msgid ""
1006
  "Terms of service has not been accepted. To accept, go to "
1007
  "https://www.facebook.com/ads/manage/customaudiences/tos.php"
1008
  msgstr ""
1009
 
1010
+ #: includes/admin/class-aepc-facebook-adapter.php:585
1011
  msgid "Failed to delete custom audience because associated lookalikes exist."
1012
  msgstr ""
1013
 
1014
+ #: includes/admin/class-aepc-facebook-adapter.php:586
1015
  msgid ""
1016
  "Terms of service has not been accepted. To accept, go to "
1017
  "https://www.facebook.com/customaudiences/app/tos"
1018
  msgstr ""
1019
 
1020
+ #: includes/admin/class-aepc-facebook-adapter.php:587
1021
  msgid ""
1022
  "The corporate terms of service has not been accepted. To accept, go to "
1023
  "https://business.facebook.com/ads/manage/customaudiences/tos.php"
1024
  msgstr ""
1025
 
1026
+ #: includes/admin/class-aepc-facebook-adapter.php:588
1027
  msgid "Specified audience is too small."
1028
  msgstr ""
1029
 
1030
+ #: includes/admin/class-aepc-facebook-adapter.php:1237
1031
  msgid ""
1032
  "Unable to create a product catalog because there isn't any business ID "
1033
  "associated to your Ad account."
2530
  "keep it disabled normally."
2531
  msgstr ""
2532
 
2533
+ #: includes/admin/templates/parts/panels/server-side-settings.php:102
2534
+ msgid "Track through AJAX"
2535
+ msgstr ""
2536
+
2537
+ #: includes/admin/templates/parts/panels/server-side-settings.php:104
2538
+ msgid ""
2539
+ "This tracks all server-side events through an AJAX request in order to "
2540
+ "avoid any server side and/or any page cache enabled by hostings and/or "
2541
+ "caching plugins."
2542
+ msgstr ""
2543
+
2544
  #: includes/admin/templates/parts/panels/set-facebook-pixel.php:21
2545
  msgid "Facebook Pixel Setup"
2546
  msgstr ""
pixel-caffeine.php CHANGED
@@ -7,9 +7,9 @@
7
  * Author URI: https://adespresso.com/
8
  * Text Domain: pixel-caffeine
9
  * Domain Path: /languages
10
- * Version: 2.3.1
11
  * WC requires at least: 4.0.0
12
- * WC tested up to: 5.0.0
13
  *
14
  * @package PixelCaffeine
15
  */
@@ -33,7 +33,7 @@ if ( ! class_exists( 'PixelCaffeine' ) ) :
33
  *
34
  * @var string
35
  */
36
- public $version = '2.3.1';
37
 
38
  /**
39
  * The single instance of the class.
7
  * Author URI: https://adespresso.com/
8
  * Text Domain: pixel-caffeine
9
  * Domain Path: /languages
10
+ * Version: 2.3.2
11
  * WC requires at least: 4.0.0
12
+ * WC tested up to: 5.1.0
13
  *
14
  * @package PixelCaffeine
15
  */
33
  *
34
  * @var string
35
  */
36
+ public $version = '2.3.2';
37
 
38
  /**
39
  * The single instance of the class.
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: facebook, facebook pixel, facebook ad, facebook insertions, custom audienc
5
  Requires at least: 4.4.24
6
  Requires PHP: 7.2.5
7
  Tested up to: 5.7.0
8
- Stable tag: 2.3.0
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -124,6 +124,11 @@ Unfortunately there isn’t any way at the moment to import custom audiences _fr
124
 
125
  == Changelog ==
126
 
 
 
 
 
 
127
  = 2.3.1 - 2021-02-25 =
128
  * Enhancement - Scoped third-party vendor dependencies in order to avoid conflicts with other third-party vendor of other installed plugins
129
  * Fix - Guzzle conflicts with other plugins
5
  Requires at least: 4.4.24
6
  Requires PHP: 7.2.5
7
  Tested up to: 5.7.0
8
+ Stable tag: 2.3.2
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
124
 
125
  == Changelog ==
126
 
127
+ = 2.3.2 - 2021-03-16 =
128
+ * Add - Option to enable server-side tracking through AJAX in order to resolve issues with cache systems (server and/or third-party plugins)
129
+ * Enhancement - Avoid to pass `eventID` if server-side tracking is disabled
130
+ * Update - Facebook API SDK to v10
131
+
132
  = 2.3.1 - 2021-02-25 =
133
  * Enhancement - Scoped third-party vendor dependencies in order to avoid conflicts with other third-party vendor of other installed plugins
134
  * Fix - Guzzle conflicts with other plugins
third-party/vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit33a0652cabee89f0d6c446db2aeebece::getLoader();
third-party/vendor/composer/autoload_classmap.php CHANGED
@@ -33,9 +33,9 @@ return array(
33
  'PixelCaffeine\\Admin\\Exception\\FBAPILoginException' => $baseDir . '/../includes/admin/exceptions/exception-fbapi-login.php',
34
  'PixelCaffeine\\Dependencies\\ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
35
  'PixelCaffeine\\Dependencies\\AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
36
- 'PixelCaffeine\\Dependencies\\ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144' => $vendorDir . '/composer/autoload_real.php',
37
  'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php',
38
- 'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ComposerStaticInit2794c148e8d4f809de17342ff307f144' => $vendorDir . '/composer/autoload_static.php',
39
  'PixelCaffeine\\Dependencies\\DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
40
  'PixelCaffeine\\Dependencies\\Error' => $vendorDir . '/paragonie/random_compat/lib/error_polyfill.php',
41
  'PixelCaffeine\\Dependencies\\FacebookAds\\AnonymousSession' => $vendorDir . '/facebook/php-business-sdk/src/FacebookAds/AnonymousSession.php',
33
  'PixelCaffeine\\Admin\\Exception\\FBAPILoginException' => $baseDir . '/../includes/admin/exceptions/exception-fbapi-login.php',
34
  'PixelCaffeine\\Dependencies\\ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
35
  'PixelCaffeine\\Dependencies\\AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
36
+ 'PixelCaffeine\\Dependencies\\ComposerAutoloaderInit33a0652cabee89f0d6c446db2aeebece' => $vendorDir . '/composer/autoload_real.php',
37
  'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php',
38
+ 'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ComposerStaticInit33a0652cabee89f0d6c446db2aeebece' => $vendorDir . '/composer/autoload_static.php',
39
  'PixelCaffeine\\Dependencies\\DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
40
  'PixelCaffeine\\Dependencies\\Error' => $vendorDir . '/paragonie/random_compat/lib/error_polyfill.php',
41
  'PixelCaffeine\\Dependencies\\FacebookAds\\AnonymousSession' => $vendorDir . '/facebook/php-business-sdk/src/FacebookAds/AnonymousSession.php',
third-party/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit2794c148e8d4f809de17342ff307f144::getInitializer($loader));
34
  } else {
35
  $classMap = require __DIR__ . '/autoload_classmap.php';
36
  if ($classMap) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit33a0652cabee89f0d6c446db2aeebece
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit33a0652cabee89f0d6c446db2aeebece', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit33a0652cabee89f0d6c446db2aeebece', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit33a0652cabee89f0d6c446db2aeebece::getInitializer($loader));
34
  } else {
35
  $classMap = require __DIR__ . '/autoload_classmap.php';
36
  if ($classMap) {
third-party/vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit2794c148e8d4f809de17342ff307f144
8
  {
9
  public static $classMap = array (
10
  'AEPC_Addon_Factory' => __DIR__ . '/../..' . '/../includes/class-aepc-addon-factory.php',
@@ -34,9 +34,9 @@ class ComposerStaticInit2794c148e8d4f809de17342ff307f144
34
  'PixelCaffeine\\Admin\\Exception\\FBAPILoginException' => __DIR__ . '/../..' . '/../includes/admin/exceptions/exception-fbapi-login.php',
35
  'PixelCaffeine\\Dependencies\\ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
36
  'PixelCaffeine\\Dependencies\\AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
37
- 'PixelCaffeine\\Dependencies\\ComposerAutoloaderInit2794c148e8d4f809de17342ff307f144' => __DIR__ . '/..' . '/composer/autoload_real.php',
38
  'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php',
39
- 'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ComposerStaticInit2794c148e8d4f809de17342ff307f144' => __DIR__ . '/..' . '/composer/autoload_static.php',
40
  'PixelCaffeine\\Dependencies\\DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
41
  'PixelCaffeine\\Dependencies\\Error' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php',
42
  'PixelCaffeine\\Dependencies\\FacebookAds\\AnonymousSession' => __DIR__ . '/..' . '/facebook/php-business-sdk/src/FacebookAds/AnonymousSession.php',
@@ -325,7 +325,7 @@ class ComposerStaticInit2794c148e8d4f809de17342ff307f144
325
  public static function getInitializer(ClassLoader $loader)
326
  {
327
  return \Closure::bind(function () use ($loader) {
328
- $loader->classMap = ComposerStaticInit2794c148e8d4f809de17342ff307f144::$classMap;
329
 
330
  }, null, ClassLoader::class);
331
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit33a0652cabee89f0d6c446db2aeebece
8
  {
9
  public static $classMap = array (
10
  'AEPC_Addon_Factory' => __DIR__ . '/../..' . '/../includes/class-aepc-addon-factory.php',
34
  'PixelCaffeine\\Admin\\Exception\\FBAPILoginException' => __DIR__ . '/../..' . '/../includes/admin/exceptions/exception-fbapi-login.php',
35
  'PixelCaffeine\\Dependencies\\ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
36
  'PixelCaffeine\\Dependencies\\AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
37
+ 'PixelCaffeine\\Dependencies\\ComposerAutoloaderInit33a0652cabee89f0d6c446db2aeebece' => __DIR__ . '/..' . '/composer/autoload_real.php',
38
  'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php',
39
+ 'PixelCaffeine\\Dependencies\\Composer\\Autoload\\ComposerStaticInit33a0652cabee89f0d6c446db2aeebece' => __DIR__ . '/..' . '/composer/autoload_static.php',
40
  'PixelCaffeine\\Dependencies\\DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
41
  'PixelCaffeine\\Dependencies\\Error' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php',
42
  'PixelCaffeine\\Dependencies\\FacebookAds\\AnonymousSession' => __DIR__ . '/..' . '/facebook/php-business-sdk/src/FacebookAds/AnonymousSession.php',
325
  public static function getInitializer(ClassLoader $loader)
326
  {
327
  return \Closure::bind(function () use ($loader) {
328
+ $loader->classMap = ComposerStaticInit33a0652cabee89f0d6c446db2aeebece::$classMap;
329
 
330
  }, null, ClassLoader::class);
331
  }
third-party/vendor/composer/installed.json CHANGED
@@ -95,17 +95,17 @@
95
  },
96
  {
97
  "name": "facebook\/php-business-sdk",
98
- "version": "9.0.4",
99
- "version_normalized": "9.0.4.0",
100
  "source": {
101
  "type": "git",
102
  "url": "https:\/\/github.com\/facebook\/facebook-php-business-sdk.git",
103
- "reference": "c29498ee7f180583cb16873e5047eeeada834067"
104
  },
105
  "dist": {
106
  "type": "zip",
107
- "url": "https:\/\/api.github.com\/repos\/facebook\/facebook-php-business-sdk\/zipball\/c29498ee7f180583cb16873e5047eeeada834067",
108
- "reference": "c29498ee7f180583cb16873e5047eeeada834067",
109
  "shasum": ""
110
  },
111
  "require": {
@@ -116,7 +116,7 @@
116
  "phpunit\/phpunit": "~8",
117
  "symfony\/finder": "~2.6"
118
  },
119
- "time": "2021-02-16T22:35:02+00:00",
120
  "type": "library",
121
  "installation-source": "dist",
122
  "autoload": {
@@ -252,17 +252,17 @@
252
  },
253
  {
254
  "name": "guzzlehttp\/promises",
255
- "version": "1.4.0",
256
- "version_normalized": "1.4.0.0",
257
  "source": {
258
  "type": "git",
259
  "url": "https:\/\/github.com\/guzzle\/promises.git",
260
- "reference": "60d379c243457e073cff02bc323a2a86cb355631"
261
  },
262
  "dist": {
263
  "type": "zip",
264
- "url": "https:\/\/api.github.com\/repos\/guzzle\/promises\/zipball\/60d379c243457e073cff02bc323a2a86cb355631",
265
- "reference": "60d379c243457e073cff02bc323a2a86cb355631",
266
  "shasum": ""
267
  },
268
  "require": {
@@ -271,7 +271,7 @@
271
  "require-dev": {
272
  "symfony\/phpunit-bridge": "^4.4 || ^5.1"
273
  },
274
- "time": "2020-09-30T07:37:28+00:00",
275
  "type": "library",
276
  "extra": {
277
  "branch-alias": {
95
  },
96
  {
97
  "name": "facebook\/php-business-sdk",
98
+ "version": "10.0.0",
99
+ "version_normalized": "10.0.0.0",
100
  "source": {
101
  "type": "git",
102
  "url": "https:\/\/github.com\/facebook\/facebook-php-business-sdk.git",
103
+ "reference": "099f423ee7537619a8a3c144067c60ede5fe0a61"
104
  },
105
  "dist": {
106
  "type": "zip",
107
+ "url": "https:\/\/api.github.com\/repos\/facebook\/facebook-php-business-sdk\/zipball\/099f423ee7537619a8a3c144067c60ede5fe0a61",
108
+ "reference": "099f423ee7537619a8a3c144067c60ede5fe0a61",
109
  "shasum": ""
110
  },
111
  "require": {
116
  "phpunit\/phpunit": "~8",
117
  "symfony\/finder": "~2.6"
118
  },
119
+ "time": "2021-03-02T20:03:58+00:00",
120
  "type": "library",
121
  "installation-source": "dist",
122
  "autoload": {
252
  },
253
  {
254
  "name": "guzzlehttp\/promises",
255
+ "version": "1.4.1",
256
+ "version_normalized": "1.4.1.0",
257
  "source": {
258
  "type": "git",
259
  "url": "https:\/\/github.com\/guzzle\/promises.git",
260
+ "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
261
  },
262
  "dist": {
263
  "type": "zip",
264
+ "url": "https:\/\/api.github.com\/repos\/guzzle\/promises\/zipball\/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
265
+ "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
266
  "shasum": ""
267
  },
268
  "require": {
271
  "require-dev": {
272
  "symfony\/phpunit-bridge": "^4.4 || ^5.1"
273
  },
274
+ "time": "2021-03-07T09:25:29+00:00",
275
  "type": "library",
276
  "extra": {
277
  "branch-alias": {
third-party/vendor/facebook/php-business-sdk/src/FacebookAds/ApiConfig.php CHANGED
@@ -26,7 +26,7 @@ namespace PixelCaffeine\Dependencies\FacebookAds;
26
 
27
  class ApiConfig
28
  {
29
- const APIVersion = '9.0';
30
- const SDKVersion = '9.0.4';
31
  const TYPE_CHECKER_STRICT_MODE = \false;
32
  }
26
 
27
  class ApiConfig
28
  {
29
+ const APIVersion = '10.0';
30
+ const SDKVersion = '10.0.0';
31
  const TYPE_CHECKER_STRICT_MODE = \false;
32
  }
third-party/vendor/guzzlehttp/promises/phpstan-baseline.neon DELETED
@@ -1,7 +0,0 @@
1
- parameters:
2
- ignoreErrors:
3
- -
4
- message: "#^Parameter \\#1 \\$function of function register_shutdown_function expects callable\\(\\)\\: void, Closure\\(\\)\\: mixed given\\.$#"
5
- count: 1
6
- path: src/TaskQueue.php
7
-
 
 
 
 
 
 
 
third-party/vendor/guzzlehttp/promises/psalm.xml DELETED
@@ -1,15 +0,0 @@
1
- <?xml version="1.0"?>
2
- <psalm
3
- errorLevel="4"
4
- resolveFromConfigFile="true"
5
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
- xmlns="https://getpsalm.org/schema/config"
7
- xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8
- >
9
- <projectFiles>
10
- <directory name="src" />
11
- <ignoreFiles>
12
- <directory name="vendor" />
13
- </ignoreFiles>
14
- </projectFiles>
15
- </psalm>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
third-party/vendor/guzzlehttp/promises/src/EachPromise.php CHANGED
@@ -9,6 +9,7 @@ namespace PixelCaffeine\Dependencies\GuzzleHttp\Promise;
9
  class EachPromise implements \PixelCaffeine\Dependencies\GuzzleHttp\Promise\PromisorInterface
10
  {
11
  private $pending = [];
 
12
  /** @var \Iterator|null */
13
  private $iterable;
14
  /** @var callable|int|null */
@@ -106,6 +107,7 @@ class EachPromise implements \PixelCaffeine\Dependencies\GuzzleHttp\Promise\Prom
106
  $clearFn = function () {
107
  $this->iterable = $this->concurrency = $this->pending = null;
108
  $this->onFulfilled = $this->onRejected = null;
 
109
  };
110
  $this->aggregate->then($clearFn, $clearFn);
111
  }
@@ -140,11 +142,9 @@ class EachPromise implements \PixelCaffeine\Dependencies\GuzzleHttp\Promise\Prom
140
  }
141
  $promise = \PixelCaffeine\Dependencies\GuzzleHttp\Promise\Create::promiseFor($this->iterable->current());
142
  $key = $this->iterable->key();
143
- // Iterable keys may not be unique, so we add the promises at the end
144
- // of the pending array and retrieve the array index being used
145
- $this->pending[] = null;
146
- \end($this->pending);
147
- $idx = \key($this->pending);
148
  $this->pending[$idx] = $promise->then(function ($value) use($idx, $key) {
149
  if ($this->onFulfilled) {
150
  \call_user_func($this->onFulfilled, $value, $key, $this->aggregate);
9
  class EachPromise implements \PixelCaffeine\Dependencies\GuzzleHttp\Promise\PromisorInterface
10
  {
11
  private $pending = [];
12
+ private $nextPendingIndex = 0;
13
  /** @var \Iterator|null */
14
  private $iterable;
15
  /** @var callable|int|null */
107
  $clearFn = function () {
108
  $this->iterable = $this->concurrency = $this->pending = null;
109
  $this->onFulfilled = $this->onRejected = null;
110
+ $this->nextPendingIndex = 0;
111
  };
112
  $this->aggregate->then($clearFn, $clearFn);
113
  }
142
  }
143
  $promise = \PixelCaffeine\Dependencies\GuzzleHttp\Promise\Create::promiseFor($this->iterable->current());
144
  $key = $this->iterable->key();
145
+ // Iterable keys may not be unique, so we use a counter to
146
+ // guarantee uniqueness
147
+ $idx = $this->nextPendingIndex++;
 
 
148
  $this->pending[$idx] = $promise->then(function ($value) use($idx, $key) {
149
  if ($this->onFulfilled) {
150
  \call_user_func($this->onFulfilled, $value, $key, $this->aggregate);