PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) - Version 9.0.0

Version Description

Download this release

Release Info

Developer PixelYourSite
Plugin Icon 128x128 PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads)
Version 9.0.0
Comparing to
See all releases

Code changes from version 8.2.18 to 9.0.0

dist/scripts/admin.js CHANGED
@@ -1,5 +1,5 @@
1
 
2
- jQuery(document).ready(function(c){function n(e){var t=c("#"+e.data("target"));e.val()===e.data("value")?t.removeClass("form-control-hidden"):t.addClass("form-control-hidden")}function e(){"price"===c('input[name="pys[core][woo_event_value]"]:checked').val()?c(".woo-event-value-option").hide():c(".woo-event-value-option").show()}function t(){"price"===c('input[name="pys[core][edd_event_value]"]:checked').val()?c(".edd-event-value-option").hide():c(".edd-event-value-option").show()}function a(){var e=c("#pys_event_trigger_type").val(),t="#"+e+"_panel";c(".event_triggers_panel").hide(),c(t).show(),"page_visit"===e?c("#url_filter_panel").hide():c("#url_filter_panel").show();var n=c(t),a=n.data("trigger_type");0===c(".event_trigger",n).length-1&&s(n,a)}function s(e,t){var n=c(".event_trigger",e),a=c(n[0]).clone(!0),s=c(n[n.length-1]).data("trigger_id")+1,i="pys[event]["+t+"_triggers]["+s+"]";a.data("trigger_id",s),c("select",a).attr("name",i+"[rule]"),c("input",a).attr("name",i+"[value]"),a.css("display","block"),a.insertBefore(c(".insert-marker",e))}function i(){"page_visit"===c("#pys_event_trigger_type").val()?c(".event-delay").css("visibility","visible"):c(".event-delay").css("visibility","hidden")}function o(){c("#pys_event_facebook_enabled").is(":checked")?c("#facebook_panel").show():c("#facebook_panel").hide()}function r(){"CustomEvent"===c("#pys_event_facebook_event_type").val()?c(".facebook-custom-event-type").css("visibility","visible"):c(".facebook-custom-event-type").css("visibility","hidden")}function p(){c("#pys_event_facebook_params_enabled").is(":checked")?c("#facebook_params_panel").show():c("#facebook_params_panel").hide()}function _(){var e=c("#pys_event_facebook_event_type").val();c("#facebook_params_panel").removeClass().addClass(e)}function l(){"custom"===c("#pys_event_facebook_params_currency").val()?c(".facebook-custom-currency").css("visibility","visible"):c(".facebook-custom-currency").css("visibility","hidden")}function v(){c("#pys_event_pinterest_enabled").is(":checked")?c("#pinterest_panel").show():c("#pinterest_panel").hide()}function u(){"CustomEvent"===c("#pys_event_pinterest_event_type").val()?c(".pinterest-custom-event-type").css("visibility","visible"):c(".pinterest-custom-event-type").css("visibility","hidden")}function d(){c("#pys_event_pinterest_params_enabled").is(":checked")?c("#pinterest_params_panel").show():c("#pinterest_params_panel").hide()}function y(){var e=c("#pys_event_pinterest_event_type").val();c("#pinterest_params_panel").removeClass().addClass(e)}function m(){"custom"===c("#pys_event_pinterest_params_currency").val()?c(".pinterest-custom-currency").css("visibility","visible"):c(".pinterest-custom-currency").css("visibility","hidden")}function f(){c("#pys_event_ga_enabled").is(":checked")?c("#analytics_panel").show():c("#analytics_panel").hide()}function h(){"_custom"===c("#pys_event_ga_event_action").val() || "CustomEvent"===c("#pys_event_ga_event_action").val()?c("#ga-custom-action").css("visibility","visible"):c("#ga-custom-action").css("visibility","hidden")}function g(){c("#pys_event_bing_enabled").is(":checked")?c("#bing_panel").show():c("#bing_panel").hide()}c(function(){c('[data-toggle="pys-popover"]').popover({container:"#pys",html:!0,content:function(){return c("#pys-"+c(this).data("popover_id")).html()}})}),c(".pys-select2").select2(),c(".pys-tags-select2").select2({tags:!0,tokenSeparators:[","," "]}),c("select.controls-visibility").on("change",function(e){n(c(this))}).each(function(e,t){n(c(t))}),c(".card-collapse").on("click",function(){var e=c(this).closest(".card").find(".card-body");e.hasClass("show")?e.hide().removeClass("show"):e.show().addClass("show")}),c(".collapse-control .custom-switch-input").on('change',function(){var e=c(this),t=c("."+e.data("target"));0<t.length&&(e.prop("checked")?t.show():t.hide())}).trigger("change"),e(),c('input[name="pys[core][woo_event_value]"]').on('change',function(){e()}),t(),c('input[name="pys[core][edd_event_value]"]').on('change',function(){t()}),c("#pys_select_all_events").on('change',function(){c(this).prop("checked")?c(".pys-select-event").prop("checked","checked"):c(".pys-select-event").prop("checked",!1)}),i(),a(),c("#pys_event_trigger_type").on('change',function(){i(),a()}),c(".add-event-trigger").on("click",function(){var e=c(this).closest(".event_triggers_panel");s(e,e.data("trigger_type"))}),c(".remove-row").on("click",function(e){c(this).closest(".row.event_trigger, .row.facebook-custom-param, .row.pinterest-custom-param").remove()}),o(),r(),p(),_(),l(),c("#pys_event_facebook_enabled").on("click",function(){o()}),c("#pys_event_facebook_event_type").on('change',function(){r(),_()}),c("#pys_event_facebook_params_enabled").on("click",function(){p()}),c("#pys_event_facebook_params_currency").on('change',function(){l()}),c(".add-facebook-parameter").on("click",function(){var e=c("#facebook_params_panel"),t=c(".facebook-custom-param",e),n=c(t[0]).clone(!0),a=c(t[t.length-1]).data("param_id")+1,s="pys[event][facebook_custom_params]["+a+"]";n.data("param_id",a),c("input.custom-param-name",n).attr("name",s+"[name]"),c("input.custom-param-value",n).attr("name",s+"[value]"),n.css("display","flex"),n.insertBefore(c(".insert-marker",e))}),v(),u(),d(),y(),m(),c("#pys_event_pinterest_enabled").on("click",function(){v()}),c("#pys_event_pinterest_event_type").on('change',function(){u(),y()}),c("#pys_event_pinterest_params_enabled").on("click",function(){d()}),c("#pys_event_pinterest_params_currency").on('change',function(){m()}),c(".add-pinterest-parameter").on("click",function(){var e=c("#pinterest_params_panel"),t=c(".pinterest-custom-param",e),n=c(t[0]).clone(!0),a=c(t[t.length-1]).data("param_id")+1,s="pys[event][pinterest_custom_params]["+a+"]";n.data("param_id",a),c("input.custom-param-name",n).attr("name",s+"[name]"),c("input.custom-param-value",n).attr("name",s+"[value]"),n.css("display","flex"),n.insertBefore(c(".insert-marker",e))}),f(),h(),c("#pys_event_ga_enabled").on("click",function(){f()}),c("#pys_event_ga_event_action").on('change',function(){h()}),g(),c("#pys_event_bing_enabled").on("click",function(){g()})});
3
 
4
  jQuery( document ).ready(function($) {
5
  updateFDPValue($("#pys_facebook_fdp_purchase_event_fire"));
@@ -93,6 +93,19 @@ jQuery( document ).ready(function($) {
93
  }
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  });
98
 
1
 
2
+ jQuery(document).ready(function(c){function n(e){var t=c("#"+e.data("target"));e.val()===e.data("value")?t.removeClass("form-control-hidden"):t.addClass("form-control-hidden")}function e(){"price"===c('input[name="pys[core][woo_event_value]"]:checked').val()?c(".woo-event-value-option").hide():c(".woo-event-value-option").show()}function t(){"price"===c('input[name="pys[core][edd_event_value]"]:checked').val()?c(".edd-event-value-option").hide():c(".edd-event-value-option").show()}function a(){var e=c("#pys_event_trigger_type").val(),t="#"+e+"_panel";c(".event_triggers_panel").hide(),c(t).show(),"page_visit"===e?c("#url_filter_panel").hide():c("#url_filter_panel").show();var n=c(t),a=n.data("trigger_type");0===c(".event_trigger",n).length-1&&s(n,a)}function s(e,t){var n=c(".event_trigger",e),a=c(n[0]).clone(!0),s=c(n[n.length-1]).data("trigger_id")+1,i="pys[event]["+t+"_triggers]["+s+"]";a.data("trigger_id",s),c("select",a).attr("name",i+"[rule]"),c("input",a).attr("name",i+"[value]"),a.css("display","block"),a.insertBefore(c(".insert-marker",e))}function i(){"page_visit"===c("#pys_event_trigger_type").val()?c(".event-delay").css("visibility","visible"):c(".event-delay").css("visibility","hidden")}function o(){c("#pys_event_facebook_enabled").is(":checked")?c("#facebook_panel").show():c("#facebook_panel").hide()}function r(){"CustomEvent"===c("#pys_event_facebook_event_type").val()?c(".facebook-custom-event-type").css("visibility","visible"):c(".facebook-custom-event-type").css("visibility","hidden")}function p(){c("#pys_event_facebook_params_enabled").is(":checked")?c("#facebook_params_panel").show():c("#facebook_params_panel").hide()}function _(){var e=c("#pys_event_facebook_event_type").val();c("#facebook_params_panel").removeClass().addClass(e)}function l(){"custom"===c("#pys_event_facebook_params_currency").val()?c(".facebook-custom-currency").css("visibility","visible"):c(".facebook-custom-currency").css("visibility","hidden")}function v(){c("#pys_event_pinterest_enabled").is(":checked")?c("#pinterest_panel").show():c("#pinterest_panel").hide()}function u(){"CustomEvent"===c("#pys_event_pinterest_event_type").val()?c(".pinterest-custom-event-type").css("visibility","visible"):c(".pinterest-custom-event-type").css("visibility","hidden")}function d(){c("#pys_event_pinterest_params_enabled").is(":checked")?c("#pinterest_params_panel").show():c("#pinterest_params_panel").hide()}function y(){var e=c("#pys_event_pinterest_event_type").val();c("#pinterest_params_panel").removeClass().addClass(e)}function m(){"custom"===c("#pys_event_pinterest_params_currency").val()?c(".pinterest-custom-currency").css("visibility","visible"):c(".pinterest-custom-currency").css("visibility","hidden")}function f(){c("#pys_event_ga_enabled").is(":checked")?c("#analytics_panel").show():c("#analytics_panel").hide()}function h(){"_custom"===c("#pys_event_ga_event_action").val() || "CustomEvent"===c("#pys_event_ga_event_action").val()?c("#ga-custom-action").css("visibility","visible"):c("#ga-custom-action").css("visibility","hidden")}function g(){c("#pys_event_bing_enabled").is(":checked")?c("#bing_panel").show():c("#bing_panel").hide()}c(function(){c('[data-toggle="pys-popover"]').popover({container:"#pys",html:!0,content:function(){return c("#pys-"+c(this).data("popover_id")).html()}})}),c(".pys-select2").select2(),c(".pys-tags-select2").select2({tags:!0,tokenSeparators:[","," "]}),c("select.controls-visibility").on("change",function(e){n(c(this))}).each(function(e,t){n(c(t))}),c(".card-collapse").on("click",function(){var e=c(this).closest(".card").children(".card-body");e.hasClass("show")?e.hide().removeClass("show"):e.show().addClass("show")}),c(".collapse-control .custom-switch-input").on('change',function(){var e=c(this),t=c("."+e.data("target"));0<t.length&&(e.prop("checked")?t.show():t.hide())}).trigger("change"),e(),c('input[name="pys[core][woo_event_value]"]').on('change',function(){e()}),t(),c('input[name="pys[core][edd_event_value]"]').on('change',function(){t()}),c("#pys_select_all_events").on('change',function(){c(this).prop("checked")?c(".pys-select-event").prop("checked","checked"):c(".pys-select-event").prop("checked",!1)}),i(),a(),c("#pys_event_trigger_type").on('change',function(){i(),a()}),c(".add-event-trigger").on("click",function(){var e=c(this).closest(".event_triggers_panel");s(e,e.data("trigger_type"))}),c(".remove-row").on("click",function(e){c(this).closest(".row.event_trigger, .row.facebook-custom-param, .row.pinterest-custom-param").remove()}),o(),r(),p(),_(),l(),c("#pys_event_facebook_enabled").on("click",function(){o()}),c("#pys_event_facebook_event_type").on('change',function(){r(),_()}),c("#pys_event_facebook_params_enabled").on("click",function(){p()}),c("#pys_event_facebook_params_currency").on('change',function(){l()}),c(".add-facebook-parameter").on("click",function(){var e=c("#facebook_params_panel"),t=c(".facebook-custom-param",e),n=c(t[0]).clone(!0),a=c(t[t.length-1]).data("param_id")+1,s="pys[event][facebook_custom_params]["+a+"]";n.data("param_id",a),c("input.custom-param-name",n).attr("name",s+"[name]"),c("input.custom-param-value",n).attr("name",s+"[value]"),n.css("display","flex"),n.insertBefore(c(".insert-marker",e))}),v(),u(),d(),y(),m(),c("#pys_event_pinterest_enabled").on("click",function(){v()}),c("#pys_event_pinterest_event_type").on('change',function(){u(),y()}),c("#pys_event_pinterest_params_enabled").on("click",function(){d()}),c("#pys_event_pinterest_params_currency").on('change',function(){m()}),c(".add-pinterest-parameter").on("click",function(){var e=c("#pinterest_params_panel"),t=c(".pinterest-custom-param",e),n=c(t[0]).clone(!0),a=c(t[t.length-1]).data("param_id")+1,s="pys[event][pinterest_custom_params]["+a+"]";n.data("param_id",a),c("input.custom-param-name",n).attr("name",s+"[name]"),c("input.custom-param-value",n).attr("name",s+"[value]"),n.css("display","flex"),n.insertBefore(c(".insert-marker",e))}),f(),h(),c("#pys_event_ga_enabled").on("click",function(){f()}),c("#pys_event_ga_event_action").on('change',function(){h()}),g(),c("#pys_event_bing_enabled").on("click",function(){g()})});
3
 
4
  jQuery( document ).ready(function($) {
5
  updateFDPValue($("#pys_facebook_fdp_purchase_event_fire"));
93
  }
94
  }
95
 
96
+ $("#pys_core_automatic_events_enabled").on("change",function () {
97
+ var $headSwitch = $(this).parents(".card-header").find(".card-collapse")
98
+ var $body = $(this).parents(".card").children(".card-body")
99
+ if($(this).is(':checked')) {
100
+ $headSwitch.css("display","block")
101
+ } else {
102
+ $body.removeClass("show")
103
+ $body.css("display","none")
104
+ $headSwitch.css("display","none")
105
+ }
106
+
107
+ })
108
+
109
 
110
  });
111
 
dist/scripts/public.js CHANGED
@@ -1325,6 +1325,11 @@ if (!Array.prototype.includes) {
1325
 
1326
  }
1327
  function mapParamsTov4(tag,name,param) {
 
 
 
 
 
1328
  if(isv4(tag)) {
1329
  delete param.traffic_source;
1330
  delete param.event_category;
@@ -1341,117 +1346,171 @@ if (!Array.prototype.includes) {
1341
  delete param.dynx_totalvalue;
1342
  }
1343
  } else {
1344
- //delete standard params
1345
- delete param.page_title;
1346
- delete param.post_type;
1347
- delete param.post_id;
1348
- delete param.plugin;
1349
- delete param.page_title;
1350
- delete param.event_url;
1351
- delete param.user_role;
1352
- delete param.cartlows;
1353
- delete param.cartflows_flow;
1354
- delete param.cartflows_step;
1355
 
1356
- if(name === 'Signal') {
1357
- switch (param.event_action) {
1358
- case 'External Click':
1359
- case 'Internal Click':
1360
- case 'Tel':
1361
- case 'Email': {
1362
- let params = {
1363
- event_category: name,
1364
- event_action: param.event_action,
1365
- non_interaction: param.non_interaction,
1366
- }
1367
- if(options.trackTrafficSource) {
1368
- params['traffic_source'] = param.traffic_source
1369
- }
1370
- return params;
1371
- }break;
1372
- case 'Video': {
1373
- let params = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1374
  event_category: name,
1375
  event_action: param.event_action,
1376
- event_label: param.video_title,
1377
  non_interaction: param.non_interaction,
1378
  }
1379
  if(options.trackTrafficSource) {
1380
  params['traffic_source'] = param.traffic_source
1381
  }
1382
  return params;
1383
- }break;
1384
- case 'Comment': {
 
 
 
 
1385
  let params = {
1386
  event_category: name,
1387
  event_action: param.event_action,
1388
- event_label: document.location.href,
1389
- non_interaction: param.non_interaction,
1390
- }
1391
- if(options.trackTrafficSource) {
1392
- params['traffic_source'] = param.traffic_source
1393
- }
1394
- return params;
1395
- }break;
1396
- case 'Form': {
1397
- var params = {
1398
- event_category: name,
1399
- event_action: param.event_action,
1400
  non_interaction: param.non_interaction,
 
1401
  };
1402
  if(options.trackTrafficSource) {
1403
  params['traffic_source'] = param.traffic_source
1404
  }
1405
- var formClass = (typeof param.form_class != 'undefined') ? 'class: ' + param.form_class : '';
1406
- if(formClass != "") {
1407
- params["event_label"] = formClass;
1408
- }
1409
- return params;
1410
- }break;
1411
- case 'Download': {
1412
- return {
1413
- event_category: name,
1414
- event_action: param.event_action,
1415
- event_label: param.download_name,
1416
- non_interaction: param.non_interaction,
1417
- }
1418
- }break;
1419
- }
1420
- if(param.event_action.indexOf('Scroll') === 0){
1421
- var scroll_percent = param.event_action.substring(
1422
- param.event_action.indexOf(' ')+1,
1423
- param.event_action.indexOf('%')
1424
- );
1425
- let params = {
1426
- event_category: name,
1427
- event_action: param.event_action,
1428
- event_label: scroll_percent,
1429
- non_interaction: param.non_interaction,
1430
- }
1431
- if(options.trackTrafficSource) {
1432
- params['traffic_source'] = param.traffic_source
1433
  }
1434
- return params;
1435
- }
1436
- if(param.event_action.indexOf('Time on page') === 0) {
1437
- let time_on_page = param.event_action.substring(
1438
- 14,
1439
- param.event_action.indexOf(' seconds')
1440
- );
1441
- let params = {
1442
- event_category: name,
1443
- event_action: param.event_action,
1444
- event_label: time_on_page,
1445
- non_interaction: param.non_interaction,
1446
-
1447
- };
1448
- if(options.trackTrafficSource) {
1449
- params['traffic_source'] = param.traffic_source
1450
- }
1451
- return params
1452
  }
1453
  }
1454
 
 
 
 
 
 
 
 
 
 
1455
  }
1456
  return param;
1457
  }
@@ -1725,23 +1784,39 @@ if (!Array.prototype.includes) {
1725
 
1726
  Utils.setupGdprCallbacks();
1727
  // page scroll event
1728
- if (options.dynamicEvents.hasOwnProperty("signal_page_scroll")) {
 
 
1729
 
1730
  var singlePageScroll = function () {
1731
 
1732
 
1733
  var docHeight = $(document).height() - $(window).height();
1734
  var isFired = false;
1735
- var pixels = Object.keys(options.dynamicEvents.signal_page_scroll);
1736
-
1737
- for(var i = 0;i<pixels.length;i++) {
1738
- var event = Utils.clone(options.dynamicEvents.signal_page_scroll[pixels[i]]);
1739
- var scroll = Math.round(docHeight * event.scroll_percent / 100)// convert % to absolute positions
1740
-
1741
- if(scroll < $(window).scrollTop()) {
1742
- Utils.copyProperties(Utils.getRequestParams(), event.params);
1743
- getPixelBySlag(pixels[i]).onPageScroll(event);
1744
- isFired = true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1745
  }
1746
  }
1747
  if(isFired) {
@@ -1750,7 +1825,7 @@ if (!Array.prototype.includes) {
1750
  }
1751
  $(document).on("scroll",singlePageScroll);
1752
  }
1753
- // page on time
1754
  if (options.dynamicEvents.hasOwnProperty("signal_time_on_page")) {
1755
  var pixels = Object.keys(options.dynamicEvents.signal_time_on_page);
1756
  var time = options.dynamicEvents.signal_time_on_page[pixels[0]].time_on_page; // the same for all pixel
@@ -1763,15 +1838,31 @@ if (!Array.prototype.includes) {
1763
  },time*1000);
1764
  }
1765
 
 
 
 
 
 
 
 
 
 
 
 
 
1766
  // setup Click Event
1767
- if (options.dynamicEvents.hasOwnProperty("signal_download")) {
 
1768
 
1769
  $(document).onFirst('click', 'a, button, input[type="button"], input[type="submit"]', function (e) {
1770
 
1771
  var $elem = $(this);
1772
 
1773
  // Download
1774
- if (options.dynamicEvents.hasOwnProperty("signal_download")) {
 
 
 
1775
  var isFired = false;
1776
  if ($elem.is('a')) {
1777
  var href = $elem.attr('href');
@@ -1783,25 +1874,50 @@ if (!Array.prototype.includes) {
1783
  var track_download = false;
1784
 
1785
  if (extension.length > 0) {
1786
- var pixels = Object.keys(options.dynamicEvents.signal_download);
1787
- for (var i = 0; i < pixels.length; i++) {
1788
- var event = Utils.clone(options.dynamicEvents.signal_download[pixels[i]]);
1789
- var extensions = event.extensions;
1790
- if (extensions.includes(extension)) {
1791
- if(options.enable_remove_download_url_param) {
1792
- href = href.split('?')[0];
 
 
 
 
 
 
 
 
1793
  }
1794
- event.params.download_url = href;
1795
- event.params.download_type = extension;
1796
- event.params.download_name = Utils.getLinkFilename(href);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1797
 
1798
- getPixelBySlag(pixels[i]).onDownloadEvent(event);
1799
- isFired = true;
1800
  }
1801
  }
1802
  }
1803
  }
1804
- if (isFired) { // prevent duplicate events on the same element
1805
  return;
1806
  }
1807
  }
@@ -2058,15 +2174,26 @@ if (!Array.prototype.includes) {
2058
  }
2059
 
2060
  // setup Comment Event
2061
- if (options.dynamicEvents.hasOwnProperty("signal_comment")) {
 
 
2062
 
2063
  $('form.comment-form').on("submit",function () {
2064
-
2065
- var pixels = Object.keys(options.dynamicEvents.signal_comment);
2066
- for(var i = 0;i<pixels.length;i++) {
2067
- var event = Utils.clone(options.dynamicEvents.signal_comment[pixels[i]]);
2068
- Utils.copyProperties(Utils.getRequestParams(), event.params);
2069
- getPixelBySlag(pixels[i]).onCommentEvent(event);
 
 
 
 
 
 
 
 
 
2070
  }
2071
  });
2072
 
@@ -2074,7 +2201,8 @@ if (!Array.prototype.includes) {
2074
 
2075
 
2076
  // setup Form Event
2077
- if ( options.dynamicEvents.hasOwnProperty("signal_form")) {
 
2078
 
2079
  $(document).onFirst('submit', 'form', function (e) {
2080
 
@@ -2102,12 +2230,29 @@ if (!Array.prototype.includes) {
2102
  text: $form.find('[type="submit"]').is('input') ?
2103
  $form.find('[type="submit"]').val() : $form.find('[type="submit"]').text()
2104
  };
2105
- var pixels = Object.keys(options.dynamicEvents.signal_form);
2106
- for(var i = 0;i<pixels.length;i++) {
2107
- var event = Utils.clone(options.dynamicEvents.signal_form[pixels[i]]);
2108
- Utils.copyProperties(params,event.params,)
2109
- Utils.copyProperties(Utils.getRequestParams(), event.params);
2110
- getPixelBySlag(pixels[i]).onFormEvent(event);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2111
  }
2112
  });
2113
 
@@ -2117,13 +2262,23 @@ if (!Array.prototype.includes) {
2117
  form_id: $(formData.target).find('input[name="form_id"]').val(),
2118
  text: $(formData.target).find('.forminator-button-submit').text()
2119
  };
2120
-
2121
- var pixels = Object.keys(options.dynamicEvents.signal_form);
2122
- for(var i = 0;i<pixels.length;i++) {
2123
- var event = Utils.clone(options.dynamicEvents.signal_form[pixels[i]]);
2124
- Utils.copyProperties(params,event.params)
2125
- Utils.copyProperties(Utils.getRequestParams(), event.params);
2126
- getPixelBySlag(pixels[i]).onFormEvent(event);
 
 
 
 
 
 
 
 
 
 
2127
  }
2128
  });
2129
 
@@ -2134,13 +2289,23 @@ if (!Array.prototype.includes) {
2134
  form_id: data.response.data.form_id,
2135
  text: data.response.data.settings.title
2136
  };
2137
-
2138
- var pixels = Object.keys(options.dynamicEvents.signal_form);
2139
- for(var i = 0;i<pixels.length;i++) {
2140
- var event = Utils.clone(options.dynamicEvents.signal_form[pixels[i]]);
2141
- Utils.copyProperties(params,event.params)
2142
- Utils.copyProperties(Utils.getRequestParams(), event.params);
2143
- getPixelBySlag(pixels[i]).onFormEvent(event);
 
 
 
 
 
 
 
 
 
 
2144
  }
2145
 
2146
  });
1325
 
1326
  }
1327
  function mapParamsTov4(tag,name,param) {
1328
+ //GA4 automatically collects a number of parameters for all events
1329
+ delete param.page_title;
1330
+ delete param.event_url;
1331
+ delete param.landing_page;
1332
+ // end
1333
  if(isv4(tag)) {
1334
  delete param.traffic_source;
1335
  delete param.event_category;
1346
  delete param.dynx_totalvalue;
1347
  }
1348
  } else {
 
 
 
 
 
 
 
 
 
 
 
1349
 
1350
+ switch (name) {
1351
+
1352
+ case 'Comment' :
1353
+ case 'login' :
1354
+ case 'sign_up' :
1355
+ case 'EmailClick' :
1356
+ case 'TelClick' : {
1357
+ let params = {
1358
+ event_category: "Key Actions",
1359
+ event_action: name,
1360
+ // non_interaction: param.non_interaction,
1361
+ }
1362
+ return params;
1363
+ }
1364
+ case 'Form' : {
1365
+ let params = {
1366
+ event_category: "Key Actions",
1367
+ event_action: name,
1368
+ // non_interaction: param.non_interaction,
1369
+ }
1370
+ var formClass = (typeof param.form_class != 'undefined') ? 'class: ' + param.form_class : '';
1371
+ if(formClass != "") {
1372
+ params["event_label"] = formClass;
1373
+ }
1374
+ return params;
1375
+ }
1376
+ case 'Download' : {
1377
+ let params = {
1378
+ event_category: "Key Actions",
1379
+ event_action: name,
1380
+ event_label: param.download_name,
1381
+ // non_interaction: param.non_interaction,
1382
+ }
1383
+ return params;
1384
+ }
1385
+ case 'TimeOnPage' :
1386
+ case 'PageScroll' : {
1387
+ let params = {
1388
+ event_category: "Key Actions",
1389
+ event_action: name,
1390
+ event_label: document.title,
1391
+ // non_interaction: param.non_interaction,
1392
+ }
1393
+ return params;
1394
+ }
1395
+ case 'search' : {
1396
+ let params = {
1397
+ event_category: "Key Actions",
1398
+ event_action: name,
1399
+ event_label: param.search_term,
1400
+ // non_interaction: param.non_interaction,
1401
+ }
1402
+ return params;
1403
+ }
1404
+
1405
+ case 'Signal': {
1406
+ switch (param.event_action) {
1407
+ case 'External Click':
1408
+ case 'Internal Click':
1409
+ case 'Tel':
1410
+ case 'Email': {
1411
+ let params = {
1412
+ event_category: name,
1413
+ event_action: param.event_action,
1414
+ non_interaction: param.non_interaction,
1415
+ }
1416
+ if(options.trackTrafficSource) {
1417
+ params['traffic_source'] = param.traffic_source
1418
+ }
1419
+ return params;
1420
+ }break;
1421
+ case 'Video': {
1422
+ let params = {
1423
+ event_category: name,
1424
+ event_action: param.event_action,
1425
+ event_label: param.video_title,
1426
+ non_interaction: param.non_interaction,
1427
+ }
1428
+ if(options.trackTrafficSource) {
1429
+ params['traffic_source'] = param.traffic_source
1430
+ }
1431
+ return params;
1432
+ }break;
1433
+ case 'Comment': {
1434
+ let params = {
1435
+ event_category: name,
1436
+ event_action: param.event_action,
1437
+ event_label: document.location.href,
1438
+ non_interaction: param.non_interaction,
1439
+ }
1440
+ if(options.trackTrafficSource) {
1441
+ params['traffic_source'] = param.traffic_source
1442
+ }
1443
+ return params;
1444
+ }break;
1445
+ case 'Form': {
1446
+ var params = {
1447
+ event_category: name,
1448
+ event_action: param.event_action,
1449
+ non_interaction: param.non_interaction,
1450
+ };
1451
+ if(options.trackTrafficSource) {
1452
+ params['traffic_source'] = param.traffic_source
1453
+ }
1454
+ var formClass = (typeof param.form_class != 'undefined') ? 'class: ' + param.form_class : '';
1455
+ if(formClass != "") {
1456
+ params["event_label"] = formClass;
1457
+ }
1458
+ return params;
1459
+ }break;
1460
+ case 'Download': {
1461
+ return {
1462
+ event_category: name,
1463
+ event_action: param.event_action,
1464
+ event_label: param.download_name,
1465
+ non_interaction: param.non_interaction,
1466
+ }
1467
+ }break;
1468
+ }
1469
+ if(param.event_action.indexOf('Scroll') === 0){
1470
+ var scroll_percent = param.event_action.substring(
1471
+ param.event_action.indexOf(' ')+1,
1472
+ param.event_action.indexOf('%')
1473
+ );
1474
+ let params = {
1475
  event_category: name,
1476
  event_action: param.event_action,
1477
+ event_label: scroll_percent,
1478
  non_interaction: param.non_interaction,
1479
  }
1480
  if(options.trackTrafficSource) {
1481
  params['traffic_source'] = param.traffic_source
1482
  }
1483
  return params;
1484
+ }
1485
+ if(param.event_action.indexOf('Time on page') === 0) {
1486
+ let time_on_page = param.event_action.substring(
1487
+ 14,
1488
+ param.event_action.indexOf(' seconds')
1489
+ );
1490
  let params = {
1491
  event_category: name,
1492
  event_action: param.event_action,
1493
+ event_label: time_on_page,
 
 
 
 
 
 
 
 
 
 
 
1494
  non_interaction: param.non_interaction,
1495
+
1496
  };
1497
  if(options.trackTrafficSource) {
1498
  params['traffic_source'] = param.traffic_source
1499
  }
1500
+ return params
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1501
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1502
  }
1503
  }
1504
 
1505
+ //delete standard params
1506
+
1507
+ delete param.post_type;
1508
+ delete param.post_id;
1509
+ delete param.plugin;
1510
+ delete param.user_role;
1511
+ delete param.cartlows;
1512
+ delete param.cartflows_flow;
1513
+ delete param.cartflows_step;
1514
  }
1515
  return param;
1516
  }
1784
 
1785
  Utils.setupGdprCallbacks();
1786
  // page scroll event
1787
+ if (options.dynamicEvents.hasOwnProperty("signal_page_scroll")
1788
+ || options.dynamicEvents.hasOwnProperty("automatic_event_scroll")
1789
+ ) {
1790
 
1791
  var singlePageScroll = function () {
1792
 
1793
 
1794
  var docHeight = $(document).height() - $(window).height();
1795
  var isFired = false;
1796
+ if (options.dynamicEvents.hasOwnProperty("signal_page_scroll")) {
1797
+ var pixels = Object.keys(options.dynamicEvents.signal_page_scroll);
1798
+ for(var i = 0;i<pixels.length;i++) {
1799
+ var event = Utils.clone(options.dynamicEvents.signal_page_scroll[pixels[i]]);
1800
+ var scroll = Math.round(docHeight * event.scroll_percent / 100)// convert % to absolute positions
1801
+
1802
+ if(scroll < $(window).scrollTop()) {
1803
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
1804
+ getPixelBySlag(pixels[i]).onPageScroll(event);
1805
+ isFired = true
1806
+ }
1807
+ }
1808
+ }
1809
+ if (options.dynamicEvents.hasOwnProperty("automatic_event_scroll")) {
1810
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_scroll);
1811
+ for(var i = 0;i<pixels.length;i++) {
1812
+ var event = Utils.clone(options.dynamicEvents.automatic_event_scroll[pixels[i]]);
1813
+ var scroll = Math.round(docHeight * event.scroll_percent / 100)// convert % to absolute positions
1814
+
1815
+ if(scroll < $(window).scrollTop()) {
1816
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
1817
+ getPixelBySlag(pixels[i]).onPageScroll(event);
1818
+ isFired = true
1819
+ }
1820
  }
1821
  }
1822
  if(isFired) {
1825
  }
1826
  $(document).on("scroll",singlePageScroll);
1827
  }
1828
+
1829
  if (options.dynamicEvents.hasOwnProperty("signal_time_on_page")) {
1830
  var pixels = Object.keys(options.dynamicEvents.signal_time_on_page);
1831
  var time = options.dynamicEvents.signal_time_on_page[pixels[0]].time_on_page; // the same for all pixel
1838
  },time*1000);
1839
  }
1840
 
1841
+ if (options.dynamicEvents.hasOwnProperty("automatic_event_time_on_page")) {
1842
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_time_on_page);
1843
+ var time = options.dynamicEvents.automatic_event_time_on_page[pixels[0]].time_on_page; // the same for all pixel
1844
+ setTimeout(function(){
1845
+ for(var i = 0;i<pixels.length;i++) {
1846
+ var event = Utils.clone(options.dynamicEvents.automatic_event_time_on_page[pixels[i]]);
1847
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
1848
+ getPixelBySlag(pixels[i]).onTime(event);
1849
+ }
1850
+ },time*1000);
1851
+ }
1852
+
1853
  // setup Click Event
1854
+ if (options.dynamicEvents.hasOwnProperty("automatic_event_download") ||
1855
+ options.dynamicEvents.hasOwnProperty("signal_download")) {
1856
 
1857
  $(document).onFirst('click', 'a, button, input[type="button"], input[type="submit"]', function (e) {
1858
 
1859
  var $elem = $(this);
1860
 
1861
  // Download
1862
+ if(
1863
+ options.dynamicEvents.hasOwnProperty("signal_download")
1864
+ || options.dynamicEvents.hasOwnProperty("automatic_event_download")
1865
+ ) {
1866
  var isFired = false;
1867
  if ($elem.is('a')) {
1868
  var href = $elem.attr('href');
1874
  var track_download = false;
1875
 
1876
  if (extension.length > 0) {
1877
+ if(options.dynamicEvents.hasOwnProperty("signal_download") ) {
1878
+ var pixels = Object.keys(options.dynamicEvents.signal_download);
1879
+ for (var i = 0; i < pixels.length; i++) {
1880
+ var event = Utils.clone(options.dynamicEvents.signal_download[pixels[i]]);
1881
+ var extensions = event.extensions;
1882
+ if (extensions.includes(extension)) {
1883
+ if (options.enable_remove_download_url_param) {
1884
+ href = href.split('?')[0];
1885
+ }
1886
+ event.params.download_url = href;
1887
+ event.params.download_type = extension;
1888
+ event.params.download_name = Utils.getLinkFilename(href);
1889
+
1890
+ getPixelBySlag(pixels[i]).onDownloadEvent(event);
1891
+ isFired = true;
1892
  }
1893
+ }
1894
+ }
1895
+ if(options.dynamicEvents.hasOwnProperty("automatic_event_download") ) {
1896
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_download);
1897
+ for (var i = 0; i < pixels.length; i++) {
1898
+ var event = Utils.clone(options.dynamicEvents.automatic_event_download[pixels[i]]);
1899
+ var extensions = event.extensions;
1900
+ if (extensions.includes(extension)) {
1901
+
1902
+ if(pixels[i] == "tiktok") {
1903
+ getPixelBySlag(pixels[i]).fireEvent(tikEvent.name, event);
1904
+ } else {
1905
+ if (options.enable_remove_download_url_param) {
1906
+ href = href.split('?')[0];
1907
+ }
1908
+ event.params.download_url = href;
1909
+ event.params.download_type = extension;
1910
+ event.params.download_name = Utils.getLinkFilename(href);
1911
+ getPixelBySlag(pixels[i]).onDownloadEvent(event);
1912
+ }
1913
 
1914
+ isFired = true;
1915
+ }
1916
  }
1917
  }
1918
  }
1919
  }
1920
+ if(isFired) { // prevent duplicate events on the same element
1921
  return;
1922
  }
1923
  }
2174
  }
2175
 
2176
  // setup Comment Event
2177
+ if (options.dynamicEvents.hasOwnProperty("signal_comment")
2178
+ || options.dynamicEvents.hasOwnProperty("automatic_event_comment")
2179
+ ) {
2180
 
2181
  $('form.comment-form').on("submit",function () {
2182
+ if (options.dynamicEvents.hasOwnProperty("signal_comment")) {
2183
+ var pixels = Object.keys(options.dynamicEvents.signal_comment);
2184
+ for (var i = 0; i < pixels.length; i++) {
2185
+ var event = Utils.clone(options.dynamicEvents.signal_comment[pixels[i]]);
2186
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2187
+ getPixelBySlag(pixels[i]).onCommentEvent(event);
2188
+ }
2189
+ }
2190
+ if (options.dynamicEvents.hasOwnProperty("automatic_event_comment")) {
2191
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_comment);
2192
+ for (var i = 0; i < pixels.length; i++) {
2193
+ var event = Utils.clone(options.dynamicEvents.automatic_event_comment[pixels[i]]);
2194
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2195
+ getPixelBySlag(pixels[i]).onCommentEvent(event);
2196
+ }
2197
  }
2198
  });
2199
 
2201
 
2202
 
2203
  // setup Form Event
2204
+ if ( options.dynamicEvents.hasOwnProperty("signal_form")
2205
+ || options.dynamicEvents.hasOwnProperty("automatic_event_form")) {
2206
 
2207
  $(document).onFirst('submit', 'form', function (e) {
2208
 
2230
  text: $form.find('[type="submit"]').is('input') ?
2231
  $form.find('[type="submit"]').val() : $form.find('[type="submit"]').text()
2232
  };
2233
+ if(options.dynamicEvents.hasOwnProperty("signal_form") ) {
2234
+ var pixels = Object.keys(options.dynamicEvents.signal_form);
2235
+ for (var i = 0; i < pixels.length; i++) {
2236
+ var event = Utils.clone(options.dynamicEvents.signal_form[pixels[i]]);
2237
+ Utils.copyProperties(params, event.params,)
2238
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2239
+ getPixelBySlag(pixels[i]).onFormEvent(event);
2240
+
2241
+ }
2242
+ }
2243
+ if(options.dynamicEvents.hasOwnProperty("automatic_event_form") ) {
2244
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_form);
2245
+ for (var i = 0; i < pixels.length; i++) {
2246
+ var event = Utils.clone(options.dynamicEvents.automatic_event_form[pixels[i]]);
2247
+
2248
+ if(pixels[i] === "tiktok") {
2249
+ getPixelBySlag(pixels[i]).fireEvent(event.name, event);
2250
+ } else {
2251
+ Utils.copyProperties(params, event.params,)
2252
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2253
+ getPixelBySlag(pixels[i]).onFormEvent(event);
2254
+ }
2255
+ }
2256
  }
2257
  });
2258
 
2262
  form_id: $(formData.target).find('input[name="form_id"]').val(),
2263
  text: $(formData.target).find('.forminator-button-submit').text()
2264
  };
2265
+ if(options.dynamicEvents.hasOwnProperty("signal_form") ) {
2266
+ var pixels = Object.keys(options.dynamicEvents.signal_form);
2267
+ for (var i = 0; i < pixels.length; i++) {
2268
+ var event = Utils.clone(options.dynamicEvents.signal_form[pixels[i]]);
2269
+ Utils.copyProperties(params, event.params)
2270
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2271
+ getPixelBySlag(pixels[i]).onFormEvent(event);
2272
+ }
2273
+ }
2274
+ if(options.dynamicEvents.hasOwnProperty("automatic_event_form") ) {
2275
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_form);
2276
+ for (var i = 0; i < pixels.length; i++) {
2277
+ var event = Utils.clone(options.dynamicEvents.automatic_event_form[pixels[i]]);
2278
+ Utils.copyProperties(params, event.params)
2279
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2280
+ getPixelBySlag(pixels[i]).onFormEvent(event);
2281
+ }
2282
  }
2283
  });
2284
 
2289
  form_id: data.response.data.form_id,
2290
  text: data.response.data.settings.title
2291
  };
2292
+ if(options.dynamicEvents.hasOwnProperty("signal_form") ) {
2293
+ var pixels = Object.keys(options.dynamicEvents.signal_form);
2294
+ for(var i = 0;i<pixels.length;i++) {
2295
+ var event = options.dynamicEvents.signal_form[pixels[i]];
2296
+ Utils.copyProperties(params,event.params)
2297
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2298
+ getPixelBySlag(pixels[i]).onFormEvent(event);
2299
+ }
2300
+ }
2301
+ if(options.dynamicEvents.hasOwnProperty("automatic_event_form") ) {
2302
+ var pixels = Object.keys(options.dynamicEvents.automatic_event_form);
2303
+ for(var i = 0;i<pixels.length;i++) {
2304
+ var event = options.dynamicEvents.automatic_event_form[pixels[i]];
2305
+ Utils.copyProperties(params,event.params)
2306
+ Utils.copyProperties(Utils.getRequestParams(), event.params);
2307
+ getPixelBySlag(pixels[i]).onFormEvent(event);
2308
+ }
2309
  }
2310
 
2311
  });
facebook-pixel-master.php CHANGED
@@ -3,17 +3,17 @@
3
  /**
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
- * Description: No coding <strong>Meta Pixel (formerly Facebook Pixel), Facebook Converion API,</strong> and <strong>Google Analytics</strong> install. Track key actions with our Signal event, or configure your own events. WooCommerce and EDD fully supported, with Facebook Dynamic Ads Pixel set-up and Google Analytics Enhanced Ecommerce. Insert any custom script with our Head & Footer option. Add the <strong>Pinterest Tag</strong> with our paid add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff. Full support for <strong>ConsentMagic.com</strong>.
7
- * Version: 8.2.18
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
11
  *
12
  * Requires at least: 4.4
13
- * Tested up to: 5.9
14
  *
15
  * WC requires at least: 2.6.0
16
- * WC tested up to: 6.3
17
  *
18
  * Text Domain: pys
19
  */
3
  /**
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
+ * Description: No coding <strong>Meta Pixel (formerly Facebook Pixel), Facebook Converion API,</strong> and <strong>Google Analytics</strong> install. Track key actions with our Automated Events, or configure your own events. WooCommerce and EDD fully supported, with Facebook Dynamic Ads Pixel set-up and Google Analytics Enhanced Ecommerce. Insert any custom script with our Head & Footer option. Add the <strong>Pinterest Tag</strong> with our paid add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff. Full support for <strong>ConsentMagic.com</strong>.
7
+ * Version: 9.0.0
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
11
  *
12
  * Requires at least: 4.4
13
+ * Tested up to: 6.0
14
  *
15
  * WC requires at least: 2.6.0
16
+ * WC tested up to: 6.4
17
  *
18
  * Text Domain: pys
19
  */
includes/class-events-manager.php CHANGED
@@ -94,8 +94,16 @@ class EventsManager {
94
  'cookie_law_info_integration_enabled' => isCookieLawInfoPluginActivated() && PYS()->getOption( 'gdpr_cookie_law_info_integration_enabled' ),
95
  );
96
 
97
- $options['edd'] = EventsEdd()->getOptions();
98
- $options['woo'] = EventsWoo()->getOptions();
 
 
 
 
 
 
 
 
99
 
100
 
101
  $data = array_merge( $data, $options );
@@ -141,23 +149,12 @@ class EventsManager {
141
  $this->addStaticEvent( $event,$pixel,"" );
142
  }
143
  }
144
- // search event
145
- if ( PYS()->getOption('search_event_enabled' ) && is_search() ) {
146
- $searchEvent = new SingleEvent('search_event', EventTypes::$STATIC,'');
147
 
148
- foreach (PYS()->getRegisteredPixels() as $pixel) {
149
- $events = $pixel->generateEvents( $searchEvent );
150
- foreach ($events as $event) {
151
- $event->addParams($this->standardParams);
152
- $this->addStaticEvent( $event,$pixel,"" );
153
- }
154
- }
155
- }
156
 
157
  /**
158
  * @var EventsFactory[] $eventsFactory
159
  **/
160
- $eventsFactory = array(EventsFdp(),EventsEdd(),EventsCustom(),EventsSignal(),EventsWoo());
161
 
162
  foreach ($eventsFactory as $factory) {
163
  if(!$factory->isEnabled()) continue;
@@ -190,6 +187,13 @@ class EventsManager {
190
  if(count($this->facebookServerEvents)>0 && Facebook()->enabled()) {
191
  FacebookServer()->sendEventsAsync($this->facebookServerEvents);
192
  }
 
 
 
 
 
 
 
193
  }
194
 
195
  public function getStaticEvents( $context ) {
@@ -296,8 +300,8 @@ class EventsManager {
296
  unset($data['params']['num_items']);
297
  }
298
 
299
- if(!PYS()->getOption("enable_woo_product_price_param")) {
300
- unset($data['params']['product_price']);
301
  }
302
 
303
  }
@@ -310,8 +314,8 @@ class EventsManager {
310
  unset($data['params']['num_items']);
311
  }
312
 
313
- if(!PYS()->getOption("enable_edd_product_price_param")) {
314
- unset($data['params']['product_price']);
315
  }
316
  }
317
 
@@ -409,20 +413,7 @@ class EventsManager {
409
 
410
  // variations ids
411
  if ( wooProductIsType( $product, 'variable' ) ) {
412
-
413
- /** @var \WC_Product_Variable $variation */
414
- foreach ( $product->get_available_variations() as $variation ) {
415
-
416
- $variation = wc_get_product( $variation['variation_id'] );
417
- if(!$variation) continue;
418
- if ( isWooCommerceVersionGte( '2.6' ) ) {
419
- $product_ids[] = $variation->get_id();
420
- } else {
421
- $product_ids[] = $variation->post->ID;
422
- }
423
-
424
- }
425
-
426
  }
427
 
428
  $params = array();
94
  'cookie_law_info_integration_enabled' => isCookieLawInfoPluginActivated() && PYS()->getOption( 'gdpr_cookie_law_info_integration_enabled' ),
95
  );
96
 
97
+ /**
98
+ * @var EventsFactory[] $eventsFactory
99
+ */
100
+ $eventsFactory = apply_filters("pys_event_factory",[]);
101
+ foreach ($eventsFactory as $factory) {
102
+ $opt = $factory->getOptions();
103
+ if(!empty($opt)) {
104
+ $options[$factory::getSlug()] = $factory->getOptions();
105
+ }
106
+ }
107
 
108
 
109
  $data = array_merge( $data, $options );
149
  $this->addStaticEvent( $event,$pixel,"" );
150
  }
151
  }
 
 
 
152
 
 
 
 
 
 
 
 
 
153
 
154
  /**
155
  * @var EventsFactory[] $eventsFactory
156
  **/
157
+ $eventsFactory = apply_filters("pys_event_factory",[]);
158
 
159
  foreach ($eventsFactory as $factory) {
160
  if(!$factory->isEnabled()) continue;
187
  if(count($this->facebookServerEvents)>0 && Facebook()->enabled()) {
188
  FacebookServer()->sendEventsAsync($this->facebookServerEvents);
189
  }
190
+
191
+ // remove new user mark
192
+ if($user_id = get_current_user_id()) {
193
+ if ( get_user_meta( $user_id, 'pys_complete_registration', true ) ) {
194
+ delete_user_meta( $user_id, 'pys_complete_registration' );
195
+ }
196
+ }
197
  }
198
 
199
  public function getStaticEvents( $context ) {
300
  unset($data['params']['num_items']);
301
  }
302
 
303
+ if(!PYS()->getOption("enable_woo_tags_param")) {
304
+ unset($data['params']['tags']);
305
  }
306
 
307
  }
314
  unset($data['params']['num_items']);
315
  }
316
 
317
+ if(!PYS()->getOption("enable_edd_tags_param")) {
318
+ unset($data['params']['tags']);
319
  }
320
  }
321
 
413
 
414
  // variations ids
415
  if ( wooProductIsType( $product, 'variable' ) ) {
416
+ $product_ids = array_merge($product_ids, $product->get_children());
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  }
418
 
419
  $params = array();
includes/class-pys.php CHANGED
@@ -67,7 +67,10 @@ final class PYS extends Settings implements Plugin {
67
 
68
  // run Events Manager
69
  add_action( 'template_redirect', array( $this, 'managePixels' ) );
70
-
 
 
 
71
  // "admin_permission" option custom sanitization function
72
  add_filter( 'pys_core_settings_sanitize_admin_permissions_field', function( $value ) {
73
 
@@ -166,6 +169,26 @@ final class PYS extends Settings implements Plugin {
166
  $this->registeredPixels[ $pixel->getSlug() ] = $pixel;
167
  }
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  /**
170
  * Return array of registered pixels
171
  *
67
 
68
  // run Events Manager
69
  add_action( 'template_redirect', array( $this, 'managePixels' ) );
70
+ // track user login event
71
+ add_action('wp_login', [$this,'userLogin'], 10, 2);
72
+ // track user registrations
73
+ add_action( 'user_register', array( $this, 'userRegisterHandler' ) );
74
  // "admin_permission" option custom sanitization function
75
  add_filter( 'pys_core_settings_sanitize_admin_permissions_field', function( $value ) {
76
 
169
  $this->registeredPixels[ $pixel->getSlug() ] = $pixel;
170
  }
171
 
172
+ /**
173
+ * Hook
174
+ * @param String $user_login
175
+ * @param \WP_User $user
176
+ */
177
+ function userLogin($user_login, $user) {
178
+ add_user_meta($user->ID,'pys_just_login',true);
179
+ }
180
+
181
+ public function userRegisterHandler( $user_id ) {
182
+
183
+ if ( PYS()->getOption( 'signal_user_signup_enabled' )
184
+ || PYS()->getOption( 'woo_complete_registration_enabled' )
185
+ || PYS()->getOption( 'automatic_event_signup_enabled' )
186
+ ) {
187
+ update_user_meta( $user_id, 'pys_complete_registration', true );
188
+ }
189
+
190
+ }
191
+
192
  /**
193
  * Return array of registered pixels
194
  *
includes/events/class-events-automatic.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace PixelYourSite;
3
+
4
+ /*
5
+ * Automatic Events we will fire this event in order to capture all actions like clicks, video
6
+ views, downloads, comments, forms.
7
+ * */
8
+
9
+ class EventsAutomatic extends EventsFactory {
10
+ private static $_instance;
11
+
12
+ private $events = array(
13
+ 'automatic_event_form' ,
14
+ 'automatic_event_signup' ,
15
+ 'automatic_event_login' ,
16
+ 'automatic_event_download' ,
17
+ 'automatic_event_comment' ,
18
+
19
+ 'automatic_event_scroll' ,
20
+ 'automatic_event_time_on_page' ,
21
+ 'automatic_event_search' ,
22
+ );
23
+
24
+ public static function instance() {
25
+
26
+ if ( is_null( self::$_instance ) ) {
27
+ self::$_instance = new self();
28
+ }
29
+
30
+ return self::$_instance;
31
+
32
+ }
33
+
34
+ private function __construct() {
35
+ add_filter("pys_event_factory",[$this,"register"]);
36
+ }
37
+
38
+ function register($list) {
39
+ $list[] = $this;
40
+ return $list;
41
+ }
42
+
43
+ static function getSlug() {
44
+ return "automatic";
45
+ }
46
+
47
+ function getEvents() {
48
+ return $this->events;
49
+ }
50
+
51
+ function getCount() {
52
+ $count = 0;
53
+ if($this->isEnabled()) {
54
+ foreach ($this->events as $event) {
55
+ if(PYS()->getOption($event."_enabled")) {
56
+ $count++;
57
+ }
58
+ }
59
+ }
60
+ return $count;
61
+ }
62
+
63
+
64
+ function isEnabled() {
65
+ return PYS()->getOption("automatic_events_enabled");
66
+ }
67
+
68
+ // return option for js part
69
+ function getOptions() {
70
+ return array(
71
+
72
+ );
73
+ }
74
+
75
+ /**
76
+ * Check is event ready for fire
77
+ * @param $event
78
+ * @return bool
79
+ */
80
+ function isReadyForFire($event) {
81
+
82
+ if(!$this->isEnabled()) return false;
83
+
84
+ if(!in_array($event,$this->events)) return false;
85
+
86
+ switch($event) {
87
+
88
+ case "automatic_event_login" : {
89
+ if($user_id = get_current_user_id()) {
90
+ if (get_user_meta($user_id, 'pys_just_login', true)) {
91
+ delete_user_meta($user_id, 'pys_just_login');
92
+ return PYS()->getOption( $event."_enabled");
93
+ }
94
+ }
95
+ return false;
96
+ }
97
+ case 'automatic_event_signup' : {
98
+ if ( $user_id = get_current_user_id() ) {
99
+ if ( get_user_meta( $user_id, 'pys_complete_registration', true ) ) {
100
+ return PYS()->getOption( $event."_enabled");
101
+ }
102
+ }
103
+ return false;
104
+ }
105
+ case 'automatic_event_search' : {
106
+ return PYS()->getOption( $event."_enabled") && is_search();
107
+ }
108
+ default: {
109
+ return PYS()->getOption( $event."_enabled");
110
+ }
111
+ }
112
+ }
113
+
114
+ /**
115
+ * @param String $event
116
+ * @return SingleEvent
117
+ */
118
+ function getEvent($event) {
119
+ $payload = [];
120
+ $params = [];
121
+ $item = new SingleEvent($event,EventTypes::$DYNAMIC,self::getSlug());
122
+ switch ($event) {
123
+
124
+
125
+ case "automatic_event_form": {
126
+ $payload['name'] = 'Form';
127
+ }break;
128
+ case "automatic_event_download": {
129
+ $payload['name'] = 'Download';
130
+ $payload["extensions"] = PYS()->getOption( 'automatic_event_download_extensions' );
131
+ }break;
132
+ case "automatic_event_comment": {
133
+ $payload['name'] = 'Comment';
134
+ }break;
135
+
136
+ case "automatic_event_scroll": {
137
+ $payload['name'] = 'PageScroll';
138
+ $payload["scroll_percent"] = PYS()->getOption('automatic_event_scroll_value');
139
+ }break;
140
+ case "automatic_event_time_on_page": {
141
+ $payload['name'] = 'TimeOnPage';
142
+ $payload["time_on_page"] = PYS()->getOption('automatic_event_time_on_page_value');
143
+
144
+ }break;
145
+ case "automatic_event_search":
146
+ case "automatic_event_signup":
147
+ case "automatic_event_login": {
148
+ $item = new SingleEvent($event,EventTypes::$STATIC,self::getSlug());
149
+ } break;
150
+ }
151
+
152
+ $item->addParams($params);
153
+ $item->addPayload($payload);
154
+ return $item;
155
+ }
156
+
157
+ }
158
+
159
+ /**
160
+ * @return EventsAutomatic
161
+ */
162
+ function EventsAutomatic() {
163
+ return EventsAutomatic::instance();
164
+ }
165
+
166
+ EventsAutomatic();
includes/events/class-events-custom.php CHANGED
@@ -17,7 +17,12 @@ class EventsCustom extends EventsFactory {
17
  }
18
 
19
  private function __construct() {
 
 
20
 
 
 
 
21
  }
22
 
23
 
17
  }
18
 
19
  private function __construct() {
20
+ add_filter("pys_event_factory",[$this,"register"]);
21
+ }
22
 
23
+ function register($list) {
24
+ $list[] = $this;
25
+ return $list;
26
  }
27
 
28
 
includes/events/class-events-edd.php CHANGED
@@ -33,7 +33,12 @@ class EventsEdd extends EventsFactory {
33
  }
34
 
35
  private function __construct() {
 
 
36
 
 
 
 
37
  }
38
 
39
  function getEvents() {
33
  }
34
 
35
  private function __construct() {
36
+ add_filter("pys_event_factory",[$this,"register"]);
37
+ }
38
 
39
+ function register($list) {
40
+ $list[] = $this;
41
+ return $list;
42
  }
43
 
44
  function getEvents() {
includes/events/class-events-fdp.php CHANGED
@@ -30,7 +30,12 @@ class EventsFdp extends EventsFactory
30
 
31
  private function __construct()
32
  {
 
 
33
 
 
 
 
34
  }
35
  function getEvents() {
36
  return $this->events;
30
 
31
  private function __construct()
32
  {
33
+ add_filter("pys_event_factory",[$this,"register"]);
34
+ }
35
 
36
+ function register($list) {
37
+ $list[] = $this;
38
+ return $list;
39
  }
40
  function getEvents() {
41
  return $this->events;
includes/events/class-events-signal.php CHANGED
@@ -38,7 +38,12 @@ class EventsSignal extends EventsFactory {
38
  }
39
 
40
  private function __construct() {
 
 
41
 
 
 
 
42
  }
43
  function getEvents() {
44
  return $this->events;
38
  }
39
 
40
  private function __construct() {
41
+ add_filter("pys_event_factory",[$this,"register"]);
42
+ }
43
 
44
+ function register($list) {
45
+ $list[] = $this;
46
+ return $list;
47
  }
48
  function getEvents() {
49
  return $this->events;
includes/events/class-events-woo.php CHANGED
@@ -58,7 +58,12 @@ class EventsWoo extends EventsFactory {
58
  }
59
 
60
  private function __construct() {
 
 
61
 
 
 
 
62
  }
63
 
64
  function getCount()
58
  }
59
 
60
  private function __construct() {
61
+ add_filter("pys_event_factory",[$this,"register"]);
62
+ }
63
 
64
+ function register($list) {
65
+ $list[] = $this;
66
+ return $list;
67
  }
68
 
69
  function getCount()
includes/functions-admin.php CHANGED
@@ -124,8 +124,8 @@ function getAdminSecondaryNavTabs() {
124
 
125
  }
126
 
127
- function cardCollapseBtn() {
128
- echo '<span class="card-collapse"><i class="fa fa-sliders" aria-hidden="true"></i></span>';
129
  }
130
 
131
  /**
124
 
125
  }
126
 
127
+ function cardCollapseBtn($attr = "") {
128
+ echo '<span class="card-collapse" '.$attr.'><i class="fa fa-sliders" aria-hidden="true"></i></span>';
129
  }
130
 
131
  /**
includes/functions-common.php CHANGED
@@ -104,7 +104,7 @@ function isBingVersionIncompatible() {
104
  * @return bool
105
  */
106
  function isWooCommerceActive() {
107
- return function_exists( 'WC' );
108
  }
109
 
110
  /**
104
  * @return bool
105
  */
106
  function isWooCommerceActive() {
107
+ return class_exists( 'woocommerce' );
108
  }
109
 
110
  /**
includes/options_defaults.json CHANGED
@@ -87,7 +87,6 @@
87
  "signal_download_enabled": true,
88
  "signal_comment_enabled": true,
89
 
90
- "search_event_enabled": true,
91
  "fdp_enabled": false,
92
  "edd_purchase_enabled": true,
93
  "edd_initiate_checkout_enabled": true,
@@ -114,12 +113,36 @@
114
 
115
  "enable_woo_category_name_param": true,
116
  "enable_woo_num_items_param": true,
117
- "enable_woo_product_price_param":true,
118
 
119
  "enable_edd_category_name_param": true,
120
  "enable_edd_num_items_param": true,
121
- "enable_edd_product_price_param": true,
122
  "enable_remove_download_url_param": true,
123
  "pys_logs_enable": false,
124
- "woo_add_to_cart_catch_method": "add_cart_js"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
87
  "signal_download_enabled": true,
88
  "signal_comment_enabled": true,
89
 
 
90
  "fdp_enabled": false,
91
  "edd_purchase_enabled": true,
92
  "edd_initiate_checkout_enabled": true,
113
 
114
  "enable_woo_category_name_param": true,
115
  "enable_woo_num_items_param": true,
116
+ "enable_woo_tags_param":true,
117
 
118
  "enable_edd_category_name_param": true,
119
  "enable_edd_num_items_param": true,
120
+ "enable_edd_tags_param": true,
121
  "enable_remove_download_url_param": true,
122
  "pys_logs_enable": false,
123
+ "woo_add_to_cart_catch_method": "add_cart_js",
124
+
125
+ "automatic_events_enabled": false,
126
+
127
+ "automatic_event_form_enabled": true,
128
+ "automatic_event_signup_enabled": true,
129
+ "automatic_event_login_enabled": true,
130
+ "automatic_event_download_enabled": true,
131
+ "automatic_event_comment_enabled": true,
132
+ "automatic_event_scroll_enabled": true,
133
+ "automatic_event_time_on_page_enabled": true,
134
+ "automatic_event_search_enabled": true,
135
+
136
+ "automatic_event_download_extensions": [
137
+ "doc",
138
+ "exe",
139
+ "js",
140
+ "pdf",
141
+ "ppt",
142
+ "tgz",
143
+ "zip",
144
+ "xls"
145
+ ],
146
+ "automatic_event_scroll_value": 30,
147
+ "automatic_event_time_on_page_value": 30
148
  }
includes/options_fields.json CHANGED
@@ -76,7 +76,6 @@
76
  "signal_download_enabled": "checkbox",
77
  "signal_comment_enabled": "checkbox",
78
 
79
- "search_event_enabled": "checkbox",
80
  "fdp_enabled": "checkbox",
81
  "edd_purchase_enabled":"checkbox",
82
  "edd_initiate_checkout_enabled":"checkbox",
@@ -103,11 +102,26 @@
103
 
104
  "enable_woo_category_name_param": "checkbox",
105
  "enable_woo_num_items_param": "checkbox",
106
- "enable_woo_product_price_param":"checkbox",
107
  "enable_edd_category_name_param": "checkbox",
108
  "enable_edd_num_items_param": "checkbox",
109
- "enable_edd_product_price_param": "checkbox",
110
  "enable_remove_download_url_param": "checkbox",
111
  "pys_logs_enable": "checkbox",
112
- "woo_add_to_cart_catch_method": "select"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
76
  "signal_download_enabled": "checkbox",
77
  "signal_comment_enabled": "checkbox",
78
 
 
79
  "fdp_enabled": "checkbox",
80
  "edd_purchase_enabled":"checkbox",
81
  "edd_initiate_checkout_enabled":"checkbox",
102
 
103
  "enable_woo_category_name_param": "checkbox",
104
  "enable_woo_num_items_param": "checkbox",
105
+ "enable_woo_tags_param":"checkbox",
106
  "enable_edd_category_name_param": "checkbox",
107
  "enable_edd_num_items_param": "checkbox",
108
+ "enable_edd_tags_param": "checkbox",
109
  "enable_remove_download_url_param": "checkbox",
110
  "pys_logs_enable": "checkbox",
111
+ "woo_add_to_cart_catch_method": "select",
112
+
113
+ "automatic_events_enabled": "checkbox",
114
+
115
+ "automatic_event_form_enabled": "checkbox",
116
+ "automatic_event_signup_enabled": "checkbox",
117
+ "automatic_event_login_enabled": "checkbox",
118
+ "automatic_event_download_enabled": "checkbox",
119
+ "automatic_event_comment_enabled": "checkbox",
120
+ "automatic_event_scroll_enabled": "checkbox",
121
+ "automatic_event_time_on_page_enabled": "checkbox",
122
+ "automatic_event_search_enabled": "checkbox",
123
+
124
+ "automatic_event_download_extensions": "tag_select",
125
+ "automatic_event_scroll_value": "number",
126
+ "automatic_event_time_on_page_value": "number"
127
  }
includes/views/html-main-edd.php CHANGED
@@ -75,7 +75,20 @@ if ( ! defined( 'ABSPATH' ) ) {
75
  </div>
76
  </div>
77
  </div>
78
-
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  <!-- Transaction ID -->
80
  <div class="card ">
81
  <div class="card-header">
@@ -1077,8 +1090,30 @@ e&utm_campaign=pro-feature' ); ?>
1077
  </div>
1078
  <div class="row">
1079
  <div class="col">
1080
- <?php PYS()->render_switcher_input( 'enable_edd_product_price_param' ); ?>
1081
- <h4 class="switcher-label">product_price</h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1082
  <hr>
1083
  </div>
1084
  </div>
75
  </div>
76
  </div>
77
  </div>
78
+ <!-- video -->
79
+ <div class="card card-static">
80
+ <div class="card-header">
81
+ Recommended Videos:
82
+ </div>
83
+ <div class="card-body">
84
+ <div class="row">
85
+ <div class="col">
86
+ <p>Enhanced Conversions for Google Ads with PixelYourSite (9:14) - <a href="https://www.youtube.com/watch?v=0uuTiOnVw80" target="_blank">watch now</a></p>
87
+ <p>Track Facebook (META) Ads results with Google Analytics 4 (GA4) using UTMs (10:13) - <a href="https://www.youtube.com/watch?v=v3TfmX5H1Ts" target="_blank">watch now</a></p>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
  <!-- Transaction ID -->
93
  <div class="card ">
94
  <div class="card-header">
1090
  </div>
1091
  <div class="row">
1092
  <div class="col">
1093
+ <?php PYS()->render_switcher_input( 'enable_edd_tags_param' ); ?>
1094
+ <h4 class="switcher-label">tags</h4>
1095
+ <hr>
1096
+ </div>
1097
+ </div>
1098
+
1099
+ <div class="row">
1100
+ <div class="col">
1101
+ <?php renderDummySwitcher(); ?>
1102
+ <h4 class="switcher-label">total (PRO)</h4>
1103
+ <hr>
1104
+ </div>
1105
+ </div>
1106
+ <div class="row">
1107
+ <div class="col">
1108
+ <?php renderDummySwitcher(); ?>
1109
+ <h4 class="switcher-label">tax (PRO)</h4>
1110
+ <hr>
1111
+ </div>
1112
+ </div>
1113
+ <div class="row">
1114
+ <div class="col">
1115
+ <?php renderDummySwitcher(); ?>
1116
+ <h4 class="switcher-label">coupon (PRO)</h4>
1117
  <hr>
1118
  </div>
1119
  </div>
includes/views/html-main-general.php CHANGED
@@ -146,7 +146,10 @@ if ( ! defined( 'ABSPATH' ) ) {
146
  <input type="checkbox" class="custom-control-input" name="pys[ga][is_enable_debug_mode][-1]" value="0" checked />
147
  <?php GA()->render_checkbox_input_array("is_enable_debug_mode","Enable Analytics Debug mode for this property");?>
148
  </div>
149
-
 
 
 
150
  <p class="mt-3 ">Add multiple Google Analytics tags with the <a href="https://www.pixelyoursite.com/?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-ids"
151
  target="_blank">pro version</a>.</p>
152
  <p>
@@ -184,6 +187,14 @@ if ( ! defined( 'ABSPATH' ) ) {
184
  Learn how to install the Google Ads Tag:
185
  <a href="https://www.youtube.com/watch?v=plkv_v4nz8I" target="_blank">watch video</a>
186
  </div>
 
 
 
 
 
 
 
 
187
  </div>
188
  </div>
189
  <hr>
@@ -396,73 +407,255 @@ if ( ! defined( 'ABSPATH' ) ) {
396
 
397
  </div>
398
  </div>
399
-
400
- <!-- Search -->
401
  <div class="card">
402
  <div class="card-header has_switch">
403
- <?php PYS()->render_switcher_input('search_event_enabled');?> Track Searches <?php cardCollapseBtn(); ?>
 
 
 
 
 
 
 
404
  </div>
405
  <div class="card-body">
406
- <div class="row">
407
- <div class="col-11">
408
- <p>This event will be fired when a search is performed on your website.</p>
 
409
  </div>
410
- <div class="col-1">
411
- <?php renderPopoverButton( 'search_event' ); ?>
 
 
 
 
 
 
 
412
  </div>
413
  </div>
414
 
415
- <?php if ( Facebook()->enabled() ) : ?>
416
- <div class="row">
417
- <div class="col">
418
- <?php Facebook()->render_switcher_input( 'search_event_enabled' ); ?>
419
- <h4 class="switcher-label">Enable the Search event on Facebook</h4>
420
- </div>
421
  </div>
422
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
 
424
- <?php if ( GA()->enabled() ) : ?>
425
- <div class="row mb-1">
426
- <div class="col">
427
- <?php GA()->render_switcher_input( 'search_event_enabled' ); ?>
428
- <h4 class="switcher-label">Enable the search event on Google Analytics</h4>
429
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  </div>
431
- <div class="row mb-2">
432
- <div class="col col-offset-left">
433
- <?php GA()->render_checkbox_input( 'search_event_non_interactive',
434
- 'Non-interactive event' ); ?>
435
- </div>
436
  </div>
437
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
438
 
439
- <div class="row">
440
- <div class="col">
441
- <?php renderDummySwitcher(); ?>
442
- <h4 class="switcher-label">Enable the search event on Google Ads</h4>
443
- <?php renderProBadge('https://www.pixelyoursite.com/google-ads-tag/?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  </div>
445
  </div>
446
 
447
- <?php if ( Bing()->enabled() ) : ?>
448
- <div class="row">
449
- <div class="col">
450
- <?php Bing()->render_switcher_input( 'search_event_enabled' ); ?>
451
- <h4 class="switcher-label">Enable the Search event on Bing</h4>
452
- <?php Bing()->renderAddonNotice(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  </div>
 
 
 
 
 
454
  </div>
455
- <?php endif; ?>
456
 
457
- <?php if ( Pinterest()->enabled() ) : ?>
458
- <div class="row">
459
- <div class="col">
460
- <?php Pinterest()->render_switcher_input( 'search_event_enabled' ); ?>
461
- <h4 class="switcher-label">Enable the Search event on Pinterest</h4>
462
- <?php Pinterest()->renderAddonNotice(); ?>
 
 
 
 
 
 
 
463
  </div>
 
464
  </div>
465
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  </div>
467
  </div>
468
 
@@ -608,10 +801,6 @@ if ( ! defined( 'ABSPATH' ) ) {
608
  $signalEvents = 1;
609
  }
610
 
611
- if(PYS()->getOption('search_event_enabled')) {
612
- $signalEvents++;
613
- }
614
-
615
  $total = $customCount + $signalEvents + $wooEvents + $eddEvents;
616
  ?>
617
  <p><strong>You have <?=$total?> active events in total.</strong></p>
@@ -869,3 +1058,42 @@ if ( ! defined( 'ABSPATH' ) ) {
869
  <button class="btn btn-block btn-save">Save Settings</button>
870
  </div>
871
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  <input type="checkbox" class="custom-control-input" name="pys[ga][is_enable_debug_mode][-1]" value="0" checked />
147
  <?php GA()->render_checkbox_input_array("is_enable_debug_mode","Enable Analytics Debug mode for this property");?>
148
  </div>
149
+ <p>
150
+ Learn how to get the Google Analytics 4 tag ID and how to test it:
151
+ <a href="https://www.youtube.com/watch?v=fwegcsO-yrc" target="_blank">watch video</a>
152
+ </p>
153
  <p class="mt-3 ">Add multiple Google Analytics tags with the <a href="https://www.pixelyoursite.com/?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-ids"
154
  target="_blank">pro version</a>.</p>
155
  <p>
187
  Learn how to install the Google Ads Tag:
188
  <a href="https://www.youtube.com/watch?v=plkv_v4nz8I" target="_blank">watch video</a>
189
  </div>
190
+ <div class="mt-3">
191
+ How to configure Google Ads Conversions:
192
+ <a href="https://www.youtube.com/watch?v=x1VvVDa5L7c" target="_blank">watch video</a>
193
+ </div>
194
+ <div class="mt-3">
195
+ Lear how to use Enhanced Conversions:
196
+ <a href="https://www.youtube.com/watch?v=0uuTiOnVw80" target="_blank">watch video</a>
197
+ </div>
198
  </div>
199
  </div>
200
  <hr>
407
 
408
  </div>
409
  </div>
410
+ <!-- Global Events -->
 
411
  <div class="card">
412
  <div class="card-header has_switch">
413
+ <?php PYS()->render_switcher_input('automatic_events_enabled'); ?>Track key actions with the automatic
414
+ events
415
+ <?php
416
+ if(!PYS()->getOption('automatic_events_enabled')) {
417
+ cardCollapseBtn('style="display:none"');
418
+ } else {
419
+ cardCollapseBtn();
420
+ } ?>
421
  </div>
422
  <div class="card-body">
423
+
424
+ <div class="card">
425
+ <div class="card-header has_switch">
426
+ <?php PYS()->render_switcher_input('automatic_event_form_enabled'); ?>Track Forms <?php cardCollapseBtn(); ?>
427
  </div>
428
+ <div class="card-body">
429
+ <?php
430
+ enableEventForEachPixel('automatic_event_form_enabled', true, true, true, true, true, true);
431
+ ?>
432
+ <br/>
433
+ <p>Fires when the website visitor clicks form submit buttons.</p>
434
+ <p><strong>Event name: </strong>Form</p>
435
+ <p><strong>Event name on TikTok: </strong>FormSubmit</p>
436
+ <p><strong>Specific parameters: </strong><i>text, from_class, form_id</i></p>
437
  </div>
438
  </div>
439
 
440
+ <div class="card">
441
+ <div class="card-header has_switch">
442
+ <?php PYS()->render_switcher_input('automatic_event_signup_enabled'); ?>Track user signup <?php cardCollapseBtn(); ?>
 
 
 
443
  </div>
444
+ <div class="card-body">
445
+ <?php if ( Facebook()->enabled()) : ?>
446
+ <div class="row">
447
+ <div class="col">
448
+ <?php if(isWooCommerceActive()
449
+ && Facebook()->getOption("woo_complete_registration_fire_every_time")
450
+ ) :
451
+ Facebook()->render_switcher_input('automatic_event_signup_enabled_disable',false,true);
452
+ ?>
453
+ <h4 class="switcher-label">Enable on Facebook</h4>
454
+ <div class="small ml-2">
455
+ Facebook CompleteReservation is fired every time a WooCommerce takes place.<br/>
456
+ You can change this from the WooCommerce events
457
+ <a href="<?=buildAdminUrl( 'pixelyoursite', 'woo' )?>" target="_blank">
458
+ settings
459
+ </a>
460
+ </div>
461
+ <?php else: ?>
462
+ <?php Facebook()->render_switcher_input('automatic_event_signup_enabled'); ?>
463
+ <h4 class="switcher-label">Enable on Facebook</h4>
464
+ <?php endif; ?>
465
+ </div>
466
+ </div>
467
+ <?php endif; ?>
468
+ <?php if ( GA()->enabled()) : ?>
469
+ <div class="row">
470
+ <div class="col">
471
+ <?php GA()->render_switcher_input('automatic_event_signup_enabled'); ?>
472
+ <h4 class="switcher-label">Enable on Google Analytics</h4>
473
+ </div>
474
+ </div>
475
+ <?php endif; ?>
476
 
477
+ <?php if ( Bing()->enabled()) : ?>
478
+ <div class="row">
479
+ <div class="col">
480
+ <?php Bing()->render_switcher_input('automatic_event_signup_enabled'); ?>
481
+ <h4 class="switcher-label">Enable on Bing</h4>
482
+ </div>
483
+ </div>
484
+ <?php endif; ?>
485
+ <?php if ( Pinterest()->enabled()) : ?>
486
+ <div class="row">
487
+ <div class="col">
488
+ <?php Pinterest()->render_switcher_input('automatic_event_signup_enabled'); ?>
489
+ <h4 class="switcher-label">Enable on Pinterest</h4>
490
+ </div>
491
+ </div>
492
+ <?php endif; ?>
493
+ <br/>
494
+ <p>Fires when the website visitor signup for a WordPress account.</p>
495
+ <p><strong>Event name: </strong></p>
496
+ <p>
497
+ On Google Analytics the event is called sign_up (standard event).<br/>
498
+ On Google Ads the event is called sign_up (custom event)<br/>
499
+ On Facebook the event is called CompleteRegistration (standard event).<br/>
500
+ On Pinterest the event is called Signup (standard event).<br/>
501
+ On Bing the event is called sign_up (custom event)
502
+ </p>
503
  </div>
504
+ </div>
505
+
506
+ <div class="card">
507
+ <div class="card-header has_switch">
508
+ <?php PYS()->render_switcher_input('automatic_event_login_enabled'); ?>Track user login <?php cardCollapseBtn(); ?>
509
  </div>
510
+ <div class="card-body">
511
+ <?php
512
+ enableEventForEachPixel('automatic_event_login_enabled', true, true, true, true, false, true);
513
+ ?>
514
+ <br/>
515
+ <p>Fires when the website visitor logins a WordPress account.</p>
516
+ <p><strong>Event name: </strong></p>
517
+ <p>On Google Analytics the event is called login (standard event).<br/>
518
+ On Google Ads the event is called login (custom event)<br/>
519
+ On Facebook, Pinterest and Bing, the event is called Login (custom event).</p>
520
+ </div>
521
+ </div>
522
 
523
+ <div class="card">
524
+ <div class="card-header has_switch">
525
+ <?php PYS()->render_switcher_input('automatic_event_download_enabled'); ?>Track Downloads <?php cardCollapseBtn(); ?>
526
+ </div>
527
+ <div class="card-body">
528
+ <?php
529
+ enableEventForEachPixel('automatic_event_download_enabled', true, true, true, true, true, true);
530
+ ?>
531
+ <br/>
532
+ <div>Extension of files to track as downloads:</div>
533
+ <?php PYS()->render_tags_select_input('automatic_event_download_extensions'); ?>
534
+
535
+ <p class="mt-2">Fires when the website visitor open files with the designated format.</p>
536
+ <p><strong>Event name: </strong>Download</p>
537
+ <p><strong>Specific parameters: </strong><i>download_type, download_name, download_url</i></p>
538
+ <p class="small">
539
+ *Google Analytics 4 automatically tracks this action with an event called "file_download". If you want,
540
+ you can disable this event for Google Analytics
541
+ </p>
542
  </div>
543
  </div>
544
 
545
+ <div class="card">
546
+ <div class="card-header has_switch">
547
+ <?php PYS()->render_switcher_input('automatic_event_comment_enabled'); ?>Track comments <?php cardCollapseBtn(); ?>
548
+ </div>
549
+ <div class="card-body">
550
+ <?php
551
+ enableEventForEachPixel('automatic_event_comment_enabled', true, true, true, true, false, true);
552
+ ?>
553
+ <br/>
554
+ <p>Fires when the website visitor ads a comment.</p>
555
+ <p><strong>Event name: </strong>Comment</p>
556
+ </div>
557
+ </div>
558
+
559
+
560
+
561
+ <div class="card">
562
+ <div class="card-header has_switch">
563
+ <?php PYS()->render_switcher_input('automatic_event_scroll_enabled'); ?>Track page scroll <?php cardCollapseBtn(); ?>
564
+ </div>
565
+ <div class="card-body">
566
+ <?php
567
+ enableEventForEachPixel('automatic_event_scroll_enabled', true, true, true, true, false, true);
568
+ ?>
569
+ <br/>
570
+ <div class="mb-2 form-inline">
571
+ <label>Trigger for scroll value</label>
572
+ <?php PYS()->render_number_input('automatic_event_scroll_value', '', false, 100); ?>
573
+ <div>%</div>
574
  </div>
575
+
576
+ <p>Fires when the website visitor scrolls the page.</p>
577
+ <p><strong>Event name: </strong>PageScroll</p>
578
+ <p class="small">*Google Analytics 4 automatically tracks 90% page scroll with an event called "scroll".
579
+ If you want, you can disable this event for Google Analytics</p>
580
  </div>
581
+ </div>
582
 
583
+ <div class="card">
584
+ <div class="card-header has_switch">
585
+ <?php PYS()->render_switcher_input('automatic_event_time_on_page_enabled'); ?>Track time on page <?php cardCollapseBtn(); ?>
586
+ </div>
587
+ <div class="card-body">
588
+ <?php
589
+ enableEventForEachPixel('automatic_event_time_on_page_enabled', true, true, true, true, false, true);
590
+ ?>
591
+ <br/>
592
+ <div class="mb-2 form-inline">
593
+ <label>Trigger for time</label>
594
+ <?php PYS()->render_number_input('automatic_event_time_on_page_value', '', false, 100); ?>
595
+ <div>seconds</div>
596
  </div>
597
+ <p><strong>Event name: </strong>TimeOnPage</p>
598
  </div>
599
+ </div>
600
+
601
+ <div class="card">
602
+ <div class="card-header has_switch">
603
+ <?php PYS()->render_switcher_input('automatic_event_search_enabled'); ?>Track searches <?php cardCollapseBtn(); ?>
604
+ </div>
605
+ <div class="card-body">
606
+ <?php
607
+ enableEventForEachPixel('automatic_event_search_enabled', true, true, true, true, true, true);
608
+ ?>
609
+ <br/>
610
+ <p><strong>Event name: </strong></p>
611
+ <p>
612
+ On Google Analytics the event is called search (standard event).<br/>
613
+ On Google Ads the event is called search (custom event)<br/>
614
+ On Facebook, Pinterest called Search (standard event).<br/>
615
+ On Bing the event is called search (custom event).<br/>
616
+ On TikTok the event is called Search (standard event).
617
+ </p>
618
+ </div>
619
+ </div>
620
+ <div class="card">
621
+ <div class="card-header has_switch">
622
+ <?php renderDummySwitcher(); ?>Track AdSense <?php renderProBadge(); ?>
623
+ </div>
624
+ </div>
625
+
626
+ <div class="card">
627
+ <div class="card-header has_switch">
628
+ <?php renderDummySwitcher(); ?>Track internal
629
+ links <?php renderProBadge(); ?>
630
+ </div>
631
+ </div>
632
+
633
+ <div class="card">
634
+ <div class="card-header has_switch">
635
+ <?php renderDummySwitcher(); ?>Track outbound
636
+ links <?php renderProBadge(); ?>
637
+ </div>
638
+ </div>
639
+
640
+ <div class="card">
641
+ <div class="card-header has_switch">
642
+ <?php renderDummySwitcher(); ?>Track embedded YouTube or
643
+ Vimeo video views <?php renderProBadge(); ?>
644
+ </div>
645
+
646
+ </div>
647
+
648
+ <div class="card">
649
+ <div class="card-header has_switch">
650
+ <?php renderDummySwitcher(); ?>Track tel links <?php renderProBadge(); ?>
651
+ </div>
652
+ </div>
653
+
654
+ <div class="card">
655
+ <div class="card-header has_switch">
656
+ <?php renderDummySwitcher(); ?>Track email links <?php renderProBadge(); ?>
657
+ </div>
658
+ </div>
659
  </div>
660
  </div>
661
 
801
  $signalEvents = 1;
802
  }
803
 
 
 
 
 
804
  $total = $customCount + $signalEvents + $wooEvents + $eddEvents;
805
  ?>
806
  <p><strong>You have <?=$total?> active events in total.</strong></p>
1058
  <button class="btn btn-block btn-save">Save Settings</button>
1059
  </div>
1060
  </div>
1061
+ <?php function enableEventForEachPixel($event, $fb = true, $ga = true, $ads = true, $bi = true, $tic = true, $pin = true)
1062
+ { ?>
1063
+ <?php if ($fb && Facebook()->enabled()) : ?>
1064
+ <div class="row">
1065
+ <div class="col">
1066
+ <?php Facebook()->render_switcher_input($event); ?>
1067
+ <h4 class="switcher-label">Enable on Facebook</h4>
1068
+ </div>
1069
+ </div>
1070
+ <?php endif; ?>
1071
+ <?php if ($ga && GA()->enabled()) : ?>
1072
+ <div class="row">
1073
+ <div class="col">
1074
+ <?php GA()->render_switcher_input($event); ?>
1075
+ <h4 class="switcher-label">Enable on Google Analytics</h4>
1076
+ </div>
1077
+ </div>
1078
+ <?php endif; ?>
1079
+
1080
+
1081
+ <?php if ($bi && Bing()->enabled()) : ?>
1082
+ <div class="row">
1083
+ <div class="col">
1084
+ <?php Bing()->render_switcher_input($event); ?>
1085
+ <h4 class="switcher-label">Enable on Bing</h4>
1086
+ </div>
1087
+ </div>
1088
+ <?php endif; ?>
1089
+ <?php if ($pin && Pinterest()->enabled()) : ?>
1090
+ <div class="row">
1091
+ <div class="col">
1092
+ <?php Pinterest()->render_switcher_input($event); ?>
1093
+ <h4 class="switcher-label">Enable on Pinterest</h4>
1094
+ </div>
1095
+ </div>
1096
+ <?php endif; ?>
1097
+
1098
+ <?php
1099
+ }
includes/views/html-main-woo.php CHANGED
@@ -91,7 +91,10 @@ use PixelYourSite\Facebook\Helpers;
91
  <div class="col">
92
  <p>WooCommerce AddToCart Event FIX (4:46 min) - <a href="https://www.youtube.com/watch?v=oZoAu8a0PNg" target="_blank">watch now</a></p>
93
  <p>Improve WooCommerce Facebook Ads performance with OFFLINE CONVERSIONS (11:38) - <a href="https://www.youtube.com/watch?v=vNsiWh0cakA" target="_blank">watch now</a></p>
94
-
 
 
 
95
  </div>
96
  </div>
97
  </div>
@@ -1486,8 +1489,8 @@ e&utm_campaign=pro-feature' ); ?>
1486
  </div>
1487
  <div class="row">
1488
  <div class="col">
1489
- <?php PYS()->render_switcher_input( 'enable_woo_product_price_param' ); ?>
1490
- <h4 class="switcher-label">product_price</h4>
1491
  <hr>
1492
  </div>
1493
  </div>
@@ -1499,6 +1502,13 @@ e&utm_campaign=pro-feature' ); ?>
1499
  <hr>
1500
  </div>
1501
  </div>
 
 
 
 
 
 
 
1502
 
1503
  <div class="row">
1504
  <div class="col">
@@ -1531,6 +1541,13 @@ e&utm_campaign=pro-feature' ); ?>
1531
  <hr>
1532
  </div>
1533
  </div>
 
 
 
 
 
 
 
1534
 
1535
  <div class="row">
1536
  <div class="col">
91
  <div class="col">
92
  <p>WooCommerce AddToCart Event FIX (4:46 min) - <a href="https://www.youtube.com/watch?v=oZoAu8a0PNg" target="_blank">watch now</a></p>
93
  <p>Improve WooCommerce Facebook Ads performance with OFFLINE CONVERSIONS (11:38) - <a href="https://www.youtube.com/watch?v=vNsiWh0cakA" target="_blank">watch now</a></p>
94
+ <p>Enhanced Conversions for Google Ads with PixelYourSite (9:14) - <a href="https://www.youtube.com/watch?v=0uuTiOnVw80" target="_blank">watch now</a></p>
95
+ <p>Google Analytic 4 (GA4) & WooCommerce: Transaction Reports (6:51) - <a href="https://www.youtube.com/watch?v=zLtXHbp_DDU" target="_blank">watch now</a></p>
96
+ <p>Google Analytics 4 (GA4) FUNNELS for WooCommerce (6:13) - <a href="https://www.youtube.com/watch?v=c6L1XMYzuMM" target="_blank">watch now</a></p>
97
+ <p>Same Facebook (Meta) pixel or Google tag on multiple WooCommerce websites? (4:43) - <a href="https://www.youtube.com/watch?v=3Ugwlq1EVO4" target="_blank">watch now</a></p>
98
  </div>
99
  </div>
100
  </div>
1489
  </div>
1490
  <div class="row">
1491
  <div class="col">
1492
+ <?php PYS()->render_switcher_input( 'enable_woo_tags_param' ); ?>
1493
+ <h4 class="switcher-label">tags</h4>
1494
  <hr>
1495
  </div>
1496
  </div>
1502
  <hr>
1503
  </div>
1504
  </div>
1505
+ <div class="row">
1506
+ <div class="col">
1507
+ <?php renderDummySwitcher(); ?>
1508
+ <h4 class="switcher-label">tax (PRO)</h4>
1509
+ <hr>
1510
+ </div>
1511
+ </div>
1512
 
1513
  <div class="row">
1514
  <div class="col">
1541
  <hr>
1542
  </div>
1543
  </div>
1544
+ <div class="row">
1545
+ <div class="col">
1546
+ <?php renderDummySwitcher(); ?>
1547
+ <h4 class="switcher-label">coupon_code (PRO)</h4>
1548
+ <hr>
1549
+ </div>
1550
+ </div>
1551
 
1552
  <div class="row">
1553
  <div class="col">
modules/facebook/facebook-server.php CHANGED
@@ -270,6 +270,15 @@ class FacebookServer {
270
 
271
  $api = Api::init(null, null, $this->access_token[$pixel_Id],false);
272
 
 
 
 
 
 
 
 
 
 
273
  $request = (new EventRequest($pixel_Id))->setEvents([$event]);
274
  $request->setPartnerAgent("dvpixelyoursite");
275
  if(!empty($this->testCode[$pixel_Id])) {
270
 
271
  $api = Api::init(null, null, $this->access_token[$pixel_Id],false);
272
 
273
+ /**
274
+ * filter pys_before_send_fb_server_event
275
+ * Help add custom options or get data from event before send
276
+ * FacebookAds\Object\ServerSide\Event $event
277
+ * String $pixel_Id
278
+ * String EventId
279
+ */
280
+ $event = apply_filters("pys_before_send_fb_server_event",$event,$pixel_Id,$event->getEventId());
281
+
282
  $request = (new EventRequest($pixel_Id))->setEvents([$event]);
283
  $request->setPartnerAgent("dvpixelyoursite");
284
  if(!empty($this->testCode[$pixel_Id])) {
modules/facebook/facebook.php CHANGED
@@ -146,6 +146,33 @@ class Facebook extends Settings implements Pixel {
146
  $isActive = false;
147
 
148
  switch ($event->getId()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  //Signal events
150
  case "signal_page_scroll":
151
  case "signal_time_on_page":
@@ -163,13 +190,7 @@ class Facebook extends Settings implements Pixel {
163
  $this->addDataToEvent($eventData,$event);
164
  }
165
  } break;
166
- case 'search_event':{
167
- $eventData = $this->getSearchEventParams();
168
- if ($eventData) {
169
- $isActive = true;
170
- $this->addDataToEvent($eventData, $event);
171
- }
172
- }break;
173
 
174
  case 'custom_event':{
175
  $eventData = $this->getCustomEventParams( $event->args );
@@ -461,35 +482,7 @@ class Facebook extends Settings implements Pixel {
461
 
462
  }
463
 
464
- private function getSearchEventParams() {
465
- global $posts;
466
-
467
- if ( ! $this->getOption( 'search_event_enabled' ) ) {
468
- return false;
469
- }
470
-
471
- $params['search_string'] = empty( $_GET['s'] ) ? null : $_GET['s'];
472
-
473
- if ( isWooCommerceActive() && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'product' ) {
474
-
475
- $limit = min( count( $posts ), 5 );
476
- $post_ids = array();
477
-
478
- for ( $i = 0; $i < $limit; $i ++ ) {
479
- $post_ids = array_merge( Helpers\getFacebookWooProductContentId( $posts[ $i ]->ID ), $post_ids );
480
- }
481
-
482
- $params['content_type'] = 'product';
483
- $params['content_ids'] = $post_ids ;
484
-
485
- }
486
-
487
- return array(
488
- 'name' => 'Search',
489
- 'data' => $params,
490
- );
491
 
492
- }
493
 
494
  public function getFDPEvents() {
495
  $events = array();
146
  $isActive = false;
147
 
148
  switch ($event->getId()) {
149
+
150
+ //Automatic events
151
+ case 'automatic_event_signup' : {
152
+ if(isWooCommerceActive() && Facebook()->getOption("woo_complete_registration_fire_every_time")) {
153
+ $isActive = false;
154
+ } else {
155
+ $event->addPayload(["name" => "CompleteRegistration"]);
156
+ $isActive = $this->getOption($event->getId().'_enabled');
157
+ }
158
+ } break;
159
+ case 'automatic_event_login' :{
160
+ $event->addPayload(["name" => "Login"]);
161
+ $isActive = $this->getOption($event->getId().'_enabled');
162
+ } break;
163
+ case 'automatic_event_search' :{
164
+ $event->addPayload(["name" => "Search"]);
165
+ $isActive = $this->getOption($event->getId().'_enabled');
166
+ } break;
167
+
168
+ case 'automatic_event_form' :
169
+ case 'automatic_event_download' :
170
+ case 'automatic_event_comment' :
171
+ case 'automatic_event_scroll' :
172
+ case 'automatic_event_time_on_page' : {
173
+ $isActive = $this->getOption($event->getId().'_enabled');
174
+ }break;
175
+
176
  //Signal events
177
  case "signal_page_scroll":
178
  case "signal_time_on_page":
190
  $this->addDataToEvent($eventData,$event);
191
  }
192
  } break;
193
+
 
 
 
 
 
 
194
 
195
  case 'custom_event':{
196
  $eventData = $this->getCustomEventParams( $event->args );
482
 
483
  }
484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
 
 
486
 
487
  public function getFDPEvents() {
488
  $events = array();
modules/facebook/options_defaults.json CHANGED
@@ -5,7 +5,6 @@
5
  "remove_metadata": false,
6
 
7
  "general_event_enabled": true,
8
- "search_event_enabled": true,
9
  "comment_event_enabled": true,
10
  "download_event_enabled": true,
11
  "form_event_enabled": true,
@@ -64,5 +63,14 @@
64
  "woo_complete_registration_send_from_server": true,
65
 
66
  "signal_events_enabled": true,
67
- "verify_meta_tag": ""
 
 
 
 
 
 
 
 
 
68
  }
5
  "remove_metadata": false,
6
 
7
  "general_event_enabled": true,
 
8
  "comment_event_enabled": true,
9
  "download_event_enabled": true,
10
  "form_event_enabled": true,
63
  "woo_complete_registration_send_from_server": true,
64
 
65
  "signal_events_enabled": true,
66
+ "verify_meta_tag": "",
67
+
68
+ "automatic_event_form_enabled": true,
69
+ "automatic_event_signup_enabled": true,
70
+ "automatic_event_login_enabled": true,
71
+ "automatic_event_download_enabled": true,
72
+ "automatic_event_comment_enabled": true,
73
+ "automatic_event_scroll_enabled": true,
74
+ "automatic_event_time_on_page_enabled": true,
75
+ "automatic_event_search_enabled": true
76
  }
modules/facebook/options_fields.json CHANGED
@@ -5,7 +5,6 @@
5
  "remove_metadata": "checkbox",
6
 
7
  "general_event_enabled": "checkbox",
8
- "search_event_enabled": "checkbox",
9
  "comment_event_enabled": "checkbox",
10
  "download_event_enabled": "checkbox",
11
  "form_event_enabled": "checkbox",
@@ -63,5 +62,14 @@
63
  "woo_complete_registration_send_from_server": "checkbox",
64
 
65
  "signal_events_enabled": "checkbox",
66
- "verify_meta_tag": "array_textarea"
 
 
 
 
 
 
 
 
 
67
  }
5
  "remove_metadata": "checkbox",
6
 
7
  "general_event_enabled": "checkbox",
 
8
  "comment_event_enabled": "checkbox",
9
  "download_event_enabled": "checkbox",
10
  "form_event_enabled": "checkbox",
62
  "woo_complete_registration_send_from_server": "checkbox",
63
 
64
  "signal_events_enabled": "checkbox",
65
+ "verify_meta_tag": "array_textarea",
66
+
67
+ "automatic_event_form_enabled": "checkbox",
68
+ "automatic_event_signup_enabled": "checkbox",
69
+ "automatic_event_login_enabled": "checkbox",
70
+ "automatic_event_download_enabled": "checkbox",
71
+ "automatic_event_comment_enabled": "checkbox",
72
+ "automatic_event_scroll_enabled": "checkbox",
73
+ "automatic_event_time_on_page_enabled": "checkbox",
74
+ "automatic_event_search_enabled": "checkbox"
75
  }
modules/google_analytics/function-collect-data-4v.php CHANGED
@@ -1,44 +1,6 @@
1
  <?php
2
  use PixelYourSite\GA\Helpers;
3
 
4
- function getSearchEventDataV4() {
5
-
6
- if ( ! PixelYourSite\GA()->getOption( 'search_event_enabled' ) ) {
7
- return false;
8
- }
9
-
10
- $event_category = 'WordPress';
11
- $search_term = empty( $_GET['s'] ) ? null : $_GET['s'];
12
-
13
- if ( PixelYourSite\isWooCommerceActive() && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'product' ) {
14
- $event_category = 'WooCommerce';
15
- }
16
-
17
- if ( PixelYourSite\isEddActive() && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'download' ) {
18
- $event_category = 'Easy Digital Downloads';
19
- }
20
-
21
- $user = wp_get_current_user();
22
- if ( $user->ID !== 0 ) {
23
- $user_roles = implode( ',', $user->roles );
24
- } else {
25
- $user_roles = 'guest';
26
- }
27
-
28
- $params['event_category'] = $event_category;
29
- $params['search_term'] = $search_term;
30
- $params['non_interaction'] = PixelYourSite\GA()->getOption( 'search_event_non_interactive' );
31
- //$params['post_id'] = ;
32
- $params['post_type'] = "page";
33
- $params['content_name'] = wp_get_document_title();
34
- $params['user_role'] = $user_roles;
35
-
36
- return array(
37
- 'name' => 'search',
38
- 'data' => $params,
39
- );
40
-
41
- }
42
 
43
  function getCompleteRegistrationEventParamsV4() {
44
  if ( ! PixelYourSite\GA()->getOption( 'complete_registration_event_enabled' ) ) {
1
  <?php
2
  use PixelYourSite\GA\Helpers;
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  function getCompleteRegistrationEventParamsV4() {
6
  if ( ! PixelYourSite\GA()->getOption( 'complete_registration_event_enabled' ) ) {
modules/google_analytics/ga.php CHANGED
@@ -145,6 +145,30 @@ class GA extends Settings implements Pixel {
145
  }
146
  $isActive = false;
147
  switch ($event->getId()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  case "signal_page_scroll":
149
  case "signal_time_on_page":
150
  case "signal_form":
@@ -161,14 +185,7 @@ class GA extends Settings implements Pixel {
161
  $this->addDataToEvent($eventData, $event);
162
  }
163
  } break;
164
- case 'search_event': {
165
- $eventData = $this->getSearchEventData();
166
- if ($eventData) {
167
- $isActive = true;
168
- $this->addDataToEvent($eventData, $event);
169
- }
170
 
171
- }break;
172
 
173
  case 'custom_event': {
174
  $eventData = $this->getCustomEventData($event->args);
@@ -392,27 +409,6 @@ class GA extends Settings implements Pixel {
392
 
393
  }
394
 
395
- private function getSearchEventData() {
396
-
397
- if ( ! $this->getOption( 'search_event_enabled' ) ) {
398
- return false;
399
- }
400
-
401
- $params['event_category'] = 'WordPress Search';
402
- $params['search_term'] = empty( $_GET['s'] ) ? null : $_GET['s'];
403
-
404
- if ( isWooCommerceActive() && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'product' ) {
405
- $params['event_category'] = 'WooCommerce Search';
406
- }
407
-
408
- $params['non_interaction'] = $this->getOption( 'search_event_non_interactive' );
409
-
410
- return array(
411
- 'name' => 'search',
412
- 'data' => $params,
413
- );
414
-
415
- }
416
 
417
  /**
418
  * @param CustomEvent $event
145
  }
146
  $isActive = false;
147
  switch ($event->getId()) {
148
+ //Automatic events
149
+
150
+ case 'automatic_event_signup' : {
151
+ $event->addPayload(["name" => "sign_up"]);
152
+ $isActive = $this->getOption($event->getId().'_enabled');
153
+ } break;
154
+ case 'automatic_event_login' :{
155
+ $event->addPayload(["name" => "login"]);
156
+ $isActive = $this->getOption($event->getId().'_enabled');
157
+ } break;
158
+ case 'automatic_event_search' :{
159
+ $event->addPayload(["name" => "search"]);
160
+ $event->addParams(["search_term" => empty( $_GET['s'] ) ? null : $_GET['s']]);
161
+ $isActive = $this->getOption($event->getId().'_enabled');
162
+ } break;
163
+
164
+ case 'automatic_event_form' :
165
+ case 'automatic_event_download' :
166
+ case 'automatic_event_comment' :
167
+ case 'automatic_event_scroll' :
168
+ case 'automatic_event_time_on_page' : {
169
+ $isActive = $this->getOption($event->getId().'_enabled');
170
+ }break;
171
+
172
  case "signal_page_scroll":
173
  case "signal_time_on_page":
174
  case "signal_form":
185
  $this->addDataToEvent($eventData, $event);
186
  }
187
  } break;
 
 
 
 
 
 
188
 
 
189
 
190
  case 'custom_event': {
191
  $eventData = $this->getCustomEventData($event->args);
409
 
410
  }
411
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
 
413
  /**
414
  * @param CustomEvent $event
modules/google_analytics/options_defaults.json CHANGED
@@ -9,7 +9,6 @@
9
  "cross_domain_accept_incoming": false,
10
  "cross_domain_domains": [],
11
 
12
- "search_event_enabled": true,
13
  "search_event_non_interactive": true,
14
  "comment_event_enabled": true,
15
  "comment_event_non_interactive": false,
@@ -56,6 +55,14 @@
56
  "disable_advertising_features": false,
57
  "disable_advertising_personalization": false,
58
 
59
- "signal_events_enabled": true
60
 
 
 
 
 
 
 
 
 
61
  }
9
  "cross_domain_accept_incoming": false,
10
  "cross_domain_domains": [],
11
 
 
12
  "search_event_non_interactive": true,
13
  "comment_event_enabled": true,
14
  "comment_event_non_interactive": false,
55
  "disable_advertising_features": false,
56
  "disable_advertising_personalization": false,
57
 
58
+ "signal_events_enabled": true,
59
 
60
+ "automatic_event_form_enabled": true,
61
+ "automatic_event_signup_enabled": true,
62
+ "automatic_event_login_enabled": true,
63
+ "automatic_event_download_enabled": true,
64
+ "automatic_event_comment_enabled": true,
65
+ "automatic_event_scroll_enabled": true,
66
+ "automatic_event_time_on_page_enabled": true,
67
+ "automatic_event_search_enabled": true
68
  }
modules/google_analytics/options_fields.json CHANGED
@@ -9,7 +9,6 @@
9
  "cross_domain_accept_incoming": "checkbox",
10
  "cross_domain_domains": "array",
11
 
12
- "search_event_enabled": "checkbox",
13
  "search_event_non_interactive": "checkbox",
14
  "comment_event_enabled": "checkbox",
15
  "comment_event_non_interactive": "checkbox",
@@ -56,5 +55,14 @@
56
  "disable_advertising_features": "checkbox",
57
  "disable_advertising_personalization": "checkbox",
58
 
59
- "signal_events_enabled": "checkbox"
 
 
 
 
 
 
 
 
 
60
  }
9
  "cross_domain_accept_incoming": "checkbox",
10
  "cross_domain_domains": "array",
11
 
 
12
  "search_event_non_interactive": "checkbox",
13
  "comment_event_enabled": "checkbox",
14
  "comment_event_non_interactive": "checkbox",
55
  "disable_advertising_features": "checkbox",
56
  "disable_advertising_personalization": "checkbox",
57
 
58
+ "signal_events_enabled": "checkbox",
59
+
60
+ "automatic_event_form_enabled": "checkbox",
61
+ "automatic_event_signup_enabled": "checkbox",
62
+ "automatic_event_login_enabled": "checkbox",
63
+ "automatic_event_download_enabled": "checkbox",
64
+ "automatic_event_comment_enabled": "checkbox",
65
+ "automatic_event_scroll_enabled": "checkbox",
66
+ "automatic_event_time_on_page_enabled": "checkbox",
67
+ "automatic_event_search_enabled": "checkbox"
68
  }
pixelyoursite.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- define( 'PYS_FREE_VERSION', '8.2.18' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '3.2.5' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '2.2.2' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
@@ -27,6 +27,7 @@ require_once PYS_FREE_PATH.'/includes/events/interface-events.php';
27
  require_once PYS_FREE_PATH.'/includes/events/class-event-single.php';
28
  require_once PYS_FREE_PATH.'/includes/events/class-event-grouped.php';
29
  require_once PYS_FREE_PATH.'/includes/events/class-events-signal.php';
 
30
  require_once PYS_FREE_PATH.'/includes/events/class-events-woo.php';
31
  require_once PYS_FREE_PATH.'/includes/events/class-events-edd.php';
32
  require_once PYS_FREE_PATH.'/includes/events/class-events-fdp.php';
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ define( 'PYS_FREE_VERSION', '9.0.0' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '3.2.5' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '2.2.2' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
27
  require_once PYS_FREE_PATH.'/includes/events/class-event-single.php';
28
  require_once PYS_FREE_PATH.'/includes/events/class-event-grouped.php';
29
  require_once PYS_FREE_PATH.'/includes/events/class-events-signal.php';
30
+ require_once PYS_FREE_PATH.'/includes/events/class-events-automatic.php';
31
  require_once PYS_FREE_PATH.'/includes/events/class-events-woo.php';
32
  require_once PYS_FREE_PATH.'/includes/events/class-events-edd.php';
33
  require_once PYS_FREE_PATH.'/includes/events/class-events-fdp.php';
readme.txt CHANGED
@@ -3,17 +3,17 @@ Contributors: PixelYourSite
3
  Tags: Meta Pixel, Facebook Pixel, Facebook Conversion API, CAPI, Facebook Pixel Events, Facebook Dynamic Product Ads, Facebook Conversion Value, WooCommerce Facebook Pixel, Easy Digital Downloads Facebook Pixel, Google Analytics, Google Analytics Enhanced Ecommerce, GA4, WooCommerce Google Analytics, Easy Digital Downloads Google Analytics, head & footer scripts, Pinterest tag
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
- Tested up to: 5.9
7
- Stable tag: 8.2.18
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Meta Pixel (Facebook Pixel) & Conversion API (CAPI), Google Analytics Universal or GA4, plus ANY other script. WooCommerce and EDD with Facebook Dynamic Product Ads and Google Enhanced Ecommerce. Track any action with events. Pinterest Tag support via a dedicated paid add-on. Dedicated paid Bing Tag add-on.
12
 
13
  == Description ==
14
- **Manage your Meta Pixel (Facebook Pixel), implement Facebook Conversion API, add your Google Analytics Universal or GA4 with a single plugin. Add ANY other script (Head & Footer feature). The Pinterest Tag can be implemented via [paid add-on](https://www.pixelyoursite.com/pinterest-tag).**
15
 
16
- PixelYourSite's Signal event will automatically track important actions and send them to all your configured pixels (searches, form submit, comments, downloads).
17
 
18
  You can fire your own events with zero coding.
19
 
@@ -27,7 +27,7 @@ NEW: Facebook Pixel Conversion API: [Learn how to enable and test Conversion API
27
 
28
  Learn how to [verify your domain on Facebook](https://www.pixelyoursite.com/verify-domain-facebook)
29
 
30
- Learn about [the Signal Event and Aggregated Event Measurement](https://www.pixelyoursite.com/signal-custom-conversions-aem)
31
 
32
  TRACK EVERYTHING WITH A SINGLE PLUGIN:
33
 
@@ -37,7 +37,7 @@ TRACK EVERYTHING WITH A SINGLE PLUGIN:
37
 
38
  * Google Analytics: one click install
39
 
40
- * Google Analytics 4: for details, watch [this video](https://www.youtube.com/watch?v=CCVBD_bD-Y0)
41
 
42
  * ANY script: add any other script with our flexible Head & Footer option
43
 
@@ -63,11 +63,13 @@ FANTASTIC WOOCOMMERCE INTEGRATION:
63
 
64
  * Google Analytics: Enhanced Ecommerce implementation.
65
 
66
- * GA4: Monetization data.
67
 
68
  * Head & Footer scripts: you can insert scripts on the WooCommerce “order-received” page.
69
 
70
- * Pinterest e-commerce events.
 
 
71
 
72
 
73
 
@@ -78,9 +80,9 @@ The EDD integration works just like the WooCommerce integration, with full Dynam
78
 
79
 
80
 
81
- TRACK KEY ACTIONS WITH THE SIGNAL EVENT:
82
 
83
- The Signal event captures important actions like form submit, comments, downloads, page scroll, and time on page.
84
 
85
 
86
 
@@ -146,9 +148,9 @@ TikTok Tag support with [PixelYourSite Professional](https://www.pixelyoursite.c
146
 
147
 
148
 
149
- EVEN MORE TRIGGERS FOR THE SIGNAL EVENT:
150
 
151
- You can capture clicks on internal or external links, embedded video views, clicks on phone numbers or emails, user signups, clicks on AdSense ads.
152
 
153
 
154
 
@@ -223,7 +225,9 @@ GOOGLE ADS TAG (FORMER ADWORDS):
223
 
224
  * Each Global event will be sent to Google Ads too, and you can configure Google Ads conversions.
225
 
226
- * Add conversion label to any WooCommerce or EDD event.
 
 
227
 
228
 
229
 
@@ -460,6 +464,38 @@ NO, absolutely not! We don't track any type of data about your website. We simpl
460
  == Changelog ==
461
 
462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  = PixelYourSite 8.2.18 =
464
 
465
  * Video links update.
3
  Tags: Meta Pixel, Facebook Pixel, Facebook Conversion API, CAPI, Facebook Pixel Events, Facebook Dynamic Product Ads, Facebook Conversion Value, WooCommerce Facebook Pixel, Easy Digital Downloads Facebook Pixel, Google Analytics, Google Analytics Enhanced Ecommerce, GA4, WooCommerce Google Analytics, Easy Digital Downloads Google Analytics, head & footer scripts, Pinterest tag
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
+ Tested up to: 6.0
7
+ Stable tag: 9.0.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Meta Pixel (Facebook Pixel) & Conversion API (CAPI), Google Analytics 4 (GA4) or the old Universal, plus ANY other script. WooCommerce and EDD with Facebook Dynamic Product Ads and Google Magnetisation tracking. Track any action with events. Pinterest Tag support via a dedicated paid add-on. Dedicated paid Bing Tag add-on.
12
 
13
  == Description ==
14
+ **Manage your Meta Pixel (Facebook Pixel), implement Facebook Conversion API, add your Google Analytics 4 (GA4) or an old Universal property with a single plugin. Add ANY other script (Head & Footer feature). The Pinterest Tag can be implemented via [paid add-on](https://www.pixelyoursite.com/pinterest-tag).**
15
 
16
+ PixelYourSite's Automatic Events will track important actions and send them to all your configured pixels (searches, form submit, comments, downloads). Use these events to understand your visitors' behaviour inside Google Analytics, or to create audiences and conversions for Meta (Facebook), or Google.
17
 
18
  You can fire your own events with zero coding.
19
 
27
 
28
  Learn how to [verify your domain on Facebook](https://www.pixelyoursite.com/verify-domain-facebook)
29
 
30
+ Learn how to track key actions with [Automated Events](https://www.pixelyoursite.com/global-events)
31
 
32
  TRACK EVERYTHING WITH A SINGLE PLUGIN:
33
 
37
 
38
  * Google Analytics: one click install
39
 
40
+ * Google Analytics 4: for details, watch [this video](https://www.youtube.com/watch?v=fwegcsO-yrc)
41
 
42
  * ANY script: add any other script with our flexible Head & Footer option
43
 
63
 
64
  * Google Analytics: Enhanced Ecommerce implementation.
65
 
66
+ * GA4: Monetisation data.
67
 
68
  * Head & Footer scripts: you can insert scripts on the WooCommerce “order-received” page.
69
 
70
+ * Pinterest e-commerce events with paid add-on.
71
+
72
+ * TikTok e-commerce events with the paid version of the plugin.
73
 
74
 
75
 
80
 
81
 
82
 
83
+ TRACK KEY ACTIONS WITH AUTOMATED EVENTS:
84
 
85
+ The AUTOMATED EVENTS capture important actions like form submit, comments, downloads, page scroll, and time on page. Use them to measure your users' behaviour inside Google Analytics, or to create custom audiences and conversions on Meta (Facebook), and Google Analytics.
86
 
87
 
88
 
148
 
149
 
150
 
151
+ EVEN MORE AUTOMATED EVENTS:
152
 
153
+ You can capture clicks on internal or external links, embedded video views, clicks on phone numbers or emails, user signups, logins, clicks on AdSense ads.
154
 
155
 
156
 
225
 
226
  * Each Global event will be sent to Google Ads too, and you can configure Google Ads conversions.
227
 
228
+ * Add conversion label to any WooCommerce or EDD event.
229
+
230
+ * Enhanced Conversions.
231
 
232
 
233
 
464
  == Changelog ==
465
 
466
 
467
+ = PixelYourSite 9.0.0 =
468
+
469
+ * [WATCH THIS VIDEO](https://www.youtube.com/watch?v=625_GpjqEZE) to find out more about this update. We are replacing the Signal event with individual automatic events tracking each action. These events are reported by Google Analytics 4 and can be used for audiences or conversions on Meta (Facebook), Google Analytics, Google Ads, and for audiences on Pinterest, Bing, or TikTok. This version still fires the old Signal event by default and you need to manually turn it OFF and enable the automatic events. Version 9.1 will completely remove the Signal event and enable the automatic events by default. If you have audiences or conversions based on the Signal events, replace them using the new events.
470
+
471
+ * Bug fix: possible issue with Bing purchase event (for the Bing paid add-on users).
472
+
473
+ * WooCommerce variable products speed improvement.
474
+
475
+ * Code improvement to avoid a possible error for sites that don’t use WooCommerce.
476
+
477
+ * New filter that lets developers get the Facebook CAPI event IDs.
478
+ Usage example:
479
+
480
+ add_filter(“pys_before_send_fb_server_event”,”pys_test”,10,3);
481
+ function pys_test($event,$pixelId,$eventId) {
482
+ error_log(“Send event for pixel $pixelId id = $eventId”);
483
+ return $event;
484
+ }
485
+
486
+ It is called before the event is sent to the FB server
487
+ 3 parameters:
488
+
489
+ – the first one is the event object with all the data
490
+
491
+ – the second is the pixel id
492
+
493
+ – and the third is the event id, rendered it separately
494
+
495
+ You need to take into account that our events are mainly sent via Ajax after the page has loaded.
496
+
497
+
498
+
499
  = PixelYourSite 8.2.18 =
500
 
501
  * Video links update.