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

Version Description

Download this release

Release Info

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

Code changes from version 7.1.5 to 7.1.4

dist/scripts/admin.js CHANGED
@@ -1,25 +1,2 @@
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()?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").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").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]"]').change(function(){e()}),t(),c('input[name="pys[core][edd_event_value]"]').change(function(){t()}),c("#pys_select_all_events").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").change(function(){i(),a()}),c(".add-event-trigger").click(function(){var e=c(this).closest(".event_triggers_panel");s(e,e.data("trigger_type"))}),c(".remove-row").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").click(function(){o()}),c("#pys_event_facebook_event_type").change(function(){r(),_()}),c("#pys_event_facebook_params_enabled").click(function(){p()}),c("#pys_event_facebook_params_currency").change(function(){l()}),c(".add-facebook-parameter").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").click(function(){v()}),c("#pys_event_pinterest_event_type").change(function(){u(),y()}),c("#pys_event_pinterest_params_enabled").click(function(){d()}),c("#pys_event_pinterest_params_currency").change(function(){m()}),c(".add-pinterest-parameter").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").click(function(){f()}),c("#pys_event_ga_event_action").change(function(){h()}),g(),c("#pys_event_bing_enabled").click(function(){g()})});
3
-
4
- jQuery( document ).ready(function($) {
5
- updateFDPValue($("#pys_facebook_fdp_purchase_event_fire"));
6
- $("#pys_facebook_fdp_purchase_event_fire").change(function () {
7
-
8
- updateFDPValue(this);
9
- });
10
-
11
-
12
- function updateFDPValue(input) {
13
- if($(input).val() == "scroll_pos") {
14
- $("#fdp_purchase_event_fire_scroll_block").show();
15
- $("#pys_facebook_fdp_purchase_event_fire_css").hide()
16
- } else if($(input).val() == "css_click") {
17
- $("#fdp_purchase_event_fire_scroll_block").hide();
18
- $("#pys_facebook_fdp_purchase_event_fire_css").show()
19
- } else {
20
- $("#fdp_purchase_event_fire_scroll_block").hide();
21
- $("#pys_facebook_fdp_purchase_event_fire_css").hide()
22
- }
23
- }
24
- });
25
-
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()?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").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").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]"]').change(function(){e()}),t(),c('input[name="pys[core][edd_event_value]"]').change(function(){t()}),c("#pys_select_all_events").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").change(function(){i(),a()}),c(".add-event-trigger").click(function(){var e=c(this).closest(".event_triggers_panel");s(e,e.data("trigger_type"))}),c(".remove-row").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").click(function(){o()}),c("#pys_event_facebook_event_type").change(function(){r(),_()}),c("#pys_event_facebook_params_enabled").click(function(){p()}),c("#pys_event_facebook_params_currency").change(function(){l()}),c(".add-facebook-parameter").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").click(function(){v()}),c("#pys_event_pinterest_event_type").change(function(){u(),y()}),c("#pys_event_pinterest_params_enabled").click(function(){d()}),c("#pys_event_pinterest_params_currency").change(function(){m()}),c(".add-pinterest-parameter").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").click(function(){f()}),c("#pys_event_ga_event_action").change(function(){h()}),g(),c("#pys_event_bing_enabled").click(function(){g()})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dist/scripts/public.js CHANGED
@@ -233,128 +233,10 @@ if (!Array.prototype.includes) {
233
  return [];
234
  },
235
 
236
- /**
237
- * CUSTOM EVENTS
238
- */
239
-
240
- setupMouseOverClickEvents: function (eventId, triggers) {
241
-
242
- // Non-default binding used to avoid situations when some code in external js
243
- // stopping events propagation, eg. returns false, and our handler will never called
244
- $(document).onFirst('mouseover', triggers.join(','), function () {
245
-
246
- // do not fire event multiple times
247
- if ($(this).hasClass('pys-mouse-over-' + eventId)) {
248
- return true;
249
- } else {
250
- $(this).addClass('pys-mouse-over-' + eventId);
251
- }
252
-
253
- Utils.fireDynamicEvent(eventId);
254
-
255
- });
256
-
257
- },
258
-
259
- setupCSSClickEvents: function (eventId, triggers) {
260
-
261
- // Non-default binding used to avoid situations when some code in external js
262
- // stopping events propagation, eg. returns false, and our handler will never called
263
- $(document).onFirst('click', triggers.join(','), function () {
264
- Utils.fireDynamicEvent(eventId);
265
- });
266
-
267
- },
268
-
269
- setupURLClickEvents: function () {
270
-
271
- // Non-default binding used to avoid situations when some code in external js
272
- // stopping events propagation, eg. returns false, and our handler will never called
273
- $('a[data-pys-event-id]').onFirst('click', function (evt) {
274
-
275
- $(this).attr('data-pys-event-id').split(',').forEach(function (eventId) {
276
-
277
- eventId = parseInt(eventId);
278
-
279
- if (isNaN(eventId) === false) {
280
- Utils.fireDynamicEvent(eventId);
281
- }
282
-
283
- });
284
-
285
- });
286
-
287
- },
288
-
289
- setupScrollPosEvents: function (eventId, triggers) {
290
-
291
- var scrollPosThresholds = {},
292
- docHeight = $(document).height() - $(window).height();
293
-
294
- // convert % to absolute positions
295
- $.each(triggers, function (index, scrollPos) {
296
-
297
- // convert % to pixels
298
- scrollPos = docHeight * scrollPos / 100;
299
- scrollPos = Math.round(scrollPos);
300
-
301
- scrollPosThresholds[scrollPos] = eventId;
302
-
303
- });
304
-
305
- $(document).scroll(function () {
306
-
307
- var scrollPos = $(window).scrollTop();
308
-
309
- $.each(scrollPosThresholds, function (threshold, eventId) {
310
-
311
- // position has not reached yes
312
- if (scrollPos <= threshold) {
313
- return true;
314
- }
315
-
316
- // fire event only once
317
- if (eventId === null) {
318
- return true;
319
- } else {
320
- scrollPosThresholds[threshold] = null;
321
- }
322
-
323
- Utils.fireDynamicEvent(eventId);
324
-
325
- });
326
-
327
- });
328
-
329
- },
330
- setupCommentEvents : function (eventId,triggers) {
331
- $('form.comment-form').submit(function () {
332
- Utils.fireDynamicEvent(eventId);
333
- });
334
- },
335
-
336
  /**
337
  * Events
338
  */
339
 
340
- fireDynamicEvent: function (eventId) {
341
-
342
- if (!options.dynamicEventsParams.hasOwnProperty(eventId)) {
343
- return;
344
- }
345
-
346
- var event = {};
347
-
348
- if (options.dynamicEventsParams[eventId].hasOwnProperty('facebook')) {
349
-
350
- event = Utils.copyProperties(options.dynamicEventsParams[eventId]['facebook'], {});
351
- Facebook.fireEvent(event.name, { params: event.params });
352
- }
353
-
354
-
355
-
356
- },
357
-
358
  fireStaticEvents: function (pixel) {
359
 
360
  if (options.staticEvents.hasOwnProperty(pixel)) {
@@ -1228,35 +1110,6 @@ if (!Array.prototype.includes) {
1228
 
1229
  Utils.setupGdprCallbacks();
1230
 
1231
- // setup Dynamic events
1232
- $.each(options.dynamicEventsTriggers, function (triggerType, events) {
1233
-
1234
- $.each(events, function (eventId, triggers) {
1235
-
1236
- switch (triggerType) {
1237
- case 'url_click':
1238
- //@see: Utils.setupURLClickEvents()
1239
- break;
1240
-
1241
- case 'css_click':
1242
- Utils.setupCSSClickEvents(eventId, triggers);
1243
- break;
1244
-
1245
- case 'css_mouseover':
1246
- Utils.setupMouseOverClickEvents(eventId, triggers);
1247
- break;
1248
-
1249
- case 'scroll_pos':
1250
- Utils.setupScrollPosEvents(eventId, triggers);
1251
- break;
1252
- case 'comment':
1253
- Utils.setupCommentEvents(eventId, triggers);
1254
- break;
1255
- }
1256
-
1257
- });
1258
-
1259
- });
1260
  // setup WooCommerce events
1261
  if (options.woo.enabled) {
1262
 
233
  return [];
234
  },
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  /**
237
  * Events
238
  */
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  fireStaticEvents: function (pixel) {
241
 
242
  if (options.staticEvents.hasOwnProperty(pixel)) {
1110
 
1111
  Utils.setupGdprCallbacks();
1112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
  // setup WooCommerce events
1114
  if (options.woo.enabled) {
1115
 
facebook-pixel-master.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
  * Description: No codding <strong>Facebook Pixel</strong> and <strong>Google Analytics</strong> install. Track key actions with our Global 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 free add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff.
7
- * Version: 7.1.5
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
@@ -13,7 +13,7 @@
13
  * Tested up to: 5.3
14
  *
15
  * WC requires at least: 2.6.0
16
- * WC tested up to: 3.9
17
  *
18
  * Text Domain: pys
19
  */
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
  * Description: No codding <strong>Facebook Pixel</strong> and <strong>Google Analytics</strong> install. Track key actions with our Global 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 free add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff.
7
+ * Version: 7.1.4
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
13
  * Tested up to: 5.3
14
  *
15
  * WC requires at least: 2.6.0
16
+ * WC tested up to: 3.8
17
  *
18
  * Text Domain: pys
19
  */
includes/class-events-manager.php CHANGED
@@ -10,8 +10,6 @@ class EventsManager {
10
 
11
  public $doingAMP = false;
12
 
13
- private $dynamicEventsParams = array();
14
- private $dynamicEventsTriggers = array();
15
  private $staticEvents = array();
16
 
17
  public function __construct() {
@@ -41,8 +39,6 @@ class EventsManager {
41
 
42
  $data = array(
43
  'staticEvents' => $this->staticEvents,
44
- 'dynamicEventsParams' => $this->dynamicEventsParams,
45
- 'dynamicEventsTriggers' => $this->dynamicEventsTriggers,
46
  );
47
 
48
  // collect options for configured pixel
@@ -144,8 +140,6 @@ class EventsManager {
144
  $this->setupCustomEvents();
145
  }
146
 
147
- $this->setupFDPEvents();
148
-
149
  if ( isWooCommerceActive() && PYS()->getOption( 'woo_enabled' ) ) {
150
  $this->setupWooCommerceEvents();
151
  }
@@ -226,63 +220,6 @@ class EventsManager {
226
  }
227
 
228
  }
229
- /**
230
- * @param FDPEvent $event
231
- * @param $triggers
232
- */
233
-
234
- private function addFDPDynamicEvent( $event ) {
235
-
236
- foreach ( PYS()->getRegisteredPixels() as $pixel ) {
237
- /** @var Pixel|Settings $pixel */
238
-
239
- $eventData = $pixel->getEventData( 'fdp_event', $event );
240
- if ( false === $eventData ) {
241
- continue;
242
- }
243
-
244
- if ( $pixel->getSlug() == 'facebook' ) {
245
-
246
- $this->dynamicEventsParams[ $event->event_name ]['facebook'] = array(
247
- 'name' => $eventData['name'],
248
- 'params' => sanitizeParams( $eventData['data'] ),
249
- 'hasTimeWindow' => $event->hasTimeWindow(),
250
- 'timeWindow' => $event->getTimeWindow(),
251
- );
252
- }
253
-
254
- $this->dynamicEventsTriggers[ $event->trigger_type ][ $event->event_name ][] = $event->trigger_value;
255
- }
256
- }
257
-
258
- private function setupFDPEvents() {
259
-
260
- if(PYS()->getRegisteredPixels()['facebook'] == null ) return;
261
-
262
- $pixel = PYS()->getRegisteredPixels()['facebook'];
263
-
264
- foreach ( $pixel->getFDPEvents() as $event ) {
265
-
266
- if ( 'fdp_view_content' == $event->event_name && is_single()&& get_post_type() == 'post' ) {
267
- $this->addStaticEvent( 'fdp_event', $event );
268
- }
269
-
270
- if ( 'fdp_view_category' == $event->event_name && is_category() ) {
271
- $this->addStaticEvent( 'fdp_event', $event );
272
- }
273
-
274
- if ( 'fdp_add_to_cart' == $event->event_name && is_single()&& get_post_type() == 'post' ) {
275
-
276
- $this->addFDPDynamicEvent( $event );
277
- }
278
-
279
- if ( 'fdp_purchase' == $event->event_name && is_single()&& get_post_type() == 'post' ) {
280
-
281
- $this->addFDPDynamicEvent( $event );
282
- }
283
- }
284
-
285
- }
286
 
287
  private function setupWooCommerceEvents() {
288
 
@@ -403,9 +340,7 @@ class EventsManager {
403
 
404
  public function setupWooSingleProductData() {
405
  global $product;
406
-
407
- if($product == null) return;
408
-
409
  /** @var \WC_Product $product */
410
  if ( isWooCommerceVersionGte( '2.6' ) ) {
411
  $product_id = $product->get_id();
@@ -423,7 +358,7 @@ class EventsManager {
423
  foreach ( $product->get_available_variations() as $variation ) {
424
 
425
  $variation = wc_get_product( $variation['variation_id'] );
426
- if(!$variation) continue;
427
  if ( isWooCommerceVersionGte( '2.6' ) ) {
428
  $product_ids[] = $variation->get_id();
429
  } else {
10
 
11
  public $doingAMP = false;
12
 
 
 
13
  private $staticEvents = array();
14
 
15
  public function __construct() {
39
 
40
  $data = array(
41
  'staticEvents' => $this->staticEvents,
 
 
42
  );
43
 
44
  // collect options for configured pixel
140
  $this->setupCustomEvents();
141
  }
142
 
 
 
143
  if ( isWooCommerceActive() && PYS()->getOption( 'woo_enabled' ) ) {
144
  $this->setupWooCommerceEvents();
145
  }
220
  }
221
 
222
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
 
224
  private function setupWooCommerceEvents() {
225
 
340
 
341
  public function setupWooSingleProductData() {
342
  global $product;
343
+
 
 
344
  /** @var \WC_Product $product */
345
  if ( isWooCommerceVersionGte( '2.6' ) ) {
346
  $product_id = $product->get_id();
358
  foreach ( $product->get_available_variations() as $variation ) {
359
 
360
  $variation = wc_get_product( $variation['variation_id'] );
361
+
362
  if ( isWooCommerceVersionGte( '2.6' ) ) {
363
  $product_ids[] = $variation->get_id();
364
  } else {
includes/functions-common.php CHANGED
@@ -562,10 +562,6 @@ function compareURLs( $url, $base = '', $rule = 'match' ) {
562
  if ( $base == $url ) {
563
  return true;
564
  }
565
-
566
- if(empty($base) || empty($url)) {
567
- return false;
568
- }
569
 
570
  if ( strpos( $base, $url ) !== false ) {
571
  return true;
562
  if ( $base == $url ) {
563
  return true;
564
  }
 
 
 
 
565
 
566
  if ( strpos( $base, $url ) !== false ) {
567
  return true;
includes/functions-custom-event.php CHANGED
@@ -75,12 +75,11 @@ function renderNumberInput( &$event, $key, $placeholder = null ) {
75
 
76
  /**
77
  * @param CustomEvent $event
78
- * @param string $key
79
- * @param bool $disabled
80
  */
81
- function renderSwitcherInput( &$event, $key,$disabled = false ) {
82
-
83
 
 
84
 
85
  $attr_name = "pys[event][$key]";
86
  $attr_id = 'pys_event_' . $key;
75
 
76
  /**
77
  * @param CustomEvent $event
78
+ * @param string $key
 
79
  */
80
+ function renderSwitcherInput( &$event, $key ) {
 
81
 
82
+ $disabled = false;
83
 
84
  $attr_name = "pys[event][$key]";
85
  $attr_id = 'pys_event_' . $key;
includes/views/html-main-events-edit.php CHANGED
@@ -59,7 +59,7 @@ if(isset( $_REQUEST['id'] )) {
59
  Event Trigger
60
  </div>
61
  <div class="card-body">
62
- <div class="row mb-3">
63
  <div class="col form-inline">
64
  <label>Fire event when</label>
65
  <?php Events\renderTriggerTypeInput( $event, 'trigger_type' ); ?>
@@ -71,16 +71,6 @@ if(isset( $_REQUEST['id'] )) {
71
  </div>
72
  </div>
73
 
74
- <div class="row">
75
- <div class="col form-inline">
76
- <?php Events\renderSwitcherInput( $event, 'enable_time_window',true ); ?>
77
- <label>Fire this event only once in</label>
78
- <?php Events\renderNumberInput( $event, 'time_window', '24' ); ?>
79
- <label>hours</label>
80
- <?php renderProBadge( 'https://www.pixelyoursite.com/?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature' ); ?>
81
- </div>
82
- </div>
83
-
84
  <div id="page_visit_panel" class="event_triggers_panel" data-trigger_type="page_visit" style="display: none;">
85
  <div class="row mt-3 event_trigger" data-trigger_id="0" style="display: none;">
86
  <div class="col">
59
  Event Trigger
60
  </div>
61
  <div class="card-body">
62
+ <div class="row">
63
  <div class="col form-inline">
64
  <label>Fire event when</label>
65
  <?php Events\renderTriggerTypeInput( $event, 'trigger_type' ); ?>
71
  </div>
72
  </div>
73
 
 
 
 
 
 
 
 
 
 
 
74
  <div id="page_visit_panel" class="event_triggers_panel" data-trigger_type="page_visit" style="display: none;">
75
  <div class="row mt-3 event_trigger" data-trigger_id="0" style="display: none;">
76
  <div class="col">
includes/views/html-main-general.php CHANGED
@@ -85,92 +85,6 @@ if ( ! defined( 'ABSPATH' ) ) {
85
  </div>
86
  </div>
87
 
88
- <div class="card">
89
- <div class="card-header">
90
- Dynamic Ads for Blog Setup <?php cardCollapseBtn(); ?>
91
- </div>
92
- <div class="card-body">
93
- <div class="row mt-3">
94
- <div class="col-11">
95
- This setup will help you to run Facebook Dynamic Product Ads for your blog content.
96
- </div>
97
- </div>
98
- <div class="row mt-3">
99
- <div class="col">
100
- <a href="https://www.pixelyoursite.com/facebook-dynamic-product-ads-for-wordpress" target="_blank">Click here to learn how to do it</a>
101
- </div>
102
- </div>
103
- <?php if ( Facebook()->enabled() ) : ?>
104
-
105
- <div class="row mt-3">
106
- <div class="col">
107
- <label>Content_type</label><?php
108
- $options = array(
109
- 'product' => 'Product',
110
- '' => 'Empty'
111
- );
112
- Facebook()->render_select_input( 'fdp_content_type',$options ); ?>
113
- </div>
114
- </div>
115
-
116
- <div class="row mt-3">
117
- <div class="col">
118
- <?php Facebook()->render_switcher_input( 'fdp_view_content_enabled' ); ?>
119
- <h4 class="switcher-label">Enable the ViewContent on every blog page</h4>
120
- </div>
121
- </div>
122
- <div class="row mt-3">
123
- <div class="col">
124
- <?php Facebook()->render_switcher_input( 'fdp_view_category_enabled' ); ?>
125
- <h4 class="switcher-label">Enable the ViewCategory on every blog categories page</h4>
126
- </div>
127
- </div>
128
- <div class="row mt-3">
129
- <div class="col-11">
130
- <?php Facebook()->render_switcher_input( 'fdp_add_to_cart_enabled' ); ?>
131
- <h4 class="switcher-label">Enable the AddToCart event on every blog page</h4>
132
- </div>
133
-
134
- <div class="col-11 form-inline col-offset-left">
135
- <label>Fire the AddToCart when scroll to</label>
136
- <?php Facebook()->render_number_input( 'fdp_add_to_cart_event_fire_scroll',50 ); ?>
137
- <label>%</label>
138
- </div>
139
- </div>
140
- <div class="row mt-3">
141
- <div class="col-11">
142
- <?php Facebook()->render_switcher_input( 'fdp_purchase_enabled' ); ?>
143
- <h4 class="switcher-label">Enable the Purchase event on every blog page</h4>
144
- </div>
145
-
146
- <div class="col-11 form-inline col-offset-left">
147
- <label>Fire the Purchase event</label>
148
-
149
- <?php
150
- $options = array(
151
- 'scroll_pos' => 'Page Scroll',
152
- 'comment' => 'User commented',
153
- 'css_click' => 'Click on CSS selector',
154
- //Default event fires
155
- );
156
- Facebook()->render_select_input( 'fdp_purchase_event_fire',$options ); ?>
157
- <span id="fdp_purchase_event_fire_scroll_block">
158
- <?php Facebook()->render_number_input( 'fdp_purchase_event_fire_scroll',50 ); ?> <span>%</span>
159
- </span>
160
-
161
- <?php Facebook()->render_text_input( 'fdp_purchase_event_fire_css',"CSS selector"); ?>
162
- </div>
163
- </div>
164
- <div class="row mt-5">
165
- <div class="col">
166
- <strong>You need to upload your blog posts into a Facebook Product Catalog.</strong> You can do this with our dedicated plugin:
167
- <a href="https://www.pixelyoursite.com/wordpress-feed-facebook-dpa" target="_blank">Click Here</a>
168
- </div>
169
- </div>
170
- <?php endif; ?>
171
- </div>
172
- </div>
173
-
174
  <h2 class="section-title">Global Events</h2>
175
 
176
  <!-- GeneralEvent -->
85
  </div>
86
  </div>
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  <h2 class="section-title">Global Events</h2>
89
 
90
  <!-- GeneralEvent -->
includes/views/html-main-woo.php CHANGED
@@ -947,38 +947,6 @@ e&utm_campaign=pro-feature' ); ?>
947
  </div>
948
  </div>
949
 
950
-
951
-
952
- <div class="card">
953
- <div class="card-header">
954
- Track product list performance on Google Analytics
955
- <?php renderProBadge( 'https://www.pixelyoursite.com/google-analytics?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature' ); ?>
956
- <?php cardCollapseBtn(); ?>
957
- </div>
958
- <div class="card-body">
959
- <?php if ( GA()->enabled() ) : ?>
960
- <div class="row mb-1">
961
- <div class="col">
962
- <?php GA()->render_switcher_input( 'woo_view_category_enabled_tmp',false,true ); ?>
963
- <h4 class="switcher-label">Enable the view_item_list event on Google Analytics(categories, related products, search, shortcodes)</h4>
964
- </div>
965
- </div>
966
- <div class="row mb-2">
967
- <div class="col col-offset-left">
968
- <?php GA()->render_checkbox_input( 'woo_view_category_non_interactive_tmp', 'Non-interactive event',true ); ?>
969
- </div>
970
- </div>
971
- <div class="row mb-1">
972
- <div class="col">
973
- <?php GA()->render_switcher_input( 'woo_select_content_enabled_tmp',false,true ); ?>
974
- <h4 class="switcher-label">Enable the select_content event on Google Analytics(when a product is clicked on categories, related products, search, shortcodes)</h4>
975
- </div>
976
- </div>
977
- <?php endif; ?>
978
- </div>
979
- </div>
980
-
981
-
982
  <h2 class="section-title">PRO Events</h2>
983
 
984
  <h2 class="section-title">Advanced Marketing Events</h2>
947
  </div>
948
  </div>
949
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
950
  <h2 class="section-title">PRO Events</h2>
951
 
952
  <h2 class="section-title">Advanced Marketing Events</h2>
modules/facebook/FDPEvent.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
-
3
-
4
- namespace PixelYourSite;
5
-
6
- /**
7
- * Class FDPEvent
8
- * @property string event_name
9
- * @property string content_type
10
- * @property string trigger_type
11
- * @property string trigger_value
12
- * */
13
- class FDPEvent
14
- {
15
- private $data = array();
16
-
17
- public function __get( $key ) {
18
- if(isset($this->data[$key])) return $this->data[$key];
19
- return "";
20
- }
21
-
22
- public function __set( $key,$value ){
23
- $this->data[$key] = $value;
24
- }
25
-
26
- public function hasTimeWindow() {
27
- return false;
28
- }
29
-
30
- public function getTimeWindow() {
31
- return 0;
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/facebook/facebook.php CHANGED
@@ -8,7 +8,6 @@ if ( ! defined( 'ABSPATH' ) ) {
8
 
9
  /** @noinspection PhpIncludeInspection */
10
  require_once PYS_FREE_PATH . '/modules/facebook/function-helpers.php';
11
- require_once PYS_FREE_PATH . '/modules/facebook/FDPEvent.php';
12
 
13
  use PixelYourSite\Facebook\Helpers;
14
 
@@ -105,9 +104,6 @@ class Facebook extends Settings implements Pixel {
105
  case 'custom_event':
106
  return $this->getCustomEventParams( $args );
107
 
108
- case 'fdp_event':
109
- return $this->getFDPEventParams( $args );
110
-
111
  case 'woo_view_content':
112
  return $this->getWooViewContentEventParams();
113
 
@@ -262,88 +258,6 @@ class Facebook extends Settings implements Pixel {
262
 
263
  }
264
 
265
- public function getFDPEvents() {
266
- $events = array();
267
- $contentType = $this->getOption("fdp_content_type");
268
- if($this->getOption("fdp_view_content_enabled")) {
269
- $event = new FDPEvent();
270
- $event->event_name = "fdp_view_content";
271
- $event->content_type = $contentType;
272
- $events[] = $event;
273
- }
274
- if($this->getOption("fdp_view_category_enabled")) {
275
- $event = new FDPEvent();
276
- $event->event_name = "fdp_view_category";
277
- $event->content_type = $contentType;
278
- $events[] = $event;
279
- }
280
- if($this->getOption("fdp_add_to_cart_enabled")) {
281
- $event = new FDPEvent();
282
- $event->event_name = "fdp_add_to_cart";
283
- $event->content_type = $contentType;
284
- $event->trigger_type = "scroll_pos";
285
- $event->trigger_value = $this->getOption("fdp_add_to_cart_event_fire_scroll");
286
- $events[] = $event;
287
- }
288
- if($this->getOption("fdp_purchase_enabled")) {
289
- $event = new FDPEvent();
290
- $event->event_name = "fdp_purchase";
291
- $event->content_type = $contentType;
292
- $event->trigger_type = $this->getOption("fdp_purchase_event_fire");
293
- if($event->trigger_type == "scroll_pos") {
294
- $event->trigger_value = $this->getOption("fdp_purchase_event_fire_scroll");
295
- }
296
- if($event->trigger_type == "css_click") {
297
- $event->trigger_value = $this->getOption("fdp_purchase_event_fire_css");
298
- }
299
-
300
- $events[] = $event;
301
- }
302
- return $events;
303
- }
304
-
305
- /**
306
- * @param FDPEvent $event
307
- * @return array
308
- */
309
-
310
- private function getFDPEventParams($event){
311
-
312
- $name = "";
313
- $params = "";
314
-
315
- if($event->event_name == "fdp_view_content") {
316
- $name = "ViewContent";
317
- $params = Helpers\getFDPViewContentEventParams();
318
- }
319
-
320
- if($event->event_name == "fdp_view_category") {
321
- $name = "ViewCategory";
322
- $params = Helpers\getFDPViewCategoryEventParams();
323
- }
324
-
325
- if($event->event_name == "fdp_add_to_cart") {
326
- $name = "AddToCart";
327
- $params = Helpers\getFDPAddToCartEventParams();
328
- }
329
-
330
- if($event->event_name == "fdp_purchase") {
331
- $name = "Purchase";
332
- $params = Helpers\getFDPPurchaseEventParams();
333
- }
334
-
335
-
336
- if($event->content_type) {
337
- $params["content_type"] = $event->content_type;
338
- }
339
-
340
- return array(
341
- 'name' => $name,
342
- 'data' => $params,
343
- 'delay' => 0,
344
- );
345
- }
346
-
347
  private function getWooViewContentEventParams() {
348
  global $post;
349
 
8
 
9
  /** @noinspection PhpIncludeInspection */
10
  require_once PYS_FREE_PATH . '/modules/facebook/function-helpers.php';
 
11
 
12
  use PixelYourSite\Facebook\Helpers;
13
 
104
  case 'custom_event':
105
  return $this->getCustomEventParams( $args );
106
 
 
 
 
107
  case 'woo_view_content':
108
  return $this->getWooViewContentEventParams();
109
 
258
 
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  private function getWooViewContentEventParams() {
262
  global $post;
263
 
modules/facebook/function-helpers.php CHANGED
@@ -453,103 +453,4 @@ function getEddCustomAudiencesOptimizationParams( $post_id ) {
453
 
454
  return $params;
455
 
456
- }
457
-
458
- function getFDPViewContentEventParams() {
459
- $tagsArray = wp_get_post_tags();
460
- $catArray = get_the_category();
461
-
462
- $tags = "";
463
- if(is_array($tagsArray)) {
464
- $tags = implode(", ",$tagsArray);
465
- }
466
-
467
- $func = function($value) {
468
- return $value->cat_name;
469
- };
470
- $catArray = array_map($func,$catArray);
471
- $categories = implode(", ",$catArray);
472
-
473
-
474
- $params = array(
475
- 'content_name' => get_the_title(),
476
- 'content_ids' => get_the_ID(),
477
- 'tags' => $tags,
478
- 'categories' => $categories
479
- );
480
-
481
-
482
- return $params;
483
- }
484
-
485
- function getFDPViewCategoryEventParams() {
486
- global $wp_query;
487
- $func = function($value) {
488
- return $value->ID;
489
- };
490
- $ids = array_map($func,$wp_query->posts);
491
-
492
-
493
- $params = array(
494
- 'content_name' => single_term_title('', 0),
495
- 'content_ids' => json_encode($ids)
496
- );
497
-
498
- return $params;
499
- }
500
-
501
- function getFDPAddToCartEventParams() {
502
- $tagsArray = wp_get_post_tags();
503
- $catArray = get_the_category();
504
-
505
- $tags = "";
506
- if(is_array($tagsArray)) {
507
- $tags = implode(", ",$tagsArray);
508
- }
509
-
510
- $func = function($value) {
511
- return $value->cat_name;
512
- };
513
- $catArray = array_map($func,$catArray);
514
- $categories = implode(", ",$catArray);
515
-
516
-
517
- $params = array(
518
- 'content_name' => get_the_title(),
519
- 'content_ids' => get_the_ID(),
520
- 'tags' => $tags,
521
- 'categories' => $categories,
522
- 'value' => 0
523
- );
524
-
525
-
526
- return $params;
527
- }
528
-
529
- function getFDPPurchaseEventParams() {
530
- $tagsArray = wp_get_post_tags();
531
- $catArray = get_the_category();
532
-
533
- $tags = "";
534
- if(is_array($tagsArray)) {
535
- $tags = implode(", ",$tagsArray);
536
- }
537
-
538
- $func = function($value) {
539
- return $value->cat_name;
540
- };
541
- $catArray = array_map($func,$catArray);
542
- $categories = implode(", ",$catArray);
543
-
544
-
545
- $params = array(
546
- 'content_name' => get_the_title(),
547
- 'content_ids' => get_the_ID(),
548
- 'tags' => $tags,
549
- 'categories' => $categories,
550
- 'value' => 0
551
- );
552
-
553
-
554
- return $params;
555
  }
453
 
454
  return $params;
455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  }
modules/facebook/options_defaults.json CHANGED
@@ -30,16 +30,5 @@
30
  "edd_remove_from_cart_enabled": true,
31
  "edd_add_to_cart_enabled": true,
32
  "edd_view_content_enabled": true,
33
- "edd_view_category_enabled": true,
34
-
35
-
36
- "fdp_content_type" : "product",
37
- "fdp_view_content_enabled": false,
38
- "fdp_view_category_enabled": false,
39
- "fdp_add_to_cart_enabled": false,
40
- "fdp_add_to_cart_event_fire_scroll": "50",
41
- "fdp_purchase_enabled": false,
42
- "fdp_purchase_event_fire" : "scroll_pos",
43
- "fdp_purchase_event_fire_scroll": "90",
44
- "fdp_purchase_event_fire_css": ""
45
  }
30
  "edd_remove_from_cart_enabled": true,
31
  "edd_add_to_cart_enabled": true,
32
  "edd_view_content_enabled": true,
33
+ "edd_view_category_enabled": true
 
 
 
 
 
 
 
 
 
 
 
34
  }
modules/facebook/options_fields.json CHANGED
@@ -30,15 +30,5 @@
30
  "edd_remove_from_cart_enabled": "checkbox",
31
  "edd_add_to_cart_enabled": "checkbox",
32
  "edd_view_content_enabled": "checkbox",
33
- "edd_view_category_enabled": "checkbox",
34
-
35
- "fdp_content_type" : "select",
36
- "fdp_view_content_enabled": "checkbox",
37
- "fdp_view_category_enabled": "checkbox",
38
- "fdp_add_to_cart_enabled": "checkbox",
39
- "fdp_add_to_cart_event_fire_scroll": "text",
40
- "fdp_purchase_enabled": "checkbox",
41
- "fdp_purchase_event_fire" : "select",
42
- "fdp_purchase_event_fire_scroll": "text",
43
- "fdp_purchase_event_fire_css": "text"
44
  }
30
  "edd_remove_from_cart_enabled": "checkbox",
31
  "edd_add_to_cart_enabled": "checkbox",
32
  "edd_view_content_enabled": "checkbox",
33
+ "edd_view_category_enabled": "checkbox"
 
 
 
 
 
 
 
 
 
 
34
  }
modules/google_analytics/ga.php CHANGED
@@ -379,28 +379,18 @@ class GA extends Settings implements Pixel {
379
  return false;
380
  }
381
  $content_id = GA\Helpers\getWooProductContentId($product_id);
382
- $product = wc_get_product( $product_id );
383
  $price = getWooProductPriceToDisplay( $product_id, 1 );
384
- $name = $product->get_title();
385
-
386
- if ( $product->get_type() == 'variation' ) {
387
- $variation_name = implode("/", $product->get_variation_attributes());
388
- $categories = implode( '/', getObjectTerms( 'product_cat', $product->get_parent_id() ) );
389
- } else {
390
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
391
- $variation_name = null;
392
- }
393
 
394
  $params = array(
395
  'event_category' => 'ecommerce',
396
  'items' => array(
397
  array(
398
  'id' => $content_id,
399
- 'name' => $name,
400
- 'category' => $categories,
401
  'quantity' => 1,
402
  'price' => $price,
403
- 'variant' => $variation_name,
404
  ),
405
  ),
406
  'non_interaction' => $this->getOption( 'woo_add_to_cart_non_interactive' ),
@@ -436,21 +426,13 @@ class GA extends Settings implements Pixel {
436
 
437
  $product_id = $cart_item['product_id'];
438
 
439
- $product = wc_get_product( $product_id );
440
- $name = $product->get_title();
441
 
442
  if ( ! empty( $cart_item['variation_id'] ) ) {
443
- $variation = wc_get_product( (int) $cart_item['variation_id'] );
444
- if($variation->get_type() == 'variation') {
445
- $variation_name = implode("/", $variation->get_variation_attributes());
446
- $categories = implode( '/', getObjectTerms( 'product_cat', $variation->get_parent_id() ) );
447
- } else {
448
- $variation_name = null;
449
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
450
- }
451
  } else {
452
  $variation_name = null;
453
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
454
  }
455
 
456
  return array(
@@ -460,8 +442,8 @@ class GA extends Settings implements Pixel {
460
  'items' => array(
461
  array(
462
  'id' => $product_id,
463
- 'name' => $name,
464
- 'category' => $categories,
465
  'quantity' => $cart_item['quantity'],
466
  'price' => getWooProductPriceToDisplay( $product_id, $cart_item['quantity'] ),
467
  'variant' => $variation_name,
@@ -507,21 +489,14 @@ class GA extends Settings implements Pixel {
507
  $product_id = GA\Helpers\getWooCartItemId( $line_item );
508
  $content_id = GA\Helpers\getWooProductContentId( $product_id );
509
 
 
510
  $product = wc_get_product( $product_id );
511
- $name = $product->get_title();
512
 
513
  if ( $line_item['variation_id'] ) {
514
- $variation = wc_get_product( $line_item['variation_id'] );
515
- if($variation->get_type() == 'variation') {
516
- $variation_name = implode("/", $variation->get_variation_attributes());
517
- $categories = implode( '/', getObjectTerms( 'product_cat', $variation->get_parent_id() ) );
518
- } else {
519
- $variation_name = null;
520
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
521
- }
522
  } else {
523
  $variation_name = null;
524
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
525
  }
526
 
527
  /**
@@ -557,8 +532,8 @@ class GA extends Settings implements Pixel {
557
 
558
  $item = array(
559
  'id' => $content_id,
560
- 'name' => $name,
561
- 'category' => $categories,
562
  'quantity' => $qty,
563
  'price' => $price,
564
  'variant' => $variation_name,
@@ -597,27 +572,19 @@ class GA extends Settings implements Pixel {
597
  $product_id = GA\Helpers\getWooCartItemId( $cart_item );
598
  $content_id = GA\Helpers\getWooProductContentId( $product_id );
599
 
600
- $product = wc_get_product( $product_id );
601
- $name = $product->get_title();
602
 
603
  if ( $cart_item['variation_id'] ) {
604
- $variation = wc_get_product( $cart_item['variation_id'] );
605
- if ( $variation->get_type() == 'variation' ) {
606
- $variation_name = implode("/", $variation->get_variation_attributes());
607
- $categories = implode( '/', getObjectTerms( 'product_cat', $variation->get_parent_id() ) );
608
- } else {
609
- $variation_name = null;
610
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
611
- }
612
  } else {
613
  $variation_name = null;
614
- $categories = implode( '/', getObjectTerms( 'product_cat', $product_id ) );
615
  }
616
 
617
  $item = array(
618
  'id' => $content_id,
619
- 'name' => $name,
620
- 'category' => $categories,
621
  'quantity' => $cart_item['quantity'],
622
  'price' => getWooProductPriceToDisplay( $product_id ),
623
  'variant' => $variation_name,
379
  return false;
380
  }
381
  $content_id = GA\Helpers\getWooProductContentId($product_id);
382
+ $product = get_post( $product_id );
383
  $price = getWooProductPriceToDisplay( $product_id, 1 );
 
 
 
 
 
 
 
 
 
384
 
385
  $params = array(
386
  'event_category' => 'ecommerce',
387
  'items' => array(
388
  array(
389
  'id' => $content_id,
390
+ 'name' => $product->post_title,
391
+ 'category' => implode( '/', getObjectTerms( 'product_cat', $product_id ) ),
392
  'quantity' => 1,
393
  'price' => $price,
 
394
  ),
395
  ),
396
  'non_interaction' => $this->getOption( 'woo_add_to_cart_non_interactive' ),
426
 
427
  $product_id = $cart_item['product_id'];
428
 
429
+ $product = get_post( $product_id );
 
430
 
431
  if ( ! empty( $cart_item['variation_id'] ) ) {
432
+ $variation = get_post( (int) $cart_item['variation_id'] );
433
+ $variation_name = $variation->post_title;
 
 
 
 
 
 
434
  } else {
435
  $variation_name = null;
 
436
  }
437
 
438
  return array(
442
  'items' => array(
443
  array(
444
  'id' => $product_id,
445
+ 'name' => $product->post_title,
446
+ 'category' => implode( '/', getObjectTerms( 'product_cat', $product_id ) ),
447
  'quantity' => $cart_item['quantity'],
448
  'price' => getWooProductPriceToDisplay( $product_id, $cart_item['quantity'] ),
449
  'variant' => $variation_name,
489
  $product_id = GA\Helpers\getWooCartItemId( $line_item );
490
  $content_id = GA\Helpers\getWooProductContentId( $product_id );
491
 
492
+ $post = get_post( $product_id );
493
  $product = wc_get_product( $product_id );
 
494
 
495
  if ( $line_item['variation_id'] ) {
496
+ $variation = get_post( $line_item['variation_id'] );
497
+ $variation_name = $variation->post_title;
 
 
 
 
 
 
498
  } else {
499
  $variation_name = null;
 
500
  }
501
 
502
  /**
532
 
533
  $item = array(
534
  'id' => $content_id,
535
+ 'name' => $post->post_title,
536
+ 'category' => implode( '/', getObjectTerms( 'product_cat', $product_id ) ),
537
  'quantity' => $qty,
538
  'price' => $price,
539
  'variant' => $variation_name,
572
  $product_id = GA\Helpers\getWooCartItemId( $cart_item );
573
  $content_id = GA\Helpers\getWooProductContentId( $product_id );
574
 
575
+ $product = get_post( $product_id );
 
576
 
577
  if ( $cart_item['variation_id'] ) {
578
+ $variation = get_post( $cart_item['variation_id'] );
579
+ $variation_name = $variation->post_title;
 
 
 
 
 
 
580
  } else {
581
  $variation_name = null;
 
582
  }
583
 
584
  $item = array(
585
  'id' => $content_id,
586
+ 'name' => $product->post_title,
587
+ 'category' => implode( '/', getObjectTerms( 'product_cat', $product_id ) ),
588
  'quantity' => $cart_item['quantity'],
589
  'price' => getWooProductPriceToDisplay( $product_id ),
590
  'variant' => $variation_name,
modules/head_footer/head_footer.php CHANGED
@@ -81,7 +81,7 @@ class HeadFooter extends Settings {
81
  }
82
 
83
  if ( ! isset( $_POST['pys_head_footer'] ) ) {
84
- // delete_post_meta( $post_id, '_pys_head_footer' );
85
  return;
86
  }
87
 
81
  }
82
 
83
  if ( ! isset( $_POST['pys_head_footer'] ) ) {
84
+ delete_post_meta( $post_id, '_pys_head_footer' );
85
  return;
86
  }
87
 
pixelyoursite.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- define( 'PYS_FREE_VERSION', '7.1.5' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '2.0.6' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '1.0.0' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ define( 'PYS_FREE_VERSION', '7.1.4' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '2.0.6' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '1.0.0' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: PixelYourSite, themister
3
  Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Easy Digital Downloads Pixel, Easy Digital Downloads Google Analytics, Head & Footer scripts, Enhanced Ecommerce, Pinterest tag
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
- Tested up to: 5.3
7
- Stable tag: 7.1.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -345,7 +345,7 @@ There's a strange solution: it appears that if you have the Yoast plugin install
345
 
346
  Yes, there are, and we will explain them here:
347
 
348
- *We offer you the possibility to voluntarily subscribe to our newsletter and get valuable tips. We manage our newsletter using ActiveCampaing. When you subscribe, we will call our server that intermediates the API connection, and then the data is sent to ActiveCampaign. The information that is passed: the name you provide and the email. If you check the "I use WooCommerce" checkbox, we will add this information as a tag, to give you better tips in the future.
349
 
350
  *Add-on updates: the plugin works with free or paid add-ons (for Pinterest, Bing, etc) that we provide and host on our server. When you install such an add-on, we will do checks for updates. If you have a valid license for the add-on, we will automatically download the latest version of the add-on from our servers. The core plugin (PixelYourSite itself) updates are provided using WordPress own servers.
351
 
@@ -355,7 +355,7 @@ Yes, there are, and we will explain them here:
355
 
356
  **Do you record data about the websites' traffic**
357
 
358
- NO, absolutely not! We don't track any type of data about your website. We simply implement the pixel/tag code.
359
 
360
 
361
 
@@ -388,21 +388,6 @@ NO, absolutely not! We don't track any type of data about your website. We simpl
388
 
389
  == Changelog ==
390
 
391
- = PixelYourSite 7.1.5 =
392
-
393
- * New features: Facebook Dynamic Ads events for blog posts. Simulate the DPA required events on normal blog posts. We will soon release a dedicated plugin that will help you import your blog content into a Facebook Product Catalog.
394
-
395
- * Google Analytics Enhanced Ecommerce: we removed the variation name from the product title and we added it as a separate parameter.
396
-
397
- * Google Analytics Enhanced Ecommerce: we fixed an error with variable products category.
398
-
399
- * Elementor: we fixed an error that was deleting Head & Footer scripts when a page was saved using Elementor.
400
-
401
- * UI updates to reflect new paid features: fire custom events once in X hours; Google Analytics list performance tracking.
402
-
403
- * Small code change to declare WooCommerce 3.9 compatibility.
404
-
405
-
406
  = PixelYourSite 7.1.4 =
407
 
408
  * Minor code changes to declare compatibility with WordPress 5.3 and WooCommerce 3.8.
@@ -432,7 +417,7 @@ Recommendation: if you have manually added events using the On-Page trigger, tes
432
 
433
  * Compatibility with WooCommerce 3.7
434
 
435
- * New structure for the Form and Comment events. It will help you better identify what actions have fired the events.
436
 
437
  Form Event for the Facebook Pixel and the Pinterest Tag:
438
 
3
  Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Easy Digital Downloads Pixel, Easy Digital Downloads Google Analytics, Head & Footer scripts, Enhanced Ecommerce, Pinterest tag
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
+ Tested up to: 5.4
7
+ Stable tag: 7.1.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
345
 
346
  Yes, there are, and we will explain them here:
347
 
348
+ *We offer you the possibility to voluntarily subscribe to our newsletter and get valuable tips. We manage our newsletter using ActiveCampaing. When you subscribe, we will call our server that intermediates the API connection, and then the data is sent to ActiveCampaign. The information that is passed: the name you provide and the email. If you check the "I use WooCommerce" checkbox, we will add this information as a tag, to give you better tips in the future.
349
 
350
  *Add-on updates: the plugin works with free or paid add-ons (for Pinterest, Bing, etc) that we provide and host on our server. When you install such an add-on, we will do checks for updates. If you have a valid license for the add-on, we will automatically download the latest version of the add-on from our servers. The core plugin (PixelYourSite itself) updates are provided using WordPress own servers.
351
 
355
 
356
  **Do you record data about the websites' traffic**
357
 
358
+ NO, absolutely not! We don't track any type of data about your website. We simply implement the pixel/tag code.
359
 
360
 
361
 
388
 
389
  == Changelog ==
390
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  = PixelYourSite 7.1.4 =
392
 
393
  * Minor code changes to declare compatibility with WordPress 5.3 and WooCommerce 3.8.
417
 
418
  * Compatibility with WooCommerce 3.7
419
 
420
+ * New structure for the Form and Comment events. It will help you better identify what actions have fired the events.
421
 
422
  Form Event for the Facebook Pixel and the Pinterest Tag:
423