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

Version Description

Download this release

Release Info

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

Code changes from version 4.0.3 to 5.0.0

facebook-pixel-master.php CHANGED
@@ -5,23 +5,21 @@
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
- Version: 4.0.3
9
  License: GPLv3
10
  */
11
 
12
- // If this file is called directly, abort.
13
- if ( ! defined( 'WPINC' ) ) { die; }
14
-
15
- if( defined( 'WP_DEBUG' ) && WP_DEBUG == true ) {
16
- error_reporting( E_ALL );
17
  }
18
 
19
- define( 'PYS_FREE_VERSION_REAL', '4.0.3' );
20
- define( 'PYS_FREE_VERSION', '4.0.0'); // for plugin notices capability
21
 
22
- require_once( 'inc/common.php' );
23
  require_once( 'inc/admin_notices.php' );
 
 
24
  require_once( 'inc/core.php' );
 
25
  require_once( 'inc/ajax-standard.php' );
26
 
27
  add_action( 'plugins_loaded', 'pys_free_init' );
@@ -32,7 +30,7 @@ function pys_free_init() {
32
  pys_initialize_settings();
33
  }
34
 
35
- if( is_admin() || pys_get_option( 'general', 'enabled' ) == false || pys_is_disabled_for_role() || ! pys_get_option( 'general', 'pixel_id' ) ) {
36
  return;
37
  }
38
 
@@ -57,12 +55,14 @@ function pys_free_init() {
57
  add_action( 'wp_head', 'pys_search_event', 3 );
58
  add_action( 'wp_head', 'pys_standard_events', 3 );
59
  add_action( 'wp_head', 'pys_woocommerce_events', 3 );
 
60
 
61
  add_action( 'wp_head', 'pys_output_js_events_code', 4 );
62
  add_action( 'wp_head', 'pys_output_custom_events_code', 4 );
63
 
64
  add_action( 'wp_footer', 'pys_output_noscript_code', 10 );
65
  add_action( 'wp_footer', 'pys_output_woo_ajax_events_code', 10 );
 
66
 
67
  // add add_to_cart ajax support only if woocommerce installed and events enabled
68
  if ( pys_get_option( 'woo', 'enabled' ) && ( pys_get_option( 'woo', 'on_add_to_cart_btn' ) || pys_get_option( 'woo', 'on_thank_you_page' ) ) ) {
@@ -71,13 +71,19 @@ function pys_free_init() {
71
 
72
  }
73
 
 
 
 
 
 
 
 
74
  add_filter( 'pys_event_params', 'pys_add_domain_param', 10, 2 );
75
 
76
  }
77
 
78
  if ( ! function_exists( 'pys_admin_menu' ) ) {
79
 
80
- add_action( 'admin_menu', 'pys_admin_menu' );
81
  function pys_admin_menu() {
82
 
83
  if ( false == current_user_can( 'manage_options' ) ) {
@@ -88,11 +94,12 @@ if ( ! function_exists( 'pys_admin_menu' ) ) {
88
 
89
  }
90
 
 
 
91
  }
92
 
93
  if ( ! function_exists( 'pys_restrict_admin_pages' ) ) {
94
 
95
- add_action( 'current_screen', 'pys_restrict_admin_pages' );
96
  function pys_restrict_admin_pages() {
97
 
98
  $screen = get_current_screen();
@@ -103,21 +110,24 @@ if ( ! function_exists( 'pys_restrict_admin_pages' ) ) {
103
 
104
  }
105
 
 
 
106
  }
107
 
108
  if ( ! function_exists( 'pys_admin_page_callback' ) ) {
109
 
110
  function pys_admin_page_callback() {
111
-
112
  ## update plugin options
113
  if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'pys_update_options' ) && isset( $_POST['pys'] ) ) {
114
  update_option( 'pixel_your_site', $_POST['pys'] );
115
  }
116
 
117
- ## delete standard or dynamic events
118
- if( isset( $_GET['action'] ) && $_GET['action'] == 'pys_delete_events'
119
  && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'pys_delete_events' )
120
- && isset( $_GET['events_ids'] ) && isset( $_GET['events_type'] ) ) {
 
121
 
122
  pys_delete_events( $_GET['events_ids'], $_GET['events_type'] );
123
 
@@ -140,81 +150,66 @@ if ( ! function_exists( 'pys_admin_page_callback' ) ) {
140
  }
141
 
142
  if ( ! function_exists( 'pys_admin_scripts' ) ) {
143
-
144
  add_action( 'admin_enqueue_scripts', 'pys_admin_scripts' );
145
  function pys_admin_scripts() {
146
-
147
- // include only if plugin admin page
148
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'pixel-your-site' ) {
149
-
150
  add_thickbox();
151
-
152
  wp_enqueue_style( 'pys', plugins_url( 'css/admin.css', __FILE__ ), array(), PYS_FREE_VERSION );
153
  wp_enqueue_script( 'pys', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION );
154
-
155
- wp_localize_script( 'pys', 'pys', array(
156
- 'ajax' => admin_url( 'admin-ajax.php' ),
157
- ) );
158
  }
159
-
160
  }
161
-
162
  }
163
 
164
  if ( ! function_exists( 'pys_public_scripts' ) ) {
165
-
166
  function pys_public_scripts() {
167
-
168
  $in_footer = (bool) pys_get_option( 'general', 'in_footer', false );
169
-
170
  wp_enqueue_script( 'pys', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION, $in_footer );
171
-
172
  }
173
-
174
  }
175
 
176
  if ( ! function_exists( 'pys_free_plugin_activated' ) ) {
177
-
178
  register_activation_hook( __FILE__, 'pys_free_plugin_activated' );
179
  function pys_free_plugin_activated() {
180
-
181
  if ( false == is_admin() || false == current_user_can( 'manage_options' ) ) {
182
  return;
183
  }
184
-
185
  if ( ! function_exists( 'is_plugin_active' ) ) {
186
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
187
  }
188
-
189
  if ( is_plugin_active( 'pixelyoursite-pro/pixelyoursite-pro.php' ) ) {
190
  wp_die( 'Please deactivate PixelYourSite Pro version First.', 'Plugin Activation' );
191
  }
192
-
193
  $options = get_option( 'pixel_your_site' );
194
  if ( ! $options || ! isset( $options['general']['pixel_id'] ) || empty( $options['general']['pixel_id'] ) ) {
195
  pys_initialize_settings();
196
  }
197
-
198
- // set plugin activation data and remember version (used in admin notices)
199
- $activation_date = get_option( 'pysf_activation_date', '' );
200
- $version = get_option( 'pysf_plugin_version', '' );
201
-
202
- if ( empty( $activation_date ) || version_compare( $version, PYS_FREE_VERSION, '<' ) ) {
203
- update_option( 'pysf_activation_date', time() );
204
- update_option( 'pysf_plugin_version', PYS_FREE_VERSION );
205
- update_option( 'pysf_notice_dismiss', '' );
206
- update_option( 'woo_pysf_notice_dismiss', '' );
207
- }
208
-
209
  }
210
-
211
  }
212
 
213
  if ( ! function_exists( 'pys_initialize_settings' ) ) {
214
 
215
  function pys_initialize_settings() {
216
 
217
- if( false == is_admin() || false == current_user_can( 'manage_options' ) ) {
218
  return;
219
  }
220
 
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
+ Version: 5.0.0
9
  License: GPLv3
10
  */
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit; // Exit if accessed directly.
 
 
 
14
  }
15
 
16
+ define( 'PYS_FREE_VERSION', '5.0.0' );
 
17
 
 
18
  require_once( 'inc/admin_notices.php' );
19
+ require_once( 'inc/common.php' );
20
+ require_once( 'inc/common-edd.php' );
21
  require_once( 'inc/core.php' );
22
+ require_once( 'inc/core-edd.php' );
23
  require_once( 'inc/ajax-standard.php' );
24
 
25
  add_action( 'plugins_loaded', 'pys_free_init' );
30
  pys_initialize_settings();
31
  }
32
 
33
+ if ( is_admin() || pys_get_option( 'general', 'enabled' ) == false || pys_is_disabled_for_role() || ! pys_get_option( 'general', 'pixel_id' ) ) {
34
  return;
35
  }
36
 
55
  add_action( 'wp_head', 'pys_search_event', 3 );
56
  add_action( 'wp_head', 'pys_standard_events', 3 );
57
  add_action( 'wp_head', 'pys_woocommerce_events', 3 );
58
+ add_action( 'wp_head', 'pys_edd_events', 3 );
59
 
60
  add_action( 'wp_head', 'pys_output_js_events_code', 4 );
61
  add_action( 'wp_head', 'pys_output_custom_events_code', 4 );
62
 
63
  add_action( 'wp_footer', 'pys_output_noscript_code', 10 );
64
  add_action( 'wp_footer', 'pys_output_woo_ajax_events_code', 10 );
65
+ add_action( 'wp_footer', 'pys_output_edd_ajax_events_code', 10 );
66
 
67
  // add add_to_cart ajax support only if woocommerce installed and events enabled
68
  if ( pys_get_option( 'woo', 'enabled' ) && ( pys_get_option( 'woo', 'on_add_to_cart_btn' ) || pys_get_option( 'woo', 'on_thank_you_page' ) ) ) {
71
 
72
  }
73
 
74
+ ## add pixel code to EDD add_to_cart buttons
75
+ if ( pys_get_option( 'edd', 'enabled' ) && pys_get_option( 'edd', 'on_add_to_cart_btn', false ) ) {
76
+
77
+ add_filter( 'edd_purchase_link_args', 'pys_edd_purchase_link_args', 10, 1 );
78
+
79
+ }
80
+
81
  add_filter( 'pys_event_params', 'pys_add_domain_param', 10, 2 );
82
 
83
  }
84
 
85
  if ( ! function_exists( 'pys_admin_menu' ) ) {
86
 
 
87
  function pys_admin_menu() {
88
 
89
  if ( false == current_user_can( 'manage_options' ) ) {
94
 
95
  }
96
 
97
+ add_action( 'admin_menu', 'pys_admin_menu' );
98
+
99
  }
100
 
101
  if ( ! function_exists( 'pys_restrict_admin_pages' ) ) {
102
 
 
103
  function pys_restrict_admin_pages() {
104
 
105
  $screen = get_current_screen();
110
 
111
  }
112
 
113
+ add_action( 'current_screen', 'pys_restrict_admin_pages' );
114
+
115
  }
116
 
117
  if ( ! function_exists( 'pys_admin_page_callback' ) ) {
118
 
119
  function pys_admin_page_callback() {
120
+
121
  ## update plugin options
122
  if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'pys_update_options' ) && isset( $_POST['pys'] ) ) {
123
  update_option( 'pixel_your_site', $_POST['pys'] );
124
  }
125
 
126
+ ## delete standard events
127
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'pys_delete_events'
128
  && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'pys_delete_events' )
129
+ && isset( $_GET['events_ids'] ) && isset( $_GET['events_type'] )
130
+ ) {
131
 
132
  pys_delete_events( $_GET['events_ids'], $_GET['events_type'] );
133
 
150
  }
151
 
152
  if ( ! function_exists( 'pys_admin_scripts' ) ) {
153
+
154
  add_action( 'admin_enqueue_scripts', 'pys_admin_scripts' );
155
  function pys_admin_scripts() {
156
+
 
157
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'pixel-your-site' ) {
158
+
159
  add_thickbox();
160
+
161
  wp_enqueue_style( 'pys', plugins_url( 'css/admin.css', __FILE__ ), array(), PYS_FREE_VERSION );
162
  wp_enqueue_script( 'pys', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION );
163
+
 
 
 
164
  }
165
+
166
  }
167
+
168
  }
169
 
170
  if ( ! function_exists( 'pys_public_scripts' ) ) {
171
+
172
  function pys_public_scripts() {
173
+
174
  $in_footer = (bool) pys_get_option( 'general', 'in_footer', false );
175
+
176
  wp_enqueue_script( 'pys', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION, $in_footer );
177
+
178
  }
179
+
180
  }
181
 
182
  if ( ! function_exists( 'pys_free_plugin_activated' ) ) {
183
+
184
  register_activation_hook( __FILE__, 'pys_free_plugin_activated' );
185
  function pys_free_plugin_activated() {
186
+
187
  if ( false == is_admin() || false == current_user_can( 'manage_options' ) ) {
188
  return;
189
  }
190
+
191
  if ( ! function_exists( 'is_plugin_active' ) ) {
192
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
193
  }
194
+
195
  if ( is_plugin_active( 'pixelyoursite-pro/pixelyoursite-pro.php' ) ) {
196
  wp_die( 'Please deactivate PixelYourSite Pro version First.', 'Plugin Activation' );
197
  }
198
+
199
  $options = get_option( 'pixel_your_site' );
200
  if ( ! $options || ! isset( $options['general']['pixel_id'] ) || empty( $options['general']['pixel_id'] ) ) {
201
  pys_initialize_settings();
202
  }
203
+
 
 
 
 
 
 
 
 
 
 
 
204
  }
205
+
206
  }
207
 
208
  if ( ! function_exists( 'pys_initialize_settings' ) ) {
209
 
210
  function pys_initialize_settings() {
211
 
212
+ if ( false == current_user_can( 'manage_options' ) ) {
213
  return;
214
  }
215
 
inc/admin_notices.php CHANGED
@@ -1,375 +1,174 @@
1
  <?php
2
- function woofp_admin_notices($return=false){
3
-
4
- if( false == current_user_can( 'manage_options' ) ) {
5
- return;
6
- }
7
 
8
-
9
- $activation_time = get_option('pysf_activation_date', '');
10
- $version = get_option('pysf_plugin_version', '');
11
-
12
-
13
- $current_time = time();
14
-
15
- if( empty($activation_time) || version_compare($version, PYS_FREE_VERSION, '<') ){
16
- $activation_time = $current_time;
17
- update_option( 'pysf_activation_date', $activation_time);
18
- update_option( 'pysf_plugin_version', PYS_FREE_VERSION);
19
- update_option( 'pysf_notice_dismiss', '');
20
- update_option( 'woo_pysf_notice_dismiss', '');
21
  }
22
 
 
23
 
24
- //Expiration time ( 3 days ) = ( number of days * hours * minutes * seconds )
25
- $expiration_days = 3;
26
- $expiration_time = $activation_time + ( $expiration_days * 24 * 60 * 60);
27
-
28
- //calculate number of days passed since activation;
29
- $days_passed = woofp_days_passed($current_time, $activation_time);
30
-
31
- //date of expiration
32
- $expiration_date = date('l jS \of F Y', $expiration_time);
33
-
34
- $link_1 = 'http://www.pixelyoursite.com/limited-offer?utm_source=wadmin&utm_medium=wordpress&utm_campaign=limited-offer';
35
- $link_2 = 'http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wadmin&utm_medium=wordpress&utm_campaign=last-message';
36
-
37
-
38
-
39
- //Message for day 1
40
- $day_1_text = '<span class="pysf_note"><b>Upgrade to PixelYourSite PRO </b></span> and optimize your FB ads for clicks on links or buttons with <b>Dynamic Events</b>. Improve conversion attribution and retargeting reach by using <b>Advanced Matching</b>. Track <b>Traffic Source</b> and UTM for better retargeting with Custom Audiences. Don’t miss this limited discount:<br> ';
41
- $day_1_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to download PixelYourSite Pro for a big discount</b></a>';
42
-
43
- //Message for day 2
44
- $day_2_text = '<span class="pysf_note"><b>Use Dynamic Events </b></span> and optimize your ads for <b>on-site actions</b> (trigger events on CLICKS, page scroll, mouse over). Track the <b>Traffic Source</b> and UTM for all your events:<br>';
45
- $day_2_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Download PixelYourSite Pro for a limited discount</b></a>';
46
-
47
- //Message for day 3
48
- $day_3_text = '<span class="pysf_note"><b>Last chance to get your DISCOUNT:</b></span> With PixelYourSite Pro you can use <b>Dynamic Events</b> (optimize campaigns for actions on your site, like clicks, page scroll or mouse over), plus enable <b>Advanced Matching</b> (new FB feature that increases conversion attribution and reach for retargeting campaigns). <b>Traffic Source</b> and UTM are added to all the events, so you can create <i>highly accurate retargeting campaigns</i>: <br>';
49
- $day_3_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Download Now (offer ending soon)</b></a>';
50
-
51
- //Message for day 4 to 7;
52
- $day_4_to_7_text = '<span class="pysf_note"><b>Your Facebook Pixel FREE Guide:</b></span> After <i>more than 10 000 users</i> and many hours spent on answering questions, we decided to make a comprehensive guide about the new Facebook Pixel.</br>Have you got it yet? <b>Download it now for free:</b> <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click here for your Guide</a>';
53
-
54
-
55
- //Message for day 7 to 12
56
- $day_7_to_12_text = '<span class="pysf_note"><b>PixelYourSite FREE Guide:</b></span> Get your FREE guide about the new Facebook Pixel, because it will help you to make better ads.</br> Make sure you read it too: <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Download it now for free</a>';
57
-
58
- $options = array(
59
-
60
-
61
- //message for day 1
62
- array(
63
-
64
- 'day' => 1,
65
- 'message' => $day_1_text,
66
- 'visibility' => 'visible', /* visible OR hidden */
67
-
68
- ),
69
-
70
- //message for day 2
71
- array(
72
-
73
- 'day' => 2,
74
- 'message' => $day_2_text,
75
- 'visibility' => 'visible', /* visible OR hidden */
76
-
77
-
78
- ),
79
-
80
- //message for day 3
81
- array(
82
-
83
- 'day' => 3,
84
- 'message' => $day_3_text,
85
- 'visibility' => 'visible', /* visible OR hidden */
86
-
87
-
88
- ),
89
-
90
-
91
- //message for day 4-7
92
- //This will start on day 4
93
- //and end on day 7
94
- array(
95
-
96
- 'day' => '4-7',
97
- 'message' => $day_4_to_7_text,
98
- 'visibility' => 'hidden', /* visible OR hidden */
99
-
100
-
101
- ),
102
-
103
- //message for day 7-12
104
- //This will start on day 7
105
- //and end on day 12
106
- array(
107
-
108
- 'day' => '7-12',
109
- 'message' => $day_7_to_12_text,
110
- 'visibility' => 'visible', /* visible OR hidden */
111
-
112
-
113
- ),
114
-
115
-
116
- );
117
-
118
-
119
- //Messages when WooCommerce is installed and activated
120
-
121
- //WooCommerce Message for day 1
122
- $woo_day_1_text = 'WooCommerce Day 1 Message.';
123
- $woo_day_1_text = '<span class="pysf_note"><b>PixelYourSite PRO + Product Catalog Feed Plugin Bundle:</b></span> Track Conversion Value and start with Facebook Dynamic Ads for WooCommerce in minutes. <br>Get <b>PixelYourSite Pro</b> (<i>fine tune Conversion Value</i>, optimize WooCommerce events for Custom Audiences, track tags, product tags, <b>Traffic Source</b> and UTM, enable Advanced Matching and use <i>Dynamic Events</i>)<br>Get <b>Product Catalog Feed Plugin</b> (create WooCommerce Dynamic Ads Product Catalog XML feeds)<br> ';
124
- $woo_day_1_text .= '<a href="http://www.pixelyoursite.com/bundle-offer?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to DOWNLOAD the bundle now (best deal)</b></a>';
125
-
126
-
127
-
128
- //WooCommerce Message for day 2
129
- $woo_day_2_text = 'WooCommerce Day 2 Message.';
130
- $woo_day_2_text = '<span class="pysf_note"><b>Customize WooCommerce Conversion Value:</b></span> With PixelYourSite Pro you can <b>fine tune WooCommerce Events Values</b> and improve conversion tracking. Include/Exclude Tax or Shipping, plus define the value for each WooCommerce event as the full product price, price percent or a global value. Turn ON/OFF value tracking for each event according to your needs.<br>';
131
- $woo_day_2_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to download PixelYourSite Pro for a serious discount</b></a>';
132
-
133
-
134
- //WooCommerce Message for day 3
135
- $woo_day_3_text = 'WooCommerce Day 3 Message.';
136
- $woo_day_3_text = '<span class="pysf_note"><b>WooCommerce Custom Audiences Optimization:</b></span> Build super-powerful Custom Audiences with PixelYourSite PRO. Track product name, category or product tags, plus shipping and payment methods, client city or country, coupon used and coupons names. All the events will have <b>Traffic Source and UTM</B> as parameters. Use them to <b>create highly relevant retargeting campaigns.</b></br>';
137
- $woo_day_3_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to download PixelYourSite Pro for a serious discount</b></a>';
138
-
139
-
140
- //WooCommerce Message for day 4 to 7;
141
- $woo_day_4_to_7_text = 'WooCommerce Day 4 to 7 Message.';
142
- $woo_day_4_to_7_text = '<span class="pysf_note"><b>Track Traffic Source:</b></span> With PixelYourSite Pro you can track <b>Traffic Source</b> and use it to build super-powerful Custom Audiences for your retargeting campaigns. Create Custom Audiences based on <b>where the users are coming from (Google, FB, any other site or URL), including a particular Facebook Ad</b><br> ';
143
- $woo_day_4_to_7_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click to download PixelYourSite Pro for a serious discount</a>';
144
-
145
-
146
- //WooCommerce Message for day 7 to 12
147
- $woo_day_7_to_12_text = 'WooCommerce Day 7 to 12 Message.';
148
- $woo_day_7_to_12_text = '<span class="pysf_note"><b>Your Facebook Pixel FREE Guide:</b></span> After <i>more than 10 000 users</i> and many hours spent on answering questions, we decided to make a comprehensive guide about the new Facebook Pixel. <br>Have you got it yet? <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click here for your own FREE copy</a>';
149
 
 
150
 
 
151
 
152
- $woo_options = array(
153
-
154
-
155
- //woocommerce message for day 1
156
- array(
157
-
158
- 'day' => 1,
159
- 'message' => $woo_day_1_text,
160
- 'visibility' => 'visible', /* visible OR hidden */
161
-
162
- ),
163
-
164
- //woocommerce message for day 2
165
- array(
166
-
167
- 'day' => 2,
168
- 'message' => $woo_day_2_text,
169
- 'visibility' => 'visible', /* visible OR hidden */
170
-
171
-
172
- ),
173
-
174
- //woocommerce message for day 3
175
- array(
176
-
177
- 'day' => 3,
178
- 'message' => $woo_day_3_text,
179
- 'visibility' => 'visible', /* visible OR hidden */
180
-
181
-
182
- ),
183
-
184
-
185
- //woocommerce message for day 4-7
186
- //This will start on day 4
187
- //and end on day 7
188
- array(
189
-
190
- 'day' => '4-7',
191
- 'message' => $woo_day_4_to_7_text,
192
- 'visibility' => 'hidden', /* visible OR hidden */
193
-
194
-
195
- ),
196
-
197
- //woocommerce message for day 7-12
198
- //This will start on day 7
199
- //and end on day 12
200
- array(
201
-
202
- 'day' => '7-12',
203
- 'message' => $woo_day_7_to_12_text,
204
- 'visibility' => 'visible', /* visible OR hidden */
205
-
206
-
207
- ),
208
-
209
-
210
- );
211
-
212
-
213
-
214
-
215
-
216
- //we will store the message of each day
217
- $notice_message = '';
218
-
219
-
220
- if ( class_exists( 'WooCommerce' ) ) {
221
- //WooCommerce is installed
222
-
223
- //Get dismissed notices
224
- $dismiss_option = get_option( 'woo_pysf_notice_dismiss', '');
225
- $options = $woo_options;
226
-
227
- } else {
228
- //No WooCommerce
229
-
230
- //Get dismissed notices
231
- $dismiss_option = get_option( 'pysf_notice_dismiss', '');
232
-
233
- }
234
-
235
-
236
- //loop through notice settings
237
- foreach ($options as $key => $option) {
238
-
239
- $is_dismissed = isset( $dismiss_option[$option['day']] ) ? true : false;
240
-
241
- if( is_integer( $option['day']) ){
242
-
243
- //check if there is a message for a day and that it is on
244
- if( !$is_dismissed && $option['day'] == $days_passed && $option['visibility'] == 'visible' ){
245
-
246
- $dismiss_option = $option['day'];
247
- $notice_message = $option['message'];
248
- break;
249
- }
250
-
251
- } else {
252
-
253
- //check range of days
254
-
255
- $pieces = explode('-', $option['day']);
256
- $start = $pieces[0];
257
- $end = $pieces[1];
258
-
259
- //check if there is a message for a day and that it is on
260
- if( !$is_dismissed && ( $days_passed >= $start && $days_passed <= $end) && $option['visibility'] == 'visible' ){
261
-
262
- $dismiss_option = $option['day'];
263
- $notice_message = $option['message'];
264
- break;
265
- }
266
-
267
-
268
- }
269
- }
270
-
271
-
272
- if( !empty( $notice_message ) ){
273
 
274
- $notice = '<style type="text/css">
275
- .pysf_note{ color: #dd4e4e; }
276
- #pysf_notice {
277
- border-left-width: 10px;
278
- display: block;
279
- margin: 25px 20px 10px 2px;
280
- padding: 4px 10px;
281
- }
282
- #pysf_notice p{ width:98%;}
283
- .pysf_clear{ clear:both;}
284
- </style>';
285
-
286
- $html_class = '';
287
- $html_id = 'pysf_notice_tab';
288
- $button_html = '<button type="button" class="notice-dismiss" title="Dismiss Notice"><span class="screen-reader-text">Dismiss this notice.</span></button>';
289
- if( !$return){
290
- $html_class = 'update-nag notice is-dismissible';
291
- $html_id = 'pysf_notice';
292
- $button_html = '';
293
- }
294
 
295
- $notice .= '<div id="'.$html_id.'" class="'.$html_class.' pysf_clear pysf_notice pysf_notice_day_'.$dismiss_option.'" data-pysf="pysf_notice_day_'.$dismiss_option.'">';
296
- $notice .= '<p>'.$notice_message.'</p>';
297
- $notice .= $button_html;
298
- $notice .= '</div>';
299
 
300
- $notice .= "<script type='text/javascript'>
301
- jQuery(function($){
302
 
303
- jQuery(document).on( 'click', '.pysf_notice .notice-dismiss', function() {
304
-
305
- jQuery(this).closest('.notice-dismiss').fadeOut('slow');
306
 
307
- jQuery.ajax({
308
- url: ajaxurl,
309
- data: {
310
- action: 'pysf_notice_dismiss',
311
- option: '".$dismiss_option."'
312
- }
313
- });
314
-
315
- });
316
-
317
- });
318
- </script>";
319
-
320
- if( !$return)
321
- echo $notice;
322
- else
323
- return $notice;
324
- }
325
 
326
- }
327
 
 
328
 
 
 
329
 
330
- function woofp_admin_notices_action(){
331
- woofp_admin_notices();
332
  }
333
- if( isset($_GET['page']) && $_GET['page'] == 'woo-facebookpixel' ){
334
 
335
- } else {
336
- add_action( 'admin_notices', 'woofp_admin_notices_action' );
337
- }
338
 
339
- function ajax_pysf_notice_dismiss(){
340
 
341
- if ( false == current_user_can( 'manage_options' ) ) {
342
- return;
343
- }
344
 
345
- //@todo: verify nonce
346
 
347
- if ( class_exists( 'WooCommerce' ) ) {
348
- $name = 'woo_pysf_notice_dismiss';
349
- } else {
350
- $name = 'pysf_notice_dismiss';
351
- }
352
 
353
- if( isset($_REQUEST['option'])){
354
- $dismiss_option = get_option( $name, '');
355
- $dismiss_option[$_REQUEST['option']] = 1;
356
- update_option( $name, $dismiss_option);
357
- }
358
-
359
- die();
360
  }
361
- add_action('wp_ajax_pysf_notice_dismiss', 'ajax_pysf_notice_dismiss');
362
-
363
- //get number of days passed since activation
364
- function woofp_days_passed($current_time, $activation_time){
365
-
366
- $timepassed = $current_time-$activation_time;
367
- $timepassed = ( ( ( $timepassed/24 )/60 )/60 );
368
- $dayspassed = floor($timepassed);
369
- $dayspassed = $dayspassed + 1;
370
 
371
- return $dayspassed;
372
-
373
- }
374
 
375
 
1
  <?php
 
 
 
 
 
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
 
 
 
 
 
 
 
 
 
 
 
5
  }
6
 
7
+ require_once "admin_notices_content.php";
8
 
9
+ if ( ! function_exists( 'pys_admin_notices_hook' ) ) {
10
+
11
+ add_action( 'admin_notices', 'pys_admin_notices_hook' );
12
+ function pys_admin_notices_hook() {
13
+
14
+ if ( false == current_user_can( 'manage_options' ) ) {
15
+ return;
16
+ }
17
+
18
+ $now = time();
19
+ $activation_time = (int) get_option( 'pys_free_activation_time', null );
20
+ $version = get_option( 'pys_free_notices_version', null );
21
+
22
+ if ( empty( $activation_time ) || version_compare( $version, PYS_FREE_NOTICES_VERSION, '<' ) ) {
23
+
24
+ $activation_time = $now;
25
+
26
+ update_option( 'pys_free_activation_time', $activation_time );
27
+ update_option( 'pys_free_notices_version', PYS_FREE_NOTICES_VERSION );
28
+
29
+ ## reset dismissed notices
30
+ update_option( 'pys_free_dismissed_options', array() );
31
+
32
+ }
33
+
34
+ global $PYS_FREE_WOO_NOTICES, $PYS_FREE_EDD_NOTICES, $PYS_FREE_NO_WOO_NO_EDD_NOTICES;
35
+
36
+ ## switch suitable notices set
37
+ if( pys_is_woocommerce_active() ) {
38
+
39
+ $notices_set = $PYS_FREE_WOO_NOTICES;
40
+ $notices_set_name = 'PYS_FREE_WOO_NOTICES';
41
+
42
+ } else if ( pys_is_edd_active() ) {
43
+
44
+ $notices_set = $PYS_FREE_EDD_NOTICES;
45
+ $notices_set_name = 'PYS_FREE_EDD_NOTICES';
46
+
47
+ } else {
48
+
49
+ $notices_set = $PYS_FREE_NO_WOO_NO_EDD_NOTICES;
50
+ $notices_set_name = 'PYS_FREE_NO_WOO_NO_EDD_NOTICES';
51
+
52
+ }
53
+
54
+ $dismissed_notices = get_option( 'pys_free_dismissed_options', array() );
55
+
56
+ ## calc days passed since activation
57
+ $days_passed = pys_calc_days_passed( $now, $activation_time );
58
+
59
+ ## calc expiration time
60
+ // $expiration_days = 3;
61
+ // $expiration_time = $activation_time + $expiration_days * DAY_IN_SECONDS;
62
+
63
+ $content = null;
64
+ $notice_id = null;
65
+
66
+ foreach ( $notices_set as $notice ) {
67
+
68
+ if( empty( $dismissed_notices[ $notices_set_name ][ $notice['from'] ] ) ) {
69
+ $is_dismissed = false;
70
+ } else {
71
+ $is_dismissed = true;
72
+ }
73
+
74
+ if( $is_dismissed || $notice['visible'] == false ) {
75
+ break;
76
+ }
77
+
78
+ if ( $days_passed >= $notice['from'] && $days_passed <= $notice['to'] ) {
79
+
80
+ $notice_id = $notice['from'];
81
+ $content = $notice['content'];
82
+ break;
83
+
84
+ }
85
+
86
+ }
87
+
88
+ ## nothing to show
89
+ if( empty( $content ) ) {
90
+ return;
91
+ }
92
+
93
+ ?>
94
+
95
+ <style type="text/css">
96
+ .pys-notice p a {
97
+ color: #F4524D;
98
+ }
99
+ </style>
100
+
101
+ <div class="notice-warning notice is-dismissible pys-notice" data-pys-set-name="<?php esc_attr_e( $notices_set_name ); ?>" data-pys-notice-id="<?php esc_attr_e( $notice_id ); ?>">
102
+ <p><?php echo $content; ?></p>
103
+ </div>
104
+
105
+ <script type='text/javascript'>
106
+ jQuery(document).on('click', '.pys-notice .notice-dismiss', function () {
107
+
108
+ var wrapper = jQuery(this).parent('div.pys-notice'),
109
+ set_name = wrapper.data('pys-set-name'),
110
+ notice_id = wrapper.data('pys-notice-id');
111
+
112
+ jQuery.ajax({
113
+ url: ajaxurl,
114
+ data: {
115
+ action: 'pys_dismiss_admin_notice',
116
+ set: set_name,
117
+ id: notice_id,
118
+ _wpnonce: '<?php echo wp_create_nonce( 'pys_notice_dismiss' ); ?>'
119
+ }
120
+ })
121
+
122
+ });
123
+ </script>
124
+
125
+ <?php
126
+ }
 
 
 
 
 
 
 
127
 
128
+ }
129
 
130
+ if ( ! function_exists( 'pys_dismiss_admin_notice_ajax' ) ) {
131
 
132
+ add_action( 'wp_ajax_pys_dismiss_admin_notice', 'pys_dismiss_admin_notice_ajax' );
133
+ function pys_dismiss_admin_notice_ajax() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
+ if ( false == current_user_can( 'manage_options' ) ) {
136
+ exit();
137
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
+ if ( empty( $_GET['_wpnonce'] ) || false == wp_verify_nonce( $_GET['_wpnonce'], 'pys_notice_dismiss' ) ) {
140
+ exit();
141
+ }
 
142
 
143
+ if ( isset( $_GET['id'] ) && isset( $_GET['set'] )) {
 
144
 
145
+ $set_name = $_GET['set'];
146
+ $notice_id = $_GET['id'];
 
147
 
148
+ $dismissed_notices = get_option( 'pys_free_dismissed_options', array() );
149
+ $dismissed_notices[ $set_name ][ $notice_id ] = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
+ update_option( 'pys_free_dismissed_options', $dismissed_notices );
152
 
153
+ }
154
 
155
+ exit();
156
+ }
157
 
 
 
158
  }
 
159
 
160
+ if( ! function_exists( 'pys_calc_days_passed' ) ) {
 
 
161
 
162
+ function pys_calc_days_passed( $now, $time_to_compare ) {
163
 
164
+ $time_passed = ( $now - $time_to_compare ) / DAY_IN_SECONDS;
165
+ $time_passed = floor( $time_passed ) + 1;
 
166
 
167
+ return $time_passed;
168
 
169
+ }
 
 
 
 
170
 
 
 
 
 
 
 
 
171
  }
 
 
 
 
 
 
 
 
 
172
 
 
 
 
173
 
174
 
inc/admin_notices_content.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ define( 'PYS_FREE_NOTICES_VERSION', '5.0.0' );
8
+
9
+ ## WOO activated or WOO and EDD
10
+ $GLOBALS['PYS_FREE_WOO_NOTICES'] = array(
11
+
12
+ array(
13
+ 'from' => 1,
14
+ 'to' => 1,
15
+ 'content' => '<strong>Customize WooCommerce Conversion Value:</strong> With PixelYourSite Pro you can <strong>fine tune WooCommerce Events Values</strong> and improve conversion tracking. Include/Exclude Tax or Shipping, turn ON/OFF and fine-tune WooCommerce Events Value (full product price, price percent or a global value). Advance Purchase Event with super-useful parameters for Custom Audiences and retargeting.<br><a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpa-woo&utm_medium=wp&utm_campaign=wp-woo1" target="_blank"><strong>Click to download PixelYourSite Pro for a serious discount</strong></a>.',
16
+ 'visible' => true
17
+ ),
18
+
19
+ array(
20
+ 'from' => 2,
21
+ 'to' => 2,
22
+ 'content' => '<strong>PixelYourSite PRO + Product Catalog Feed Plugin Bundle:</strong> Track Conversion Value and start with Facebook Dynamic Ads for WooCommerce in minutes. <br>Get <strong>PixelYourSite Pro</strong> (<em>fine tune Conversion Value</em>, optimize WooCommerce events for Custom Audiences, track tags, product tags, <strong>Traffic Source</strong> and UTM, enable Advanced Matching and use <em>Dynamic Events</em>)<br>Get <strong>Product Catalog Feed Plugin</strong> (create WooCommerce Dynamic Ads Product Catalog XML feeds)<br><a href="http://www.pixelyoursite.com/bundle-offer?utm_source=wp-woo-bundle&utm_medium=wp&utm_campaign=wp-woo-bundle2" target="_blank"><strong>Click For The Bundle Offer (best deal)</strong></a>.',
23
+ 'visible' => true
24
+ ),
25
+
26
+ array(
27
+ 'from' => 3,
28
+ 'to' => 3,
29
+ 'content' => '<strong>Secret Offer for WordPress Users: </strong> Get PixelYourSite PRO for WooCommerce with <a href="http://www.pixelyoursite.com/secret-offer?utm_source=wp-secret-offer-woo&utm_medium=wp&utm_campaign=secret-offer-woo3" target="_blank">this Exclusive Secret Offer</a>.',
30
+ 'visible' => true
31
+ ),
32
+
33
+ array(
34
+ 'from' => 4,
35
+ 'to' => 7,
36
+ 'content' => '<strong>PixelYourSite PRO Secret Offer:</strong> With PixelYourSite PRO you can build super-powerful Custom Audiences for improved retargeting. Track <strong>Traffic Source</strong> and <strong>URL Parameters,</strong> product name, category and tags, or the use of coupons. Enable <strong>Advanced Matching</strong> for better conversion attribution.<br><a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wp-secret-offer-woo&utm_medium=wp&utm_campaign=secret-offer-woo4-7" target="_blank">Discover Your Secret Offer</a>.',
37
+ 'visible' => true
38
+ ),
39
+
40
+ array(
41
+ 'from' => 8,
42
+ 'to' => 12,
43
+ 'content' => '<strong>Your Facebook Pixel FREE Guide:</strong> After <em>more than 25 000 users</em> and many hours spent on answering questions, we decided to make a comprehensive guide about the new Facebook Pixel. <br>Have you got it yet? <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wp-pixel-guide&utm_medium=wp&utm_campaign=wp-pixel-guide" target="_blank">Click here for your own FREE copy</a>.',
44
+ 'visible' => true
45
+ ),
46
+
47
+ );
48
+
49
+ ## EDD but not WOO activated
50
+ $GLOBALS['PYS_FREE_EDD_NOTICES'] = array(
51
+
52
+ array(
53
+ 'from' => 1,
54
+ 'to' => 1,
55
+ 'content' => '<strong>Customize Easy Digital Downloads Conversion Value:</strong> With PixelYourSite Pro you can <strong>fine tune EDD Events Values</strong> and improve conversion tracking. Include/Exclude Tax, turn ON/OFF and fine-tune EDD Events Value (full product price, price percent or a global value). Advance Purchase Event with super-useful parameters for Custom Audiences and retargeting.<br><a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpa-edd&utm_medium=wp&utm_campaign=wp-edd1" target="_blank"><strong>Click to download PixelYourSite Pro for a serious discount</strong></a>.',
56
+ 'visible' => true
57
+ ),
58
+
59
+ array(
60
+ 'from' => 2,
61
+ 'to' => 2,
62
+ 'content' => '<strong>Secret Offer for WordPress Users:</strong> Get PixelYourSite PRO for Easy Digital Downloads with this exclusive secret offer: <a href="http://www.pixelyoursite.com/secret-offer?utm_source=wp-secret-offer-edd&utm_medium=wp&utm_campaign=secret-offer-edd2" target="_blank">this Exclusive Secret Offer</a>.',
63
+ 'visible' => true
64
+ ),
65
+
66
+ array(
67
+ 'from' => 3,
68
+ 'to' => 3,
69
+ 'content' => '<strong>PixelYourSite PRO Secret Offer:</strong> With PixelYourSite PRO you can build super-powerful EDD Custom Audiences for improved retargeting. Track <strong>Traffic Source</strong> and <strong>URL Parameters,</strong> product name, category and tags, or the use of discount codes. Enable <strong>Advanced Matching</strong> for better conversion attribution.<br><a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wp-secret-offer-edd&utm_medium=wp&utm_campaign=secret-offer-edd3" target="_blank">Discover Your Secret Offer</a>.',
70
+ 'visible' => true
71
+ ),
72
+
73
+ array(
74
+ 'from' => 4,
75
+ 'to' => 7,
76
+ 'content' => '<strong>Your Facebook Pixel FREE Guide:</strong> After <em>more than 25 000 users</em> and many hours spent on answering questions, we decided to make a comprehensive guide about the new Facebook Pixel.</br>Have you got it yet? <strong>Download it now for free:</strong> <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wp-pixel-guide&utm_medium=wp&utm_campaign=wp-pixel-guide" target="_blank">Click here for your Guide</a>.',
77
+ 'visible' => true
78
+ ),
79
+
80
+ array(
81
+ 'from' => 8,
82
+ 'to' => 12,
83
+ 'content' => '<strong>PixelYourSite PRO Secret Offer:</strong> Get your FREE guide about the new Facebook Pixel, because it will help you to make better ads.</br> Make sure you read it too: <a href="http://www.pixelyoursite.com/secret-offer?utm_source=wp-secret-offer-edd&utm_medium=wp&utm_campaign=secret-offer-edd7-12" target="_blank">Click to find more</a>.',
84
+ 'visible' => true
85
+ ),
86
+
87
+ );
88
+
89
+ ## Both WOO and EDD not activated
90
+ $GLOBALS['PYS_FREE_NO_WOO_NO_EDD_NOTICES'] = array(
91
+
92
+ array(
93
+ 'from' => 1,
94
+ 'to' => 1,
95
+ 'content' => '<strong>Upgrade to PixelYourSite PRO</strong> and optimize your FB ads for clicks on links or buttons with <strong>Dynamic Events</strong>. Improve conversion attribution and retargeting reach by using <strong>Advanced Matching</strong>. Track the <strong>Traffic Source</strong> and URL parameters (UTM) for better retargeting with Custom Audiences. Don’t miss this limited discount:<br> <a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wp-non-woo-non-edd&utm_medium=wp&utm_campaign=wp1" target="_blank"><strong>Click to download PixelYourSite Pro for a serious discount</strong></a>.',
96
+ 'visible' => true
97
+ ),
98
+
99
+ array(
100
+ 'from' => 2,
101
+ 'to' => 2,
102
+ 'content' => '<strong>Secret Offer for WordPress Users:</strong> Upgrade to PixelYourSite PRO with <a href="http://www.pixelyoursite.com/secret-offer?utm_source=wp-secret-offer-non-woo-non-edd&utm_medium=wp&utm_campaign=secret-offer-wp2" target="_blank">this Exclusive Secret Offer</a>.',
103
+ 'visible' => true
104
+ ),
105
+
106
+ array(
107
+ 'from' => 3,
108
+ 'to' => 3,
109
+ 'content' => '<strong>PixelYourSite Secret Offer:</strong> Optimize your FB ads for key actions on your site wit Dynamic Events (fired on clicks, page scroll, or mouse over). Create super-powerful Custom Audiences based on Traffic Source or URL Parameters - <a href="http://www.pixelyoursite.com/secret-offer?utm_source=wp-secret-offer-non-woo-non-edd&utm_medium=wp&utm_campaign=secret-offer-wp3" target="_blank">Discover Your Secret Offer</a>.',
110
+ 'visible' => true
111
+ ),
112
+
113
+ array(
114
+ 'from' => 4,
115
+ 'to' => 7,
116
+ 'content' => '<strong>Your Facebook Pixel FREE Guide:</strong> After <em>more than 25 000 users</em> and many hours spent on answering questions, we decided to make a comprehensive guide about the new Facebook Pixel.</br>Have you got it yet? <strong>Download it now for free:</strong> <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wp-pixel-guide&utm_medium=wp&utm_campaign=wp-pixel-guide" target="_blank">Click here for your Guide</a>.',
117
+ 'visible' => true
118
+ ),
119
+
120
+ array(
121
+ 'from' => 8,
122
+ 'to' => 12,
123
+ 'content' => '<strong>PixelYourSite FREE Guide:</strong> Get your FREE guide about the new Facebook Pixel, because it will help you to make better ads.</br> Make sure you read it too: <a href="http://www.pixelyoursite.com/facebook-pixel-pdf-guide?utm_source=wp-pixel-guide&utm_medium=wp&utm_campaign=wp-pixel-guide" target="_blank">Download it now for free</a>.',
124
+ 'visible' => true
125
+ ),
126
+
127
+ );
inc/ajax-standard.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
 
 
 
 
 
3
  if ( ! function_exists( 'pys_edit_std_event' ) ) {
4
 
5
  add_action( 'wp_ajax_pys_edit_std_event', 'pys_edit_std_event' );
@@ -57,24 +61,26 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
57
  ?>
58
 
59
  <form action="" method="post" id="std-event-form">
60
-
61
  <?php wp_nonce_field( 'pys_update_std_event' ); ?>
62
-
63
  <input type="hidden" name="action" value="pys_update_std_event">
64
  <input type="hidden" name="std_event[id]" value="<?php esc_attr_e( $id ); ?>">
65
 
66
  <table class="layout <?php esc_attr_e( $table_class ); ?>">
 
67
  <tr>
68
  <td class="legend"><p class="label">URL:</p></td>
69
  <td>
70
  <input type="text" name="std_event[pageurl]" value="<?php esc_attr_e( $event['pageurl'] ); ?>"
71
  id="std-url">
72
- <span class="help">Event will trigger when this URL is visited.<br>If you add * at the end of the URL string, it will match all URLs starting with the this string.</span>
 
73
  </td>
74
  </tr>
75
 
76
  <tr>
77
- <td class="legend"><p class="label">Event type:</p></td>
78
  <td>
79
  <select name="std_event[eventtype]" id="std-event-type">
80
  <?php pys_event_types_select_options( $event['eventtype'] ); ?>
@@ -83,24 +89,29 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
83
  </tr>
84
 
85
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
86
- <td class="legend"><p class="label">Value:</p></td>
87
  <td>
88
  <input type="text" name="std_event[value]" value="<?php esc_attr_e( $event['value'] ); ?>">
89
- <span class="help">Mandatory for purchase event only.</span>
90
  </td>
91
  </tr>
92
 
93
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
94
- <td class="legend"><p class="label">Currency:</p></td>
95
  <td>
96
- <select name="std_event[currency]" id="currency" class="<?php echo $is_custom_currency ? 'custom-currency' : ''; ?>" >
97
- <option disabled <?php selected( false, $is_custom_currency && $event['currency'] ); ?> >Select Currency</option>
 
 
98
  <?php pys_currency_options( $event['currency'] ); ?>
99
  <option disabled></option>
100
- <option value="pys_custom_currency" <?php selected( true, $is_custom_currency ); ?> >Custom Currency</option>
 
101
  </select>
102
- <input type="text" name="std_event[custom_currency]" value="<?php echo $is_custom_currency ? $event['currency'] : ''; ?>" placeholder="Enter custom currency code" class="custom-currency-visible">
103
- <span class="help">Mandatory for purchase event only.</span>
 
 
104
  </td>
105
  </tr>
106
 
@@ -109,7 +120,8 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
109
  <td>
110
  <input type="text" name="std_event[content_name]"
111
  value="<?php esc_attr_e( $event['content_name'] ); ?>">
112
- <span class="help">Name of the page/product i.e 'Really Fast Running Shoes'.</span>
 
113
  </td>
114
  </tr>
115
 
@@ -118,7 +130,7 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
118
  <td>
119
  <input type="text" name="std_event[content_ids]"
120
  value="<?php esc_attr_e( $event['content_ids'] ); ?>">
121
- <span class="help">Product ids/SKUs associated with the event.</span>
122
  </td>
123
  </tr>
124
 
@@ -127,7 +139,8 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
127
  <td>
128
  <input type="text" name="std_event[content_type]"
129
  value="<?php esc_attr_e( $event['content_type'] ); ?>">
130
- <span class="help">The type of content. i.e product or product_group.</span>
 
131
  </td>
132
  </tr>
133
 
@@ -136,7 +149,7 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
136
  <td>
137
  <input type="text" name="std_event[content_category]"
138
  value="<?php esc_attr_e( $event['content_category'] ); ?>">
139
- <span class="help">Category of the page/product.</span>
140
  </td>
141
  </tr>
142
 
@@ -145,7 +158,7 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
145
  <td>
146
  <input type="text" name="std_event[num_items]"
147
  value="<?php esc_attr_e( $event['num_items'] ); ?>">
148
- <span class="help">The number of items in the cart. i.e '3'.</span>
149
  </td>
150
  </tr>
151
 
@@ -154,7 +167,8 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
154
  <td>
155
  <input type="text" name="std_event[order_id]"
156
  value="<?php esc_attr_e( $event['order_id'] ); ?>">
157
- <span class="help">The unique order id of the successful purchase. i.e 19.</span>
 
158
  </td>
159
  </tr>
160
 
@@ -163,7 +177,8 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
163
  <td>
164
  <input type="text" name="std_event[search_string]"
165
  value="<?php esc_attr_e( $event['search_string'] ); ?>">
166
- <span class="help">The string entered by the user for the search. i.e 'Shoes'.</span>
 
167
  </td>
168
  </tr>
169
 
@@ -171,49 +186,53 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
171
  <td class="legend"><p class="label">status:</p></td>
172
  <td>
173
  <input type="text" name="std_event[status]" value="<?php esc_attr_e( $event['status'] ); ?>">
174
- <span class="help">The status of the registration. i.e completed.</span>
 
175
  </td>
176
  </tr>
177
 
178
  <tr class="CustomCode-visible">
179
- <td class="legend"><p class="label" style="line-height: inherit;">Custom event code (advanced users
180
- only):</p></td>
181
  <td>
182
  <textarea name="std_event[code]" rows="5"
183
  style="width:100%;"><?php echo stripslashes( $event['code'] ); ?></textarea>
184
- <span class="help">The code inserted in the field MUST be complete, including <code>fbq('track',
185
- 'AddToCart', { … });</code></span>
186
  </td>
187
  </tr>
188
 
189
  <tr class="CustomEvent-visible tall">
190
- <td class="legend"><p class="label">Event name:</p></td>
191
  <td>
192
- <input type="text" name="std_event[custom_name]"
193
- value="<?php esc_attr_e( $event['custom_name'] ); ?>">
194
  </td>
195
  </tr>
196
 
197
- <?php foreach( $custom_params as $param => $value ) : ?>
198
 
199
- <?php $param_id = uniqid() . $param; ?>
200
 
201
- <tr class="class-<?php esc_attr_e( $param_id ); ?> ViewContent-visible Search-visible AddToCart-visible
202
- AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
203
- <td class="legend"><p class="label">Param name:</p></td>
204
- <td><input type="text" name="std_event[custom_names][<?php esc_attr_e( $param ); ?>]" value="<?php
205
- esc_attr_e( $param ); ?>"></td>
 
206
  </tr>
207
 
208
- <tr class="class-<?php esc_attr_e( $param_id ); ?> ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
209
- <td class="legend"><p class="label">Param value:</p></td>
210
- <td><input type="text" name="std_event[custom_values][<?php esc_attr_e( $param ); ?>]"
211
- value="<?php esc_attr_e( $value ); ?>"></td>
 
 
212
  </tr>
213
 
214
- <tr class="class-<?php esc_attr_e( $param_id ); ?> tall ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
215
  <td></td>
216
- <td><a href="#" class="remove-param" data-id="<?php esc_attr_e( $param_id ); ?>">Remove param</a></td>
 
217
  </tr>
218
 
219
  <?php endforeach; ?>
@@ -223,15 +242,17 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
223
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
224
  <td class="legend"></td>
225
  <td>
226
- <a href="#" class="button button-add-row button-primary action">Add Param</a>
 
227
  </td>
228
  </tr>
229
 
230
  </table>
231
 
232
  <div class="actions-row">
233
- <a href="#" class="button button-close action">Cancel</a>
234
- <a href="#" class="button button-save button-primary action disabled"><?php echo isset( $_REQUEST['id'] ) == true ? 'Save' : 'Add'; ?></a>
 
235
  </div>
236
 
237
  </form>
@@ -264,9 +285,9 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
264
  });
265
 
266
  // Show/hide custom currency field
267
- $('select#currency').on('change', function(){
268
 
269
- if( $(this).val() == 'pys_custom_currency' ) {
270
  $(this).addClass('custom-currency');
271
  } else {
272
  $(this).removeClass('custom-currency');
@@ -284,7 +305,7 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
284
  $('.button-save').on('click', function (e) {
285
  e.preventDefault();
286
 
287
- if( validate() == false ) {
288
  return;
289
  }
290
 
@@ -292,9 +313,10 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
292
  $(this).text('Saving...');
293
 
294
  var data = $('#std-event-form').serialize();
 
295
 
296
  $.ajax({
297
- url: '<?php echo admin_url('admin-ajax.php'); ?>',
298
  type: 'post',
299
  dataType: 'json',
300
  data: data
@@ -309,27 +331,31 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
309
 
310
  });
311
 
 
 
 
 
312
  /* Add new param/value group */
313
  var marker = $('#marker');
314
- $('.button-add-row').on('click', function(e) {
315
  e.preventDefault();
316
 
317
  var id = makeid();
318
 
319
- var html = '<tr class="class-'+id+' ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">';
320
- html += '<td class="legend"><p class="label">Param name:</p></td>';
321
- html += '<td><input type="text" name="std_event[custom_names]['+id+']" value=""></td>';
322
- html += '</tr>';
323
 
324
- html += '<tr class="class-'+id+' ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">';
325
- html += '<td class="legend"><p class="label">Param value:</p></td>';
326
- html += '<td><input type="text" name="std_event[custom_values]['+id+']" value=""></td>';
327
- html += '</tr>';
328
 
329
- html += '<tr class="class-'+id+' tall ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">';
330
- html += '<td></td>';
331
- html += '<td><a href="#" class="remove-param" data-id="'+id+'">Remove param</a></td>';
332
- html += '</tr>';
333
 
334
 
335
  $(html).insertBefore(marker);
@@ -337,24 +363,24 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
337
  });
338
 
339
  // Remove custom params row
340
- $(document).on('click', '.remove-param', function(e){
341
  e.preventDefault();
342
 
343
  var id = $(this).data('id');
344
- $('tr.class-'+id).remove();
345
 
346
  });
347
 
348
  // Form validation
349
- $('form').submit(function(e) {
350
 
351
- if( validate() == false ) {
352
  e.preventDefault();
353
  }
354
 
355
  });
356
 
357
- $('#std-url').on( 'change, keyup', function(e){
358
  validate();
359
  });
360
 
@@ -365,11 +391,11 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
365
  btnSave = $('.button-save'),
366
  isValid = true;
367
 
368
- if( eventType == null || pageURL.length == 0 ) {
369
  isValid = false;
370
  }
371
 
372
- if( isValid ) {
373
  btnSave.removeClass('disabled');
374
  } else {
375
  btnSave.addClass('disabled');
@@ -423,8 +449,11 @@ if ( ! function_exists( 'pys_update_std_event' ) ) {
423
 
424
  $custom_name = $data['custom_name'];
425
  $custom_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $custom_name );
 
 
426
 
427
  $data['eventtype'] = trim( $custom_name );
 
428
 
429
  }
430
 
@@ -432,10 +461,22 @@ if ( ! function_exists( 'pys_update_std_event' ) ) {
432
 
433
  foreach ( $data['custom_names'] as $key => $value ) {
434
 
435
- $key_name = $value;
436
- $key_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $key_name );
437
 
438
- $data[ $key_name ] = $data['custom_values'][ $key ];
 
 
 
 
 
 
 
 
 
 
 
 
439
 
440
  }
441
 
@@ -455,23 +496,23 @@ if ( ! function_exists( 'pys_update_std_event' ) ) {
455
  }
456
 
457
  if ( ! function_exists( 'pys_bulk_delete_std_events' ) ) {
458
-
459
  add_action( 'wp_ajax_pys_bulk_delete_std_events', 'pys_bulk_delete_std_events' );
460
  function pys_bulk_delete_std_events() {
461
-
462
  if ( false == current_user_can( 'manage_options' ) ) {
463
  return -1;
464
  }
465
-
466
  if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'pys_bulk_delete_std_events'
467
  || ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'pys_bulk_delete_std_events' )
468
  ) {
469
-
470
  return -1;
471
-
472
  }
473
 
474
- if( empty( $_POST['events_ids'] ) ) {
475
  return -1;
476
  }
477
 
@@ -481,5 +522,5 @@ if ( ! function_exists( 'pys_bulk_delete_std_events' ) ) {
481
  exit();
482
 
483
  }
484
-
485
  }
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
  if ( ! function_exists( 'pys_edit_std_event' ) ) {
8
 
9
  add_action( 'wp_ajax_pys_edit_std_event', 'pys_edit_std_event' );
61
  ?>
62
 
63
  <form action="" method="post" id="std-event-form">
64
+
65
  <?php wp_nonce_field( 'pys_update_std_event' ); ?>
66
+
67
  <input type="hidden" name="action" value="pys_update_std_event">
68
  <input type="hidden" name="std_event[id]" value="<?php esc_attr_e( $id ); ?>">
69
 
70
  <table class="layout <?php esc_attr_e( $table_class ); ?>">
71
+
72
  <tr>
73
  <td class="legend"><p class="label">URL:</p></td>
74
  <td>
75
  <input type="text" name="std_event[pageurl]" value="<?php esc_attr_e( $event['pageurl'] ); ?>"
76
  id="std-url">
77
+ <span
78
+ class="help"><?php _e( 'Event will trigger when this URL is visited.<br>If you add * at the end of the URL string, it will match all URLs starting with the this string.', 'pys' ); ?></span>
79
  </td>
80
  </tr>
81
 
82
  <tr>
83
+ <td class="legend"><p class="label"><?php _e( 'Event type:', 'pys' ); ?></p></td>
84
  <td>
85
  <select name="std_event[eventtype]" id="std-event-type">
86
  <?php pys_event_types_select_options( $event['eventtype'] ); ?>
89
  </tr>
90
 
91
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
92
+ <td class="legend"><p class="label"><?php _e( 'Value:', 'pys' ); ?></p></td>
93
  <td>
94
  <input type="text" name="std_event[value]" value="<?php esc_attr_e( $event['value'] ); ?>">
95
+ <span class="help"><?php _e( 'Mandatory for purchase event only.', 'pys' ); ?></span>
96
  </td>
97
  </tr>
98
 
99
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
100
+ <td class="legend"><p class="label"><?php _e( 'Currency:', 'pys' ); ?></p></td>
101
  <td>
102
+ <select name="std_event[currency]" id="currency"
103
+ class="<?php echo $is_custom_currency ? 'custom-currency' : ''; ?>">
104
+ <option
105
+ disabled <?php selected( false, $is_custom_currency && $event['currency'] ); ?> ><?php _e( 'Select Currency', 'pys' ); ?></option>
106
  <?php pys_currency_options( $event['currency'] ); ?>
107
  <option disabled></option>
108
+ <option
109
+ value="pys_custom_currency" <?php selected( true, $is_custom_currency ); ?> ><?php _e( 'Custom Currency', 'pys' ); ?></option>
110
  </select>
111
+ <input type="text" name="std_event[custom_currency]"
112
+ value="<?php echo $is_custom_currency ? $event['currency'] : ''; ?>"
113
+ placeholder="Enter custom currency code" class="custom-currency-visible">
114
+ <span class="help"><?php _e( 'Mandatory for purchase event only.', 'pys' ); ?></span>
115
  </td>
116
  </tr>
117
 
120
  <td>
121
  <input type="text" name="std_event[content_name]"
122
  value="<?php esc_attr_e( $event['content_name'] ); ?>">
123
+ <span
124
+ class="help"><?php _e( 'Name of the page/product i.e "Really Fast Running Shoes".', 'pys' ); ?></span>
125
  </td>
126
  </tr>
127
 
130
  <td>
131
  <input type="text" name="std_event[content_ids]"
132
  value="<?php esc_attr_e( $event['content_ids'] ); ?>">
133
+ <span class="help"><?php _e( 'Product ids/SKUs associated with the event.', 'pys' ); ?></span>
134
  </td>
135
  </tr>
136
 
139
  <td>
140
  <input type="text" name="std_event[content_type]"
141
  value="<?php esc_attr_e( $event['content_type'] ); ?>">
142
+ <span
143
+ class="help"><?php _e( 'The type of content. i.e product or product_group.', 'pys' ); ?></span>
144
  </td>
145
  </tr>
146
 
149
  <td>
150
  <input type="text" name="std_event[content_category]"
151
  value="<?php esc_attr_e( $event['content_category'] ); ?>">
152
+ <span class="help"><?php _e( 'Category of the page/product.', 'pys' ); ?></span>
153
  </td>
154
  </tr>
155
 
158
  <td>
159
  <input type="text" name="std_event[num_items]"
160
  value="<?php esc_attr_e( $event['num_items'] ); ?>">
161
+ <span class="help"><?php _e( 'The number of items in the cart. i.e 3.', 'pys' ); ?></span>
162
  </td>
163
  </tr>
164
 
167
  <td>
168
  <input type="text" name="std_event[order_id]"
169
  value="<?php esc_attr_e( $event['order_id'] ); ?>">
170
+ <span
171
+ class="help"><?php _e( 'The unique order id of the successful purchase. i.e 19.', 'pys' ); ?></span>
172
  </td>
173
  </tr>
174
 
177
  <td>
178
  <input type="text" name="std_event[search_string]"
179
  value="<?php esc_attr_e( $event['search_string'] ); ?>">
180
+ <span
181
+ class="help"><?php _e( 'The string entered by the user for the search. i.e "Shoes".', 'pys' ); ?></span>
182
  </td>
183
  </tr>
184
 
186
  <td class="legend"><p class="label">status:</p></td>
187
  <td>
188
  <input type="text" name="std_event[status]" value="<?php esc_attr_e( $event['status'] ); ?>">
189
+ <span
190
+ class="help"><?php _e( 'The status of the registration. i.e completed.', 'pys' ); ?></span>
191
  </td>
192
  </tr>
193
 
194
  <tr class="CustomCode-visible">
195
+ <td class="legend">
196
+ <p class="label" style="line-height: inherit;"><?php _e( 'Custom event code (advanced users only):', 'pys' ); ?></p></td>
197
  <td>
198
  <textarea name="std_event[code]" rows="5"
199
  style="width:100%;"><?php echo stripslashes( $event['code'] ); ?></textarea>
200
+ <span
201
+ class="help"><?php _e( 'The code inserted in the field MUST be complete, including <code>fbq(\'track\', \'AddToCart\', { … });</code>', 'pys' ); ?></span>
202
  </td>
203
  </tr>
204
 
205
  <tr class="CustomEvent-visible tall">
206
+ <td class="legend"><p class="label"><?php _e( 'Event name:', 'pys' ); ?></p></td>
207
  <td>
208
+ <input type="text" name="std_event[custom_name]" value="<?php echo $event['custom_name']; ?>">
 
209
  </td>
210
  </tr>
211
 
212
+ <?php foreach ( $custom_params as $param => $value ) : ?>
213
 
214
+ <?php $param_id = uniqid() . $param; ?>
215
 
216
+ <tr class="class-<?php esc_attr_e( $param_id ); ?> ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
217
+ <td class="legend"><p class="label"><?php _e( 'Param name:', 'pys' ); ?></p></td>
218
+ <td>
219
+ <input type="text" name="std_event[custom_names][<?php esc_attr_e( $param ); ?>]"
220
+ value="<?php esc_attr_e( $param ); ?>">
221
+ </td>
222
  </tr>
223
 
224
+ <tr class="class-<?php esc_attr_e( $param_id ); ?> ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
225
+ <td class="legend"><p class="label"><?php _e( 'Param value:', 'pys' ); ?></p></td>
226
+ <td>
227
+ <input type="text" name="std_event[custom_values][<?php esc_attr_e( $param ); ?>]"
228
+ value="<?php esc_attr_e( $value ); ?>">
229
+ </td>
230
  </tr>
231
 
232
+ <tr class="class-<?php esc_attr_e( $param_id ); ?> tall ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
233
  <td></td>
234
+ <td><a href="#" class="remove-param"
235
+ data-id="<?php esc_attr_e( $param_id ); ?>">Remove param</a></td>
236
  </tr>
237
 
238
  <?php endforeach; ?>
242
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
243
  <td class="legend"></td>
244
  <td>
245
+ <a href="#"
246
+ class="button button-add-row button-primary action"><?php _e( 'Add Param', 'pys' ); ?></a>
247
  </td>
248
  </tr>
249
 
250
  </table>
251
 
252
  <div class="actions-row">
253
+ <a href="#" class="button button-close action"><?php _e( 'Cancel', 'pys' ); ?></a>
254
+ <a href="#"
255
+ class="button button-save button-primary action disabled"><?php echo isset( $_REQUEST['id'] ) == true ? __( 'Save', 'pys' ) : __( 'Add', 'pys' ); ?></a>
256
  </div>
257
 
258
  </form>
285
  });
286
 
287
  // Show/hide custom currency field
288
+ $('select#currency').on('change', function () {
289
 
290
+ if ($(this).val() == 'pys_custom_currency') {
291
  $(this).addClass('custom-currency');
292
  } else {
293
  $(this).removeClass('custom-currency');
305
  $('.button-save').on('click', function (e) {
306
  e.preventDefault();
307
 
308
+ if (validate() == false) {
309
  return;
310
  }
311
 
313
  $(this).text('Saving...');
314
 
315
  var data = $('#std-event-form').serialize();
316
+ data = data + '&action=pys_update_std_event';
317
 
318
  $.ajax({
319
+ url: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
320
  type: 'post',
321
  dataType: 'json',
322
  data: data
331
 
332
  });
333
 
334
+ var l10n_param_name = '<?php _e( 'Param name:', 'pys' ); ?>';
335
+ var l10n_param_value = '<?php _e( 'Param value:', 'pys' ); ?>';
336
+ var l10n_param_remove = '<?php _e( 'Remove param', 'pys' ); ?>';
337
+
338
  /* Add new param/value group */
339
  var marker = $('#marker');
340
+ $('.button-add-row').on('click', function (e) {
341
  e.preventDefault();
342
 
343
  var id = makeid();
344
 
345
+ var html = '<tr class="class-' + id + ' ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">';
346
+ html += '<td class="legend"><p class="label">' + l10n_param_name + '</p></td>';
347
+ html += '<td><input type="text" name="std_event[custom_names][' + id + ']" value=""></td>';
348
+ html += '</tr>';
349
 
350
+ html += '<tr class="class-' + id + ' ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">';
351
+ html += '<td class="legend"><p class="label">' + l10n_param_value + '</p></td>';
352
+ html += '<td><input type="text" name="std_event[custom_values][' + id + ']" value=""></td>';
353
+ html += '</tr>';
354
 
355
+ html += '<tr class="class-' + id + ' tall ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">';
356
+ html += '<td></td>';
357
+ html += '<td><a href="#" class="remove-param" data-id="' + id + '">' + l10n_param_remove + '</a></td>';
358
+ html += '</tr>';
359
 
360
 
361
  $(html).insertBefore(marker);
363
  });
364
 
365
  // Remove custom params row
366
+ $(document).on('click', '.remove-param', function (e) {
367
  e.preventDefault();
368
 
369
  var id = $(this).data('id');
370
+ $('tr.class-' + id).remove();
371
 
372
  });
373
 
374
  // Form validation
375
+ $('form').submit(function (e) {
376
 
377
+ if (validate() == false) {
378
  e.preventDefault();
379
  }
380
 
381
  });
382
 
383
+ $('#std-url').on('change, keyup', function (e) {
384
  validate();
385
  });
386
 
391
  btnSave = $('.button-save'),
392
  isValid = true;
393
 
394
+ if (eventType == null || pageURL.length == 0) {
395
  isValid = false;
396
  }
397
 
398
+ if (isValid) {
399
  btnSave.removeClass('disabled');
400
  } else {
401
  btnSave.addClass('disabled');
449
 
450
  $custom_name = $data['custom_name'];
451
  $custom_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $custom_name );
452
+ $custom_name = trim( $custom_name );
453
+ $custom_name = empty( $custom_name ) ? 'Untitled' : $custom_name;
454
 
455
  $data['eventtype'] = trim( $custom_name );
456
+ $data['custom_name'] = $custom_name;
457
 
458
  }
459
 
461
 
462
  foreach ( $data['custom_names'] as $key => $value ) {
463
 
464
+ $custom_param_name = $value;
465
+ $custom_param_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $custom_param_name );
466
 
467
+ ## skip untitled params
468
+ if ( empty( $custom_param_name ) ) {
469
+ continue;
470
+ }
471
+
472
+ $custom_param_value = $data['custom_values'][ $key ];
473
+
474
+ ## skip custom params without values
475
+ if ( empty( $custom_param_value ) && $custom_param_value != "0" ) {
476
+ continue;
477
+ }
478
+
479
+ $data[ $custom_param_name ] = $custom_param_value;
480
 
481
  }
482
 
496
  }
497
 
498
  if ( ! function_exists( 'pys_bulk_delete_std_events' ) ) {
499
+
500
  add_action( 'wp_ajax_pys_bulk_delete_std_events', 'pys_bulk_delete_std_events' );
501
  function pys_bulk_delete_std_events() {
502
+
503
  if ( false == current_user_can( 'manage_options' ) ) {
504
  return -1;
505
  }
506
+
507
  if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'pys_bulk_delete_std_events'
508
  || ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'pys_bulk_delete_std_events' )
509
  ) {
510
+
511
  return -1;
512
+
513
  }
514
 
515
+ if ( empty( $_POST['events_ids'] ) ) {
516
  return -1;
517
  }
518
 
522
  exit();
523
 
524
  }
525
+
526
  }
inc/common-edd.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ if ( ! function_exists( 'pys_get_edd_content_id' ) ) {
8
+
9
+ function pys_get_edd_content_id( $download_id ) {
10
+
11
+ if ( pys_get_option( 'edd', 'content_id' ) == 'sku' ) {
12
+
13
+ $sku = get_post_meta( $download_id, 'edd_sku', true );
14
+
15
+ return empty( $sku ) ? $download_id : '"' . $sku . '"';
16
+
17
+ } else {
18
+
19
+ return $download_id;
20
+
21
+ }
22
+
23
+ }
24
+
25
+ }
26
+
27
+ if ( ! function_exists( 'pys_output_edd_ajax_events_code' ) ) {
28
+
29
+ function pys_output_edd_ajax_events_code() {
30
+ global $pys_edd_ajax_events;
31
+
32
+ if ( empty( $pys_edd_ajax_events ) ) {
33
+ $pys_edd_ajax_events = array();
34
+ }
35
+
36
+ $events = array();
37
+
38
+ foreach ( $pys_edd_ajax_events as $id => $event ) {
39
+
40
+ $params = pys_clean_system_event_params( $event['params'] );
41
+
42
+ // sanitize params
43
+ $sanitized = array();
44
+ foreach ( $params as $name => $value ) {
45
+
46
+ if ( empty( $value ) ) {
47
+ continue;
48
+ }
49
+
50
+ $key = esc_js( $name );
51
+ $sanitized[ $key ] = $value;
52
+
53
+ }
54
+
55
+ $name = $event['name'];
56
+
57
+ $events[ $id ] = array(
58
+ 'type' => pys_is_standard_event( $name ) ? 'track' : 'trackCustom',
59
+ 'name' => $name,
60
+ 'params' => $sanitized
61
+ );
62
+
63
+ }
64
+
65
+ ?>
66
+
67
+ <script type="text/javascript">
68
+ /* <![CDATA[ */
69
+ var pys_edd_ajax_events = <?php echo json_encode( $events ); ?>;
70
+ /* ]]> */
71
+ </script>
72
+
73
+ <?php
74
+
75
+ }
76
+
77
+ }
inc/common.php CHANGED
@@ -3,6 +3,10 @@
3
  * Common functions for both versions.
4
  */
5
 
 
 
 
 
6
  if( !function_exists( 'dd' ) ) {
7
 
8
  function dd( $data ) {
@@ -42,11 +46,25 @@ if( !function_exists( 'pys_is_edd_active' ) ) {
42
 
43
  }
44
 
45
- /**
46
- * Return option value.
47
- */
 
 
 
 
 
48
  if( !function_exists( 'pys_get_option' ) ) {
49
 
 
 
 
 
 
 
 
 
 
50
  function pys_get_option( $section, $option, $default = '' ) {
51
 
52
  $options = get_option( 'pixel_your_site' );
@@ -57,25 +75,90 @@ if( !function_exists( 'pys_get_option' ) ) {
57
 
58
  }
59
 
60
- /**
61
- * Return checkbox state.
62
- */
63
  if( !function_exists( 'pys_checkbox_state' ) ) {
64
 
65
- function pys_checkbox_state( $section, $option, $default = '' ) {
 
 
 
 
 
 
 
66
 
67
  $options = get_option( 'pixel_your_site' );
68
 
69
  if ( isset( $options[ $section ][ $option ] ) ) {
70
- return $options[ $section ][ $option ] == 1 ? 'checked' : '';
 
 
 
 
 
 
71
  }
72
 
73
- return $default;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  }
76
 
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Return radio box state.
81
  */
@@ -108,28 +191,28 @@ if( !function_exists( 'pys_event_types_select_options' ) ) {
108
  function pys_event_types_select_options( $current = null, $full = true ) {
109
  ?>
110
 
111
- <option <?php echo selected( null, $current, true ); ?> disabled>Select Type</option>
112
- <option <?php echo selected( 'ViewContent', $current, true ); ?> value="ViewContent">ViewContent</option>
113
 
114
  <?php if ( $full ) : ?>
115
 
116
- <option <?php echo selected( 'Search', $current, true ); ?> value="Search">Search</option>
117
 
118
  <?php endif; ?>
119
 
120
- <option <?php echo selected( 'AddToCart', $current, true ); ?> value="AddToCart">AddToCart</option>
121
- <option <?php echo selected( 'AddToWishlist', $current, true ); ?> value="AddToWishlist">AddToWishlist</option>
122
- <option <?php echo selected( 'InitiateCheckout', $current, true ); ?> value="InitiateCheckout">InitiateCheckout</option>
123
- <option <?php echo selected( 'AddPaymentInfo', $current, true ); ?> value="AddPaymentInfo">AddPaymentInfo</option>
124
- <option <?php echo selected( 'Purchase', $current, true ); ?> value="Purchase">Purchase</option>
125
- <option <?php echo selected( 'Lead', $current, true ); ?> value="Lead">Lead</option>
126
- <option <?php echo selected( 'CompleteRegistration', $current, true ); ?> value="CompleteRegistration">CompleteRegistration</option>
127
 
128
  <?php if ( $full ) : ?>
129
 
130
  <option disabled></option>
131
- <option <?php echo selected( 'CustomEvent', $current, true ); ?> value="CustomEvent">Custom event</option>
132
- <option <?php echo selected( 'CustomCode', $current, true ); ?> value="CustomCode">Custom event code</option>
133
 
134
  <?php endif; ?>
135
 
@@ -293,7 +376,7 @@ if( !function_exists( 'pys_get_content_taxonomies' ) ) {
293
  $list = array();
294
 
295
  foreach( $terms as $term ) {
296
- $list[ $term->term_id ] = $term->name;
297
  }
298
 
299
  return implode( ', ', $list );
@@ -303,12 +386,13 @@ if( !function_exists( 'pys_get_content_taxonomies' ) ) {
303
  }
304
 
305
  if( !function_exists( 'pys_add_event' ) ) {
306
-
307
  /**
308
- * Add event with params to global events array *$pys_events*.
309
- * @param string $event Event name, eg. PageView
310
- * @param array $params Optional. Associated array of event parameters in 'param_name' => 'param_value' format.
311
- * @param int $delay Optional. If set, event will be fired with desired delay in seconds.
 
312
  */
313
  function pys_add_event( $event, $params = array(), $delay = 0 ) {
314
  global $pys_events;
@@ -317,10 +401,10 @@ if( !function_exists( 'pys_add_event' ) ) {
317
 
318
  $sanitized = array();
319
 
320
- // sanitize params
321
  foreach ( $params as $name => $value ) {
322
 
323
- if ( empty( $value ) ) {
324
  continue;
325
  }
326
 
@@ -340,17 +424,17 @@ if( !function_exists( 'pys_add_event' ) ) {
340
 
341
  }
342
 
343
- /**
344
- * Return product id or sku.
345
- */
346
- if( !function_exists( 'pys_get_product_content_id' ) ) {
347
 
 
 
 
348
  function pys_get_product_content_id( $product_id ) {
349
- global $wpdb;
350
 
351
  if ( pys_get_option( 'woo', 'content_id' ) == 'sku' ) {
352
-
353
- $sku = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_sku' AND post_id='%s' LIMIT 1", $product_id ) );
354
 
355
  return '"' . $sku . '"';
356
 
@@ -364,11 +448,11 @@ if( !function_exists( 'pys_get_product_content_id' ) ) {
364
 
365
  }
366
 
367
- /**
368
- * Return main or variation product id.
369
- */
370
- if( !function_exists( 'pys_get_product_id' ) ) {
371
 
 
 
 
372
  function pys_get_product_id( $product ) {
373
 
374
  $id = $product['product_id'];
@@ -382,26 +466,22 @@ if( !function_exists( 'pys_get_product_id' ) ) {
382
 
383
  }
384
 
385
- /**
386
- * Add attribute with value to a HTML tag.
387
- * @param $attr_name
388
- * @param $attr_value
389
- * @param $tag
390
- */
391
- if( !function_exists( 'pys_insert_attribute' ) ) {
392
 
393
  /**
394
- * @param $attr_name
395
- * @param $attr_value
396
- * @param $tag
397
- * @param bool|false $overwrite
398
- * @param string $tag_name by default function processing only A tags but it can be changed by setting $tag_name parameter. It is used in PayPal button event for example.
399
  *
400
- * @return string tag HTML with inserted attribute and its value
 
 
 
 
 
 
401
  */
402
  function pys_insert_attribute( $attr_name, $attr_value, $tag, $overwrite = false, $tag_name = 'a' ) {
403
 
404
- // do not modify js attributes
405
  if( $attr_name == 'on' ) {
406
  return $tag;
407
  }
@@ -454,7 +534,7 @@ if( !function_exists( 'pys_insert_attribute' ) ) {
454
 
455
  }
456
 
457
- if( !function_exists( 'pys_is_disabled_for_role' ) ) {
458
 
459
  function pys_is_disabled_for_role() {
460
 
@@ -486,11 +566,11 @@ if( !function_exists( 'pys_is_disabled_for_role' ) ) {
486
 
487
  }
488
 
489
- /**
490
- * Output "disabled for role" and version number message to document head.
491
- */
492
  if( ! function_exists( 'pys_head_message' ) ) {
493
 
 
 
 
494
  function pys_head_message() {
495
  echo "<!-- Facebook Pixel Code disabled for current role ( " . pys_get_version() . " ) -->\r\n";
496
  }
@@ -504,7 +584,7 @@ if( ! function_exists( 'pys_get_version' ) ) {
504
  if( defined('PYS_PRO_VERSION') ) {
505
  $version = "PixelYourSite PRO v".PYS_PRO_VERSION;
506
  } elseif( defined('PYS_FREE_VERSION') ) {
507
- $version = "PixelYourSite FREE v".PYS_FREE_VERSION_REAL;
508
  } else {
509
  $version = null;
510
  }
@@ -544,6 +624,7 @@ if( ! function_exists( 'pys_general_event' ) ) {
544
  $on_pages_enables = pys_get_option( 'general', 'general_event_on_pages_enabled' );
545
  $on_taxonomies_enabled = pys_get_option( 'general', 'general_event_on_tax_enabled' );
546
  $on_cpt_enabled = pys_get_option( 'general', 'general_event_on_' . $post_type . '_enabled' );
 
547
  $on_edd_enabled = pys_get_option( 'general', 'general_event_on_edd_enabled' );
548
  $track_tags_enabled = pys_get_option( 'general', 'general_event_add_tags', false );
549
 
@@ -670,23 +751,18 @@ if( ! function_exists( 'pys_general_event' ) ) {
670
 
671
  }
672
 
673
- // Easy Digital Downloads
674
- if ( $on_edd_enabled && pys_is_edd_active() && $post_type == 'download' ) {
675
-
676
- $download = new EDD_Download( $post->ID );
677
 
678
- $params['post_type'] = 'download';
679
- $params['content_name'] = $download->post_title;
680
- $params['post_id'] = $post->ID;
681
- $params['value'] = $download->get_price();
682
- $params['currency'] = edd_get_currency();
683
 
684
- if ( $terms = pys_get_content_taxonomies( 'download_category' ) ) {
685
- $params['content_category'] = $terms;
686
- }
687
 
688
- pys_add_event( $event_name, $params, $delay );
 
689
 
 
690
  return;
691
 
692
  }
@@ -786,6 +862,10 @@ if( ! function_exists( 'pys_output_noscript_code' ) ) {
786
 
787
  $args = array();
788
 
 
 
 
 
789
  $args['id'] = pys_get_option( 'general', 'pixel_id' );
790
  $args['ev'] = $event['name'];
791
  $args['noscript'] = 1;
@@ -796,7 +876,10 @@ if( ! function_exists( 'pys_output_noscript_code' ) ) {
796
 
797
  $src_attr = add_query_arg( $args, 'https://www.facebook.com/tr' );
798
 
799
- echo "<noscript><img height='1' width='1' style='display:none' src='" . $src_attr . "'></noscript>\n\r";
 
 
 
800
 
801
  }
802
 
@@ -928,6 +1011,7 @@ if( !function_exists( 'pys_get_default_options' ) ) {
928
  $options['general']['general_event_on_posts_enabled'] = 1;
929
  $options['general']['general_event_on_pages_enabled'] = 1;
930
  $options['general']['general_event_on_tax_enabled'] = 1;
 
931
  $options['general']['general_event_on_edd_enabled'] = 0;
932
  $options['general']['general_event_add_tags'] = 0;
933
 
@@ -971,6 +1055,7 @@ if( !function_exists( 'pys_get_default_options' ) ) {
971
 
972
  $options['woo']['on_thank_you_page'] = 1;
973
  $options['woo']['enable_purchase_value'] = 1;
 
974
  $options['woo']['purchase_transport'] = 'included';
975
  $options['woo']['purchase_value_option'] = 'total';
976
  $options['woo']['purchase_percent_value'] = '';
@@ -994,6 +1079,47 @@ if( !function_exists( 'pys_get_default_options' ) ) {
994
  $options['woo']['pp_custom_value'] = '';
995
  $options['woo']['pp_value_option'] = 'none';
996
  $options['woo']['pp_global_value'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
 
998
  return $options;
999
 
@@ -1209,7 +1335,7 @@ if( ! function_exists( 'pys_head_comments' ) ) {
1209
  if( defined( 'PYS_PRO_VERSION' ) ) {
1210
  $version = "PRO v" . PYS_PRO_VERSION;
1211
  } elseif( defined( 'PYS_FREE_VERSION' ) ) {
1212
- $version = "FREE v" . PYS_FREE_VERSION_REAL;
1213
  } else {
1214
  $version = null;
1215
  }
@@ -1237,7 +1363,7 @@ if( ! function_exists( 'pys_render_event_code' ) ) {
1237
  $event_params = '';
1238
  foreach( $params as $name => $value ) {
1239
 
1240
- if( empty( $value ) ) {
1241
  continue;
1242
  }
1243
 
@@ -1266,28 +1392,82 @@ if( !function_exists( 'pys_add_domain_param' ) ) {
1266
 
1267
  }
1268
 
1269
- if( ! function_exists( 'pys_delete_events' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1270
 
1271
  function pys_delete_events( $events_ids, $events_type ) {
1272
-
1273
- if( $events_type == 'standard' ) {
1274
  $option_name = 'pixel_your_site_std_events';
1275
  } else {
1276
- $option_name = 'pixel_your_site_dyn_events';
1277
  }
1278
-
1279
  $events = (array) get_option( $option_name );
1280
-
1281
  if ( empty( $events ) ) {
1282
  return;
1283
  }
1284
-
1285
  foreach ( $events_ids as $id ) {
1286
  unset( $events[ $id ] );
1287
  }
1288
-
1289
  update_option( $option_name, $events );
1290
-
1291
  }
1292
 
1293
  }
3
  * Common functions for both versions.
4
  */
5
 
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly.
8
+ }
9
+
10
  if( !function_exists( 'dd' ) ) {
11
 
12
  function dd( $data ) {
46
 
47
  }
48
 
49
+ if ( ! function_exists( 'pys_is_pcf_pro_active' ) ) {
50
+
51
+ function pys_is_pcf_pro_active() {
52
+ return class_exists( 'wpwoof_product_catalog' ) == true ? true : false;
53
+ }
54
+
55
+ }
56
+
57
  if( !function_exists( 'pys_get_option' ) ) {
58
 
59
+ /**
60
+ * Return option value.
61
+ *
62
+ * @param string $section Options section, eg. 'general', 'woo', etc.
63
+ * @param string $option Option name
64
+ * @param mixed|string $default Default option value
65
+ *
66
+ * @return mixed Option or default option value
67
+ */
68
  function pys_get_option( $section, $option, $default = '' ) {
69
 
70
  $options = get_option( 'pixel_your_site' );
75
 
76
  }
77
 
 
 
 
78
  if( !function_exists( 'pys_checkbox_state' ) ) {
79
 
80
+ /**
81
+ * @param string $section Option section name
82
+ * @param string $option Option name
83
+ * @param bool $echo Echo or return value
84
+ *
85
+ * @return string
86
+ */
87
+ function pys_checkbox_state( $section, $option, $echo = true ) {
88
 
89
  $options = get_option( 'pixel_your_site' );
90
 
91
  if ( isset( $options[ $section ][ $option ] ) ) {
92
+ $value = $options[ $section ][ $option ] == 1 ? 'checked' : '';
93
+ } else {
94
+ $value = '';
95
+ }
96
+
97
+ if( $echo ) {
98
+ echo $value;
99
  }
100
 
101
+ return $value;
102
+
103
+ }
104
+
105
+ }
106
+
107
+ if ( ! function_exists( 'pys_checkbox' ) ) {
108
+
109
+ /**
110
+ * Echos checkbox input.
111
+ *
112
+ * @param string $section Input section name
113
+ * @param string $option Input option name
114
+ * @param string $classes Class names (optional)
115
+ */
116
+ function pys_checkbox( $section, $option, $classes = '' ) {
117
+
118
+ $state = pys_checkbox_state( $section, $option, false );
119
+ echo "<input type='checkbox' value='1' name='pys[$section][$option]' class='$classes' $state>";
120
+
121
+ }
122
+
123
+ }
124
+
125
+ if ( ! function_exists( 'pys_text_field' ) ) {
126
+
127
+ /**
128
+ * Echos text input.
129
+ *
130
+ * @param string $section Input section name
131
+ * @param string $option Input option name
132
+ */
133
+ function pys_text_field( $section, $option ) {
134
+
135
+ $value = pys_get_option( $section, $option );
136
+ $value = esc_attr( $value );
137
+
138
+ echo "<input type='text' value='$value' name='pys[$section][$option]'>";
139
 
140
  }
141
 
142
  }
143
 
144
+ if ( ! function_exists( 'pys_radio_box' ) ) {
145
+
146
+ /**
147
+ * Echos radio box input.
148
+ *
149
+ * @param string $section Input section name
150
+ * @param string $option Input option name
151
+ * @param string $value Option value
152
+ */
153
+ function pys_radio_box( $section, $option, $value ) {
154
+
155
+ $state = pys_radio_state( $section, $option, $value );
156
+ echo "<input type='radio' value='$value' name='pys[$section][$option]' $state>";
157
+
158
+ }
159
+
160
+ }
161
+
162
  /**
163
  * Return radio box state.
164
  */
191
  function pys_event_types_select_options( $current = null, $full = true ) {
192
  ?>
193
 
194
+ <option <?php selected( null, $current ); ?> disabled>Select Type</option>
195
+ <option <?php selected( 'ViewContent', $current ); ?> value="ViewContent">ViewContent</option>
196
 
197
  <?php if ( $full ) : ?>
198
 
199
+ <option <?php selected( 'Search', $current ); ?> value="Search">Search</option>
200
 
201
  <?php endif; ?>
202
 
203
+ <option <?php selected( 'AddToCart', $current ); ?> value="AddToCart">AddToCart</option>
204
+ <option <?php selected( 'AddToWishlist', $current ); ?> value="AddToWishlist">AddToWishlist</option>
205
+ <option <?php selected( 'InitiateCheckout', $current ); ?> value="InitiateCheckout">InitiateCheckout</option>
206
+ <option <?php selected( 'AddPaymentInfo', $current ); ?> value="AddPaymentInfo">AddPaymentInfo</option>
207
+ <option <?php selected( 'Purchase', $current ); ?> value="Purchase">Purchase</option>
208
+ <option <?php selected( 'Lead', $current ); ?> value="Lead">Lead</option>
209
+ <option <?php selected( 'CompleteRegistration', $current ); ?> value="CompleteRegistration">CompleteRegistration</option>
210
 
211
  <?php if ( $full ) : ?>
212
 
213
  <option disabled></option>
214
+ <option <?php selected( 'CustomEvent', $current ); ?> value="CustomEvent">Custom event</option>
215
+ <option <?php selected( 'CustomCode', $current); ?> value="CustomCode">Custom event code</option>
216
 
217
  <?php endif; ?>
218
 
376
  $list = array();
377
 
378
  foreach( $terms as $term ) {
379
+ $list[ $term->term_id ] = html_entity_decode( $term->name );
380
  }
381
 
382
  return implode( ', ', $list );
386
  }
387
 
388
  if( !function_exists( 'pys_add_event' ) ) {
389
+
390
  /**
391
+ * Add event with params to global events list.
392
+ *
393
+ * @param string $event Event name, eg. "PageView"
394
+ * @param array $params Optional. Associated array of event parameters in 'param_name' => 'param_value' format.
395
+ * @param int $delay Optional. If set, event will be fired with desired delay in seconds.
396
  */
397
  function pys_add_event( $event, $params = array(), $delay = 0 ) {
398
  global $pys_events;
401
 
402
  $sanitized = array();
403
 
404
+ // sanitize param names and its values
405
  foreach ( $params as $name => $value ) {
406
 
407
+ if ( empty( $value ) && $value !== "0" ) {
408
  continue;
409
  }
410
 
424
 
425
  }
426
 
427
+ if ( ! function_exists( 'pys_get_product_content_id' ) ) {
 
 
 
428
 
429
+ /**
430
+ * Return product id or sku.
431
+ */
432
  function pys_get_product_content_id( $product_id ) {
433
+ // global $wpdb;
434
 
435
  if ( pys_get_option( 'woo', 'content_id' ) == 'sku' ) {
436
+
437
+ $sku = get_post_meta( $product_id, '_sku', true );
438
 
439
  return '"' . $sku . '"';
440
 
448
 
449
  }
450
 
451
+ if ( ! function_exists( 'pys_get_product_id' ) ) {
 
 
 
452
 
453
+ /**
454
+ * Return main or variation product id.
455
+ */
456
  function pys_get_product_id( $product ) {
457
 
458
  $id = $product['product_id'];
466
 
467
  }
468
 
469
+ if ( ! function_exists( 'pys_insert_attribute' ) ) {
 
 
 
 
 
 
470
 
471
  /**
472
+ * Add attribute with value to a HTML tag.
 
 
 
 
473
  *
474
+ * @param string $attr_name Attribute name. Eg. "class"
475
+ * @param string $attr_value Attribute value
476
+ * @param string $tag HTML content where attribute should be inserted
477
+ * @param bool $overwrite Should function override existing value of attribute or append it?
478
+ * @param string $tag_name Selector name. Eg. "button". Default "a"
479
+ *
480
+ * @return string Modified HTML content
481
  */
482
  function pys_insert_attribute( $attr_name, $attr_value, $tag, $overwrite = false, $tag_name = 'a' ) {
483
 
484
+ ## do not modify js attributes
485
  if( $attr_name == 'on' ) {
486
  return $tag;
487
  }
534
 
535
  }
536
 
537
+ if ( ! function_exists( 'pys_is_disabled_for_role' ) ) {
538
 
539
  function pys_is_disabled_for_role() {
540
 
566
 
567
  }
568
 
 
 
 
569
  if( ! function_exists( 'pys_head_message' ) ) {
570
 
571
+ /**
572
+ * Output "disabled for role" and version number message to document head.
573
+ */
574
  function pys_head_message() {
575
  echo "<!-- Facebook Pixel Code disabled for current role ( " . pys_get_version() . " ) -->\r\n";
576
  }
584
  if( defined('PYS_PRO_VERSION') ) {
585
  $version = "PixelYourSite PRO v".PYS_PRO_VERSION;
586
  } elseif( defined('PYS_FREE_VERSION') ) {
587
+ $version = "PixelYourSite FREE v".PYS_FREE_VERSION;
588
  } else {
589
  $version = null;
590
  }
624
  $on_pages_enables = pys_get_option( 'general', 'general_event_on_pages_enabled' );
625
  $on_taxonomies_enabled = pys_get_option( 'general', 'general_event_on_tax_enabled' );
626
  $on_cpt_enabled = pys_get_option( 'general', 'general_event_on_' . $post_type . '_enabled' );
627
+ $on_woo_enabled = pys_get_option( 'general', 'general_event_on_woo_enabled' );
628
  $on_edd_enabled = pys_get_option( 'general', 'general_event_on_edd_enabled' );
629
  $track_tags_enabled = pys_get_option( 'general', 'general_event_add_tags', false );
630
 
751
 
752
  }
753
 
754
+ ## WooCommerce Products
755
+ if ( $on_woo_enabled && pys_is_woocommerce_active() && $post_type == 'product' ) {
 
 
756
 
757
+ pys_general_woo_event( $post, $track_tags_enabled, $delay, $event_name );
758
+ return;
 
 
 
759
 
760
+ }
 
 
761
 
762
+ ## Easy Digital Downloads
763
+ if ( $on_edd_enabled && pys_is_edd_active() && $post_type == 'download' ) {
764
 
765
+ pys_general_edd_event( $post, $track_tags_enabled, $delay, $event_name );
766
  return;
767
 
768
  }
862
 
863
  $args = array();
864
 
865
+ if( $event['type'] == 'init' ) {
866
+ continue;
867
+ }
868
+
869
  $args['id'] = pys_get_option( 'general', 'pixel_id' );
870
  $args['ev'] = $event['name'];
871
  $args['noscript'] = 1;
876
 
877
  $src_attr = add_query_arg( $args, 'https://www.facebook.com/tr' );
878
 
879
+ // note: ALT tag used to pass ADA compliance
880
+ // @see: issue #63 for details
881
+
882
+ echo "<noscript><img height='1' width='1' style='display: none;' src='{$src_attr}' alt='facebook_pixel'></noscript>";
883
 
884
  }
885
 
1011
  $options['general']['general_event_on_posts_enabled'] = 1;
1012
  $options['general']['general_event_on_pages_enabled'] = 1;
1013
  $options['general']['general_event_on_tax_enabled'] = 1;
1014
+ $options['general']['general_event_on_woo_enabled'] = 0;
1015
  $options['general']['general_event_on_edd_enabled'] = 0;
1016
  $options['general']['general_event_add_tags'] = 0;
1017
 
1055
 
1056
  $options['woo']['on_thank_you_page'] = 1;
1057
  $options['woo']['enable_purchase_value'] = 1;
1058
+ $options['woo']['purchase_fire_once'] = 1;
1059
  $options['woo']['purchase_transport'] = 'included';
1060
  $options['woo']['purchase_value_option'] = 'total';
1061
  $options['woo']['purchase_percent_value'] = '';
1079
  $options['woo']['pp_custom_value'] = '';
1080
  $options['woo']['pp_value_option'] = 'none';
1081
  $options['woo']['pp_global_value'] = '';
1082
+
1083
+ /**
1084
+ * Easy Digital Downloads
1085
+ */
1086
+
1087
+ $options['edd']['enabled'] = pys_is_edd_active() ? 1 : 0;
1088
+
1089
+ $options['edd']['content_id'] = 'id';
1090
+ $options['edd']['enable_additional_params'] = 1;
1091
+ $options['edd']['enable_tags'] = 1;
1092
+ $options['edd']['tax'] = 'incl';
1093
+
1094
+ $options['edd']['on_view_content'] = 1;
1095
+ $options['edd']['on_view_content_delay'] = null;
1096
+ $options['edd']['enable_view_content_value'] = 1;
1097
+ $options['edd']['view_content_value_option'] = 'price';
1098
+ $options['edd']['view_content_percent_value'] = null;
1099
+ $options['edd']['view_content_global_value'] = null;
1100
+
1101
+ $options['edd']['on_add_to_cart_btn'] = 1;
1102
+ $options['edd']['enable_add_to_cart_value'] = 1;
1103
+ $options['edd']['add_to_cart_value_option'] = 'price';
1104
+ $options['edd']['add_to_cart_percent_value'] = null;
1105
+ $options['edd']['add_to_cart_global_value'] = null;
1106
+
1107
+ $options['edd']['on_checkout_page'] = 1;
1108
+ $options['edd']['enable_checkout_value'] = 1;
1109
+ $options['edd']['checkout_value_option'] = 'price';
1110
+ $options['edd']['checkout_percent_value'] = null;
1111
+ $options['edd']['checkout_global_value'] = null;
1112
+
1113
+ $options['edd']['on_success_page'] = 1;
1114
+ $options['edd']['enable_purchase_value'] = 1;
1115
+ $options['edd']['purchase_fire_once'] = 1;
1116
+ $options['edd']['purchase_value_option'] = 'total';
1117
+ $options['edd']['purchase_percent_value'] = null;
1118
+ $options['edd']['purchase_global_value'] = null;
1119
+
1120
+ $options['edd']['purchase_add_address'] = true;
1121
+ $options['edd']['purchase_add_payment_method'] = true;
1122
+ $options['edd']['purchase_add_coupons'] = true;
1123
 
1124
  return $options;
1125
 
1335
  if( defined( 'PYS_PRO_VERSION' ) ) {
1336
  $version = "PRO v" . PYS_PRO_VERSION;
1337
  } elseif( defined( 'PYS_FREE_VERSION' ) ) {
1338
+ $version = "FREE v" . PYS_FREE_VERSION;
1339
  } else {
1340
  $version = null;
1341
  }
1363
  $event_params = '';
1364
  foreach( $params as $name => $value ) {
1365
 
1366
+ if( empty( $value ) && $value !== "0" ) {
1367
  continue;
1368
  }
1369
 
1392
 
1393
  }
1394
 
1395
+ if ( ! function_exists( 'pys_get_additional_post_params' ) ) {
1396
+
1397
+ function pys_get_additional_post_params( $post, &$params, $taxonomy ) {
1398
+
1399
+ // get WP_Post object
1400
+ if ( is_numeric( $post ) ) {
1401
+ $id = absint( $post );
1402
+ $_post = get_post( $id );
1403
+ } elseif ( $post instanceof WC_Product ) {
1404
+ $_post = $post->post;
1405
+ } elseif ( isset( $post->ID ) ) {
1406
+ $_post = $post;
1407
+ } else {
1408
+ return;
1409
+ }
1410
+
1411
+ $params['content_name'] = $_post->post_title;
1412
+
1413
+ $terms = pys_get_content_taxonomies( $taxonomy, $_post->ID );
1414
+ if ( $terms ) {
1415
+ $params['category_name'] = $terms;
1416
+ }
1417
+
1418
+ }
1419
+
1420
+ }
1421
+
1422
+ if ( ! function_exists( 'pys_get_object_tags' ) ) {
1423
+
1424
+ /**
1425
+ * @param int|WP_Post $post Post ID or object
1426
+ * @param string $taxonomy Taxonomy name
1427
+ *
1428
+ * @return array Array of terms titles on success or empty array
1429
+ */
1430
+ function pys_get_object_tags( $post, $taxonomy ) {
1431
+
1432
+ $tags = array();
1433
+ $terms = get_the_terms( $post, $taxonomy );
1434
+
1435
+ if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
1436
+
1437
+ foreach ( $terms as $term ) {
1438
+ $tags[] = html_entity_decode( $term->name );
1439
+ }
1440
+
1441
+ }
1442
+
1443
+ return $tags;
1444
+
1445
+ }
1446
+
1447
+ }
1448
+
1449
+ if ( ! function_exists( 'pys_delete_events' ) ) {
1450
 
1451
  function pys_delete_events( $events_ids, $events_type ) {
1452
+
1453
+ if ( $events_type == 'standard' ) {
1454
  $option_name = 'pixel_your_site_std_events';
1455
  } else {
1456
+ $option_name = 'pixel_your_site_dyn_events';
1457
  }
1458
+
1459
  $events = (array) get_option( $option_name );
1460
+
1461
  if ( empty( $events ) ) {
1462
  return;
1463
  }
1464
+
1465
  foreach ( $events_ids as $id ) {
1466
  unset( $events[ $id ] );
1467
  }
1468
+
1469
  update_option( $option_name, $events );
1470
+
1471
  }
1472
 
1473
  }
inc/core-edd.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ if ( ! function_exists( 'pys_edd_events' ) ) {
8
+
9
+ function pys_edd_events() {
10
+
11
+ if ( pys_get_option( 'edd', 'enabled' ) == false || pys_is_edd_active() == false ) {
12
+ return;
13
+ }
14
+
15
+ global $post;
16
+
17
+ // set defaults params
18
+ $params = array();
19
+ $params['content_type'] = 'product';
20
+
21
+ // ViewContent Event
22
+ if ( pys_get_option( 'edd', 'on_view_content' ) && is_singular( array( 'download' ) ) ) {
23
+
24
+ $params['content_ids'] = '[' . pys_get_edd_content_id( $post->ID ) . ']';
25
+
26
+ // currency, value
27
+ if ( pys_get_option( 'edd', 'enable_view_content_value' ) ) {
28
+
29
+ $params['value'] = pys_get_option( 'edd', 'view_content_global_value' );
30
+ $params['currency'] = edd_get_currency();
31
+
32
+ }
33
+
34
+ pys_add_event( 'ViewContent', $params, 0 );
35
+
36
+ return;
37
+
38
+ }
39
+
40
+ /**
41
+ * AddToCart Event (button)
42
+ *
43
+ * @see pys_edd_purchase_link_args()
44
+ */
45
+
46
+ // InitiateCheckout Event
47
+ if ( pys_get_option( 'edd', 'on_checkout_page' ) && edd_is_checkout() ) {
48
+
49
+ $ids = array();
50
+
51
+ foreach ( edd_get_cart_contents() as $cart_item ) {
52
+
53
+ $download_id = intval( $cart_item['id'] );
54
+ $ids[] = pys_get_edd_content_id( $download_id );
55
+
56
+ }
57
+
58
+ $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
59
+
60
+ // currency, value
61
+ if ( pys_get_option( 'edd', 'enable_checkout_value' ) ) {
62
+
63
+ $params['value'] = pys_get_option( 'edd', 'checkout_global_value' );
64
+ $params['currency'] = edd_get_currency();
65
+
66
+ }
67
+
68
+ pys_add_event( 'InitiateCheckout', $params );
69
+
70
+ return;
71
+
72
+ }
73
+
74
+ // Purchase Event
75
+ if ( pys_get_option( 'edd', 'on_success_page' ) && edd_is_success_page() ) {
76
+
77
+ ## skip payment confirmation page
78
+ if( isset( $_GET['payment-confirmation'] ) ) {
79
+ return;
80
+ }
81
+
82
+ global $edd_receipt_args;
83
+
84
+ $session = edd_get_purchase_session();
85
+ if ( isset( $_GET['payment_key'] ) ) {
86
+ $payment_key = urldecode( $_GET['payment_key'] );
87
+ } else if ( $session ) {
88
+ $payment_key = $session['purchase_key'];
89
+ } elseif ( $edd_receipt_args['payment_key'] ) {
90
+ $payment_key = $edd_receipt_args['payment_key'];
91
+ }
92
+
93
+ if ( ! isset( $payment_key ) ) {
94
+ return;
95
+ }
96
+
97
+ $payment_id = edd_get_purchase_id_by_key( $payment_key );
98
+ $user_can_view = edd_can_view_receipt( $payment_key );
99
+
100
+ if ( ! $user_can_view && ! empty( $payment_key ) && ! is_user_logged_in() && ! edd_is_guest_payment( $payment_id ) ) {
101
+ return;
102
+ }
103
+
104
+ $cart = edd_get_payment_meta_cart_details( $payment_id, true );
105
+ $status = edd_get_payment_status( $payment_id, true );
106
+
107
+ ## pending payment status used because we can't fire event on IPN
108
+ if( strtolower( $status ) != 'complete' && strtolower( $status ) != 'pending' ) {
109
+ return;
110
+ }
111
+
112
+ $ids = array();
113
+
114
+ foreach ( $cart as $cart_item ) {
115
+
116
+ $download_id = intval( $cart_item['id'] );
117
+ $ids[] = pys_get_edd_content_id( $download_id );
118
+
119
+ }
120
+
121
+ $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
122
+
123
+ // currency, value
124
+ if ( pys_get_option( 'edd', 'enable_purchase_value' ) ) {
125
+
126
+ $params['value'] = pys_get_option( 'edd', 'purchase_global_value' );
127
+ $params['currency'] = edd_get_currency();
128
+
129
+ }
130
+
131
+ pys_add_event( 'Purchase', $params );
132
+
133
+ return;
134
+
135
+ }
136
+
137
+ }
138
+
139
+ }
140
+
141
+ if ( ! function_exists( 'pys_edd_purchase_link_args' ) ) {
142
+
143
+ function pys_edd_purchase_link_args( $args = array() ) {
144
+ global $pys_edd_ajax_events;
145
+
146
+ $download_id = $args['download_id'];
147
+ $event_id = uniqid();
148
+
149
+ $params = array();
150
+ $params['content_type'] = 'product';
151
+ $params['content_ids'] = '[' . pys_get_edd_content_id( $download_id ) . ']';
152
+
153
+ // currency, value
154
+ if ( pys_get_option( 'edd', 'enable_add_to_cart_value' ) ) {
155
+
156
+ $params['value'] = pys_get_option( 'edd', 'add_to_cart_global_value' );
157
+ $params['currency'] = edd_get_currency();
158
+
159
+ }
160
+
161
+ $pys_edd_ajax_events[ $event_id ] = array(
162
+ 'name' => 'AddToCart',
163
+ 'params' => $params
164
+ );
165
+
166
+ $classes = isset( $args['class'] ) ? $args['class'] : null;
167
+ $args['class'] = $classes . " pys-event-id-{$event_id}";
168
+
169
+ return $args;
170
+
171
+ }
172
+
173
+ }
inc/core.php CHANGED
@@ -1,7 +1,8 @@
1
  <?php
2
- /**
3
- * Free version related functions.
4
- */
 
5
 
6
  if( !function_exists( 'pys_get_woo_ajax_addtocart_params' ) ) {
7
 
@@ -11,6 +12,14 @@ if( !function_exists( 'pys_get_woo_ajax_addtocart_params' ) ) {
11
  $params['content_type'] = 'product';
12
  $params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
13
 
 
 
 
 
 
 
 
 
14
  return $params;
15
 
16
  }
@@ -49,6 +58,14 @@ if( !function_exists( 'pys_get_woo_code' ) ) {
49
 
50
  $params['content_ids'] = '[' . pys_get_product_content_id( $post->ID ) . ']';
51
 
 
 
 
 
 
 
 
 
52
  pys_add_event( 'ViewContent', $params );
53
 
54
  return;
@@ -70,6 +87,14 @@ if( !function_exists( 'pys_get_woo_code' ) ) {
70
 
71
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
72
 
 
 
 
 
 
 
 
 
73
  pys_add_event( 'AddToCart', $params );
74
 
75
  return;
@@ -81,6 +106,14 @@ if( !function_exists( 'pys_get_woo_code' ) ) {
81
 
82
  $params = pys_get_woo_checkout_params( false );
83
 
 
 
 
 
 
 
 
 
84
  pys_add_event( 'InitiateCheckout', $params );
85
 
86
  return;
@@ -106,6 +139,14 @@ if( !function_exists( 'pys_get_woo_code' ) ) {
106
 
107
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
108
 
 
 
 
 
 
 
 
 
109
  pys_add_event( 'Purchase', $params );
110
 
111
  return;
@@ -134,6 +175,14 @@ if( !function_exists( 'pys_add_code_to_woo_cart_link' ) ) {
134
  $params = array();
135
  $params['content_type'] = 'product';
136
  $params['content_ids'] = '[' . pys_get_product_content_id( $product->post->ID ) . ']';
 
 
 
 
 
 
 
 
137
 
138
  if ( $product->product_type == 'simple' && pys_get_option( 'woo', 'on_add_to_cart_btn' ) ) {
139
 
@@ -193,4 +242,36 @@ if( !function_exists( 'pys_get_additional_woo_params' ) ) {
193
 
194
  }
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
1
  <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
 
7
  if( !function_exists( 'pys_get_woo_ajax_addtocart_params' ) ) {
8
 
12
  $params['content_type'] = 'product';
13
  $params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
14
 
15
+ // currency, value
16
+ if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
17
+
18
+ $params['value'] = pys_get_option( 'woo', 'add_to_cart_global_value' );
19
+ $params['currency'] = get_woocommerce_currency();
20
+
21
+ }
22
+
23
  return $params;
24
 
25
  }
58
 
59
  $params['content_ids'] = '[' . pys_get_product_content_id( $post->ID ) . ']';
60
 
61
+ // currency, value
62
+ if ( pys_get_option( 'woo', 'enable_view_content_value' ) ) {
63
+
64
+ $params['value'] = pys_get_option( 'woo', 'view_content_global_value' );
65
+ $params['currency'] = get_woocommerce_currency();
66
+
67
+ }
68
+
69
  pys_add_event( 'ViewContent', $params );
70
 
71
  return;
87
 
88
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
89
 
90
+ // currency, value
91
+ if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
92
+
93
+ $params['value'] = pys_get_option( 'woo', 'add_to_cart_global_value' );
94
+ $params['currency'] = get_woocommerce_currency();
95
+
96
+ }
97
+
98
  pys_add_event( 'AddToCart', $params );
99
 
100
  return;
106
 
107
  $params = pys_get_woo_checkout_params( false );
108
 
109
+ // currency, value
110
+ if ( pys_get_option( 'woo', 'enable_checkout_value' ) ) {
111
+
112
+ $params['value'] = pys_get_option( 'woo', 'checkout_global_value' );
113
+ $params['currency'] = get_woocommerce_currency();
114
+
115
+ }
116
+
117
  pys_add_event( 'InitiateCheckout', $params );
118
 
119
  return;
139
 
140
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
141
 
142
+ // currency, value
143
+ if ( pys_get_option( 'woo', 'enable_purchase_value' ) ) {
144
+
145
+ $params['value'] = pys_get_option( 'woo', 'purchase_global_value' );
146
+ $params['currency'] = get_woocommerce_currency();
147
+
148
+ }
149
+
150
  pys_add_event( 'Purchase', $params );
151
 
152
  return;
175
  $params = array();
176
  $params['content_type'] = 'product';
177
  $params['content_ids'] = '[' . pys_get_product_content_id( $product->post->ID ) . ']';
178
+
179
+ // currency, value
180
+ if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
181
+
182
+ $params['value'] = pys_get_option( 'woo', 'add_to_cart_global_value' );
183
+ $params['currency'] = get_woocommerce_currency();
184
+
185
+ }
186
 
187
  if ( $product->product_type == 'simple' && pys_get_option( 'woo', 'on_add_to_cart_btn' ) ) {
188
 
242
 
243
  }
244
 
245
+ }
246
+
247
+ if ( ! function_exists( 'pys_general_woo_event' ) ) {
248
+
249
+ /**
250
+ * Add General event on Woo Product page. PRO only.
251
+ *
252
+ * @param $post WP_Post|int
253
+ * @param $track_tags bool
254
+ * @param $delay int
255
+ * @param $event_name string
256
+ */
257
+ function pys_general_woo_event( $post, $track_tags, $delay, $event_name ) {
258
+ // PRO feature
259
+ }
260
+
261
+ }
262
+
263
+ if ( ! function_exists( 'pys_general_edd_event' ) ) {
264
+
265
+ /**
266
+ * Add General event on EDD Download page. PRO only.
267
+ *
268
+ * @param $post WP_Post|int
269
+ * @param $track_tags bool
270
+ * @param $delay int
271
+ * @param $event_name string
272
+ */
273
+ function pys_general_edd_event( $post, $track_tags, $delay, $event_name ) {
274
+ // PRO feature
275
+ }
276
+
277
  }
inc/html-admin.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
 
 
 
 
 
3
  // set active tab
4
  $pys_active_tab = 'general';
5
  if( isset( $_REQUEST['active_tab'] ) ) {
@@ -21,6 +25,7 @@ $std_events = get_option( 'pixel_your_site_std_events' );
21
  <li id="pys-menu-posts-events" class="nav-tab <?php echo $pys_active_tab == 'posts-events' ? 'nav-tab-active selected' : null; ?>">Events</li>
22
  <li id="pys-menu-dynamic-events" class="nav-tab <?php echo $pys_active_tab == 'dynamic-events' ? 'nav-tab-active selected' : null; ?>">Dynamic Events</li>
23
  <li id="pys-menu-woo" class="nav-tab <?php echo $pys_active_tab == 'woo' ? 'nav-tab-active selected' : null; ?>">WooCommerce Setup</li>
 
24
  </ul>
25
 
26
  <div class="pys-content">
@@ -83,6 +88,27 @@ $std_events = get_option( 'pixel_your_site_std_events' );
83
 
84
  </div><!-- #pys-panel-woo -->
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  </form>
87
  </div><!-- .pys-content -->
88
 
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
  // set active tab
8
  $pys_active_tab = 'general';
9
  if( isset( $_REQUEST['active_tab'] ) ) {
25
  <li id="pys-menu-posts-events" class="nav-tab <?php echo $pys_active_tab == 'posts-events' ? 'nav-tab-active selected' : null; ?>">Events</li>
26
  <li id="pys-menu-dynamic-events" class="nav-tab <?php echo $pys_active_tab == 'dynamic-events' ? 'nav-tab-active selected' : null; ?>">Dynamic Events</li>
27
  <li id="pys-menu-woo" class="nav-tab <?php echo $pys_active_tab == 'woo' ? 'nav-tab-active selected' : null; ?>">WooCommerce Setup</li>
28
+ <li id="pys-menu-edd" class="nav-tab <?php echo $pys_active_tab == 'edd' ? 'nav-tab-active selected' : null; ?>"><?php _e( 'Easy Digital Downloads', 'pys' ); ?></li>
29
  </ul>
30
 
31
  <div class="pys-content">
88
 
89
  </div><!-- #pys-panel-woo -->
90
 
91
+ <div id="pys-panel-edd"
92
+ class="pys-panel" <?php echo $pys_active_tab == 'edd' ? 'style="display: block;"' : null; ?>>
93
+
94
+ <?php include "html-box-top-edd.php"; ?>
95
+
96
+ <?php if ( pys_is_edd_active() ): ?>
97
+
98
+ <?php include "html-tab-edd.php"; ?>
99
+
100
+ <?php else: ?>
101
+
102
+ <div class="pys-box pys-box-red">
103
+ <h3 style="text-align: center; color: #fff;"><?php _e( 'Please install and activate Easy Digital Downloads plugin to enable Easy Digital Downloads integration.', 'pys' ); ?></h3>
104
+ </div>
105
+
106
+ <?php endif; ?>
107
+
108
+ <?php include "html-box-middle.php"; ?>
109
+
110
+ </div><!-- #pys-panel-edd -->
111
+
112
  </form>
113
  </div><!-- .pys-content -->
114
 
inc/html-box-bottom.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-bottom">
2
  <div class="pys-col pys-col-one-half">
3
  <h2>Useful stuff:</h2>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-bottom">
10
  <div class="pys-col pys-col-one-half">
11
  <h2>Useful stuff:</h2>
inc/html-box-middle.php CHANGED
@@ -1,9 +1,16 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-middle">
2
  <div class="pys-col pys-col-narrow">
3
 
4
  <?php if( pys_is_woocommerce_active() ) : ?>
5
-
6
- <!-- @todo: change texts (not defined now) -->
7
  <h2>How to create <u>Super Powerful Custom Audiences</u> using the <i>General Event</i><br>option from PixelYourSite</h2>
8
  <p>The “General Event” option from PixelYourSite plugin can be extremely useful, so we decided to write an actionable guide about how to use it to increase your profit</p>
9
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-middle">
10
  <div class="pys-col pys-col-narrow">
11
 
12
  <?php if( pys_is_woocommerce_active() ) : ?>
13
+
 
14
  <h2>How to create <u>Super Powerful Custom Audiences</u> using the <i>General Event</i><br>option from PixelYourSite</h2>
15
  <p>The “General Event” option from PixelYourSite plugin can be extremely useful, so we decided to write an actionable guide about how to use it to increase your profit</p>
16
 
inc/html-box-top-dynamic.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-top">
2
  <div class="pys-col pys-col-one-half">
3
  <ul>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-top">
10
  <div class="pys-col pys-col-one-half">
11
  <ul>
inc/html-box-top-edd.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
+ <div class="pys-box pys-box-top">
10
+ <div class="pys-col pys-col-full">
11
+ <ul>
12
+ <li><h2><?php _e( 'First time here? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting</a>', 'pys' ); ?></h2></li>
13
+ </ul>
14
+ <ul>
15
+ <li><h2><?php _e( 'Click for help: <a href="http://www.pixelyoursite.com/easy-digital-download-facebook-pixel-help" target="_blank">How to configure Facebook Pixel on Easy Digital Downloads - Must Read</a>', 'pys' ); ?></h2></li>
16
+ </ul>
17
+ </div>
18
+ </div>
inc/html-box-top-general.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-top">
2
  <div class="pys-col pys-col-one-half">
3
  <ul>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-top">
10
  <div class="pys-col pys-col-one-half">
11
  <ul>
inc/html-box-top-post-event.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-top">
2
  <div class="pys-col pys-col-one-half">
3
  <ul>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-top">
10
  <div class="pys-col pys-col-one-half">
11
  <ul>
inc/html-box-top-woo.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-top">
2
  <div class="pys-col pys-col-one-half">
3
  <ul>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-top">
10
  <div class="pys-col pys-col-one-half">
11
  <ul>
inc/html-offer-content.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <?php if ( pys_is_woocommerce_active() ) : ?>
2
 
3
  <h2>Special Offer:</h2>
@@ -6,7 +14,6 @@
6
  <li><strong>Woocommerce Conversion Value Fine-Tuned Tracking</strong>, so you can really measure your Ads ROI.</li>
7
  <li><strong>WooCommerce Custom Audiences</strong>: track important things like product names, product category, product tags, payment and shipping methods or coupons. Use them to create powerful Custom Audiences for better retargeting and Lookalike expansion.</li>
8
  <li><strong>Track Traffic Source</strong> and <strong>URL tags (UTM)</strong> for all your events and segment your Custom Audiences with them.</li>
9
- <li>Enable the <strong>TimeOnPage Event</strong> and use it for Custom Audiences</li>
10
  <li>Use <strong>Dynamic Events</strong> like a pro marketer and optimize your FB Ads for important actions on your site (like clicks on key links, page scroll or mouse over).</li>
11
  </ul>
12
 
@@ -17,7 +24,6 @@
17
  <ul class="dashed">
18
  <li>Use <strong>Dynamic Events</strong> like a pro marketer to trigger events when the visitors performs a key action on your site, like clicks on important links or buttons, page scroll or mouse over. Optimize your ads for them for an improved ROI.</li>
19
  <li>Track <strong>Traffic Source</strong> and <strong>URL tags (UTM)</strong> to segment your Custom Audiences based on them for superior retargeting strategies. </li>
20
- <li>Enable <strong>TimeOnPage Event</strong> to make Custom Audiences for key pages where only people spending a minimum amount of time are important for your business.</li>
21
  </ul>
22
 
23
  <?php endif; ?>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <?php if ( pys_is_woocommerce_active() ) : ?>
10
 
11
  <h2>Special Offer:</h2>
14
  <li><strong>Woocommerce Conversion Value Fine-Tuned Tracking</strong>, so you can really measure your Ads ROI.</li>
15
  <li><strong>WooCommerce Custom Audiences</strong>: track important things like product names, product category, product tags, payment and shipping methods or coupons. Use them to create powerful Custom Audiences for better retargeting and Lookalike expansion.</li>
16
  <li><strong>Track Traffic Source</strong> and <strong>URL tags (UTM)</strong> for all your events and segment your Custom Audiences with them.</li>
 
17
  <li>Use <strong>Dynamic Events</strong> like a pro marketer and optimize your FB Ads for important actions on your site (like clicks on key links, page scroll or mouse over).</li>
18
  </ul>
19
 
24
  <ul class="dashed">
25
  <li>Use <strong>Dynamic Events</strong> like a pro marketer to trigger events when the visitors performs a key action on your site, like clicks on important links or buttons, page scroll or mouse over. Optimize your ads for them for an improved ROI.</li>
26
  <li>Track <strong>Traffic Source</strong> and <strong>URL tags (UTM)</strong> to segment your Custom Audiences based on them for superior retargeting strategies. </li>
 
27
  </ul>
28
 
29
  <?php endif; ?>
inc/html-tab-dynamic-events-general.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2 class="section-title">Dynamic Events (Pro Option)</h2>
@@ -43,16 +51,16 @@
43
  <table class="layout">
44
  <tr>
45
  <td class="alignright"><p class="label big">Activate Dynamic Events</p></td>
46
- <td><input type="checkbox" disabled="disabled"></input></td>
47
  </tr>
48
 
49
  <tr>
50
  <td class="alignright"><p class="label">Process links</p></td>
51
  <td>
52
- <input type="checkbox" disabled="disabled">Process links in Post Content</input>
53
  <span class="help">The <code>the_content()</code> hook.</span>
54
 
55
- <input type="checkbox" disabled="disabled">Process links in Widgets Text</input>
56
  <span class="help">The <code>widget_text()</code> hook.</span>
57
  </td>
58
  </tr>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
  <h2 class="section-title">Dynamic Events (Pro Option)</h2>
51
  <table class="layout">
52
  <tr>
53
  <td class="alignright"><p class="label big">Activate Dynamic Events</p></td>
54
+ <td><input type="checkbox" disabled="disabled"></td>
55
  </tr>
56
 
57
  <tr>
58
  <td class="alignright"><p class="label">Process links</p></td>
59
  <td>
60
+ <input type="checkbox" disabled="disabled">Process links in Post Content
61
  <span class="help">The <code>the_content()</code> hook.</span>
62
 
63
+ <input type="checkbox" disabled="disabled">Process links in Widgets Text
64
  <span class="help">The <code>widget_text()</code> hook.</span>
65
  </td>
66
  </tr>
inc/html-tab-dynamic-events-list.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2 class="section-title">Active Dynamic Events</h2>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
  <h2 class="section-title">Active Dynamic Events</h2>
inc/html-tab-edd.php ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
+ <div class="pys-box">
10
+ <div class="pys-col pys-col-full">
11
+ <h2 class="section-title"><?php _e( 'Easy Digital Downloads Settings', 'pys' ); ?></h2>
12
+ <p><?php _e( 'Add all necessary events on Easy Digital Downloads with just a few clicks. On this tab you will find powerful options to customize the Facebook Pixel for your store.', 'pys' ); ?></p>
13
+
14
+ <hr>
15
+ <h2 class="section-title"><?php _e( 'Facebook Dynamic Product Ads Pixel Settings', 'pys' ); ?></h2>
16
+ <table class="layout">
17
+
18
+ <tr class="tall">
19
+ <td colspan="2" class="narrow">
20
+ <input type="checkbox" class="edd-events-toggle">
21
+ <strong><?php _e( 'Enable Facebook Dynamic Product Ads', 'pys' ); ?></strong>
22
+ <span class="help"><?php _e( 'This will automatically add ViewContent on download pages, AddToCart on add to cart button click, InitiateCheckout on checkout page and Purchase on thank you page. The events will have the required <code>content_ids</code> and <code>content_type</code> fields.', 'pys' ); ?></span>
23
+ </td>
24
+ </tr>
25
+
26
+ <tr>
27
+ <td class="alignright"><p class="label">content_ids:</p></td>
28
+ <td>
29
+ <select name="pys[edd][content_id]">
30
+ <option <?php selected( 'id', pys_get_option( 'edd', 'content_id' ) ); ?> value="id"><?php _e( 'Download ID', 'pys' ); ?></option>
31
+ <option <?php selected( 'sku', pys_get_option( 'edd', 'content_id' ) ); ?> value="sku"><?php _e( 'Download SKU', 'pys' ); ?></option>
32
+ </select>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+
37
+ <hr>
38
+ <h2 class="section-title">PRO Options</h2>
39
+ <table class="layout">
40
+ <tr class="disabled" style="vertical-align: top;">
41
+ <td>
42
+ <h2><?php _e( 'Custom Audiences Optimization', 'pys' ); ?></h2>
43
+ <input type="checkbox" disabled>
44
+ <?php _e( 'Enable Additional Parameters', 'pys' ); ?>
45
+ <span class="help"><?php _e( 'Download name will be pulled as <code>content_name</code>, and Download Category as <code>category_name</code> for all EDD events.', 'pys' ); ?></span>
46
+ <span class="help" style="margin-bottom: 20px;"><?php _e( 'The number of items is <code>num_items</code> for InitiateCheckout and Purchase events.', 'pys' ); ?></span>
47
+ <input type="checkbox" disabled>
48
+ <?php _e( 'Track tags', 'pys' ); ?>
49
+ <span class="help"><?php _e( 'Will pull <code>tags</code> param on all EDD events.', 'pys' );
50
+ ?></span>
51
+ </td>
52
+
53
+ <td>
54
+ <h2><?php _e( 'Tax Options', 'pys' ); ?></h2>
55
+ <?php _e( 'Value:', 'pys' ); ?> &nbsp;&nbsp;
56
+ <select disabled>
57
+ <option selected>Includes Tax</option>
58
+ </select>
59
+ </td>
60
+ </tr>
61
+
62
+ <tr style="vertical-align: top;">
63
+ <td>
64
+ <p><?php _e( '<strong>Important for Custom Audiences.</strong> Use this together with the General Event option.', 'pys' ); ?></p>
65
+ <p><?php _e( 'Learn how to <strong>Create Powerful Custom Audiences</strong> based on Events: <strong><a href="http://www.pixelyoursite.com/use-general-event-existing-clients" target="_blank">Click to Download Your Free Guide</a></strong>', 'pys' ); ?></p>
66
+
67
+ </td>
68
+ <td>
69
+ <p><strong>Unlock all the PRO features: <a href="http://www.pixelyoursite.com/facebook-pixel-plugin"
70
+ target="_blank">Upgrade NOW</a></strong></p>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+
75
+ <!-- ViewContent -->
76
+ <hr>
77
+ <h2 class="section-title"><?php _e( 'ViewContent Event', 'pys' ); ?></h2>
78
+ <p><?php _e( 'ViewContent is added on Download Pages and it is required for Facebook Dynamic Product Ads.', 'pys' ); ?></p>
79
+ <table class="layout">
80
+
81
+ <tr class="tall">
82
+ <td colspan="2" class="narrow">
83
+ <?php pys_checkbox( 'edd', 'on_view_content', 'edd-option' ); ?>
84
+ <strong><?php _e( 'Enable ViewContent on Download Pages', 'pys' ); ?></strong>
85
+ </td>
86
+ </tr>
87
+
88
+ <tr>
89
+ <td class="alignright disabled"><p class="label"><?php _e( 'Delay', 'pys' ); ?></p></td>
90
+ <td>
91
+ <input type="number" disabled>
92
+ <?php _e( 'seconds', 'pys' ); ?> - <strong>This is a PRO feature</strong> - <a
93
+ href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
94
+ </td>
95
+ </tr>
96
+
97
+ <tr>
98
+ <td></td>
99
+ <td>
100
+ <?php pys_checkbox( 'edd', 'enable_view_content_value' ); ?>
101
+ <?php _e( 'Enable Value', 'pys' ); ?>
102
+ <span class="help"><?php _e( 'Add value and currency - Important for ROI measurement', 'pys' ); ?></span>
103
+ </td>
104
+ </tr>
105
+
106
+ <tr>
107
+ <td class="alignright"><p class="label big"><?php _e( 'Define value:', 'pys' ); ?></p></td>
108
+ <td></td>
109
+ </tr>
110
+
111
+ <tr class="disabled">
112
+ <td class="alignright"><p class="label"><?php _e( 'Download price', 'pys' ); ?></p></td>
113
+ <td>
114
+ <input type="radio">
115
+ </td>
116
+ </tr>
117
+
118
+ <tr class="disabled">
119
+ <td class="alignright"><p class="label"><?php _e( 'Percent of download price', 'pys' ); ?></p></td>
120
+ <td>
121
+ <input type="radio">
122
+ <input type="text">&nbsp;%
123
+ </td>
124
+ </tr>
125
+
126
+ <tr>
127
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
128
+ <td>
129
+ <input type="radio" checked>
130
+ <?php pys_text_field( 'edd', 'view_content_global_value' ); ?>
131
+ </td>
132
+ </tr>
133
+
134
+ <tr>
135
+ <td></td>
136
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to <strong>enable all value options</strong></td>
137
+ </tr>
138
+
139
+ </table>
140
+
141
+ <!-- AddToCart -->
142
+ <hr>
143
+ <h2 class="section-title"><?php _e( 'AddToCart Event', 'pys' ); ?></h2>
144
+ <p><?php _e( 'AddToCart event will be added on add to cart button click and on cart page. It is required for Facebook Dynamic Product Ads.', 'pys' ); ?></p>
145
+ <table class="layout">
146
+
147
+ <tr>
148
+ <td colspan="2" class="narrow">
149
+ <?php pys_checkbox( 'edd', 'on_add_to_cart_btn', 'edd-option' ); ?>
150
+ <strong><?php _e( 'Enable AddToCart on add to cart button', 'pys' ); ?></strong>
151
+ </td>
152
+ </tr>
153
+
154
+ <tr>
155
+ <td></td>
156
+ <td>
157
+ <?php pys_checkbox( 'edd', 'enable_add_to_cart_value' ); ?>
158
+ <?php _e( 'Enable Value', 'pys' ); ?>
159
+ <span class="help"><?php _e( 'Add value and currency - Important for ROI measurement', 'pys' ); ?></span>
160
+ </td>
161
+ </tr>
162
+
163
+ <tr>
164
+ <td class="alignright"><p class="label big"><?php _e( 'Define value:', 'pys' ); ?></p></td>
165
+ <td></td>
166
+ </tr>
167
+
168
+ <tr class="disabled">
169
+ <td class="alignright"><p class="label"><?php _e( 'Downloads price (subtotal)', 'pys' ); ?></p></td>
170
+ <td>
171
+ <input type="radio">
172
+ </td>
173
+ </tr>
174
+
175
+ <tr class="disabled">
176
+ <td class="alignright"><p class="label"><?php _e( 'Percent of downloads value (subtotal)', 'pys' ); ?></p></td>
177
+ <td>
178
+ <input type="radio">
179
+ <input type="text">&nbsp;%
180
+ </td>
181
+ </tr>
182
+
183
+ <tr>
184
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
185
+ <td>
186
+ <input type="radio" checked>
187
+ <?php pys_text_field( 'edd', 'add_to_cart_global_value' ); ?>
188
+ </td>
189
+ </tr>
190
+
191
+ <tr>
192
+ <td></td>
193
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
194
+ <strong>enable all value options</strong></td>
195
+ </tr>
196
+
197
+ </table>
198
+
199
+ <!-- InitiateCheckout -->
200
+ <hr>
201
+ <h2 class="section-title"><?php _e( 'InitiateCheckout Event', 'pys' ); ?></h2>
202
+ <p><?php _e( 'InitiateCheckout event will be enabled on the Checkout page. It is not mandatory for Facebook Dynamic Product Ads, but it is better to keep it on.', 'pys' ); ?></p>
203
+ <table class="layout">
204
+
205
+ <tr class="tall">
206
+ <td colspan="2" class="narrow">
207
+ <?php pys_checkbox( 'edd', 'on_checkout_page', 'edd-option' ); ?>
208
+ <strong><?php _e( 'Enable InitiateCheckout on Checkout page', 'pys' ); ?></strong>
209
+ </td>
210
+ </tr>
211
+
212
+ <tr>
213
+ <td></td>
214
+ <td>
215
+ <?php pys_checkbox( 'edd', 'enable_checkout_value' ); ?>
216
+ <?php _e( 'Enable Value', 'pys' ); ?>
217
+ <span class="help"><?php _e( 'Add value and currency - Important for ROI measurement', 'pys' ); ?></span>
218
+ </td>
219
+ </tr>
220
+
221
+ <tr>
222
+ <td class="alignright"><p class="label big"><?php _e( 'Define value:', 'pys' ); ?></p></td>
223
+ <td></td>
224
+ </tr>
225
+
226
+ <tr class="disabled">
227
+ <td class="alignright"><p class="label"><?php _e( 'Downloads price (subtotal)', 'pys' ); ?></p></td>
228
+ <td>
229
+ <input type="radio">
230
+ </td>
231
+ </tr>
232
+
233
+ <tr class="disabled">
234
+ <td class="alignright"><p
235
+ class="label"><?php _e( 'Percent of downloads value (subtotal)', 'pys' ); ?></p></td>
236
+ <td>
237
+ <input type="radio">
238
+ <input type="text">&nbsp;%
239
+ </td>
240
+ </tr>
241
+
242
+ <tr>
243
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
244
+ <td>
245
+ <input type="radio" checked>
246
+ <?php pys_text_field( 'edd', 'checkout_global_value' ); ?>
247
+ </td>
248
+ </tr>
249
+
250
+ <tr>
251
+ <td></td>
252
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
253
+ <strong>enable all value options</strong></td>
254
+ </tr>
255
+
256
+ </table>
257
+
258
+ <!-- Purchase -->
259
+ <hr>
260
+ <h2 class="section-title"><?php _e( 'Purchase Event', 'pys' ); ?></h2>
261
+ <p><?php _e( 'Purchase event will be enabled on the Success Page. It is mandatory for Facebook Dynamic Product Ads.', 'pys' ); ?></p>
262
+ <table class="layout">
263
+
264
+ <tr class="tall">
265
+ <td colspan="2" class="narrow">
266
+ <?php pys_checkbox( 'edd', 'on_success_page', 'edd-option' ); ?>
267
+ <strong><?php _e( 'Enable Purchase event on Success Page', 'pys' ); ?></strong>
268
+ </td>
269
+ </tr>
270
+
271
+ <tr>
272
+ <td></td>
273
+ <td>
274
+ <?php pys_checkbox( 'edd', 'enable_purchase_value' ); ?>
275
+ <?php _e( 'Enable Value', 'pys' ); ?>
276
+ <span class="help"><?php _e( 'Add value and currency - <strong>Very important for ROI
277
+ measurement</strong>', 'pys' ); ?></span>
278
+ </td>
279
+ </tr>
280
+
281
+ <tr>
282
+ <td class="alignright disabled">
283
+ <p class="label"><?php _e( 'Fire the event on transaction only', 'pys' ); ?></p>
284
+ </td>
285
+ <td>
286
+ <select disabled>
287
+ <option><?php _e( 'Off', 'pys' ); ?></option>
288
+ </select> - <strong>This is a PRO feature</strong> - <a
289
+ href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
290
+ <span class="help"><?php _e( 'This will avoid the Purchase event to be fired when the success page is visited but no transaction has occurred. <b>It will improve conversion tracking.</b>', 'pys' ); ?></span>
291
+ </td>
292
+ </tr>
293
+
294
+ <tr>
295
+ <td class="alignright"><p class="label big"><?php _e( 'Define value:', 'pys' ); ?></p></td>
296
+ <td></td>
297
+ </tr>
298
+
299
+ <tr class="disabled">
300
+ <td class="alignright"><p class="label"><?php _e( 'Total', 'pys' ); ?></p></td>
301
+ <td>
302
+ <input type="radio">
303
+ </td>
304
+ </tr>
305
+
306
+ <tr class="disabled">
307
+ <td class="alignright"><p class="label"><?php _e( 'Percent of Total', 'pys' ); ?></p></td>
308
+ <td>
309
+ <input type="radio">
310
+ <input type="text">&nbsp;%
311
+ </td>
312
+ </tr>
313
+
314
+ <tr>
315
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
316
+ <td>
317
+ <input type="radio" checked>
318
+ <?php pys_text_field( 'edd', 'purchase_global_value' ); ?>
319
+ </td>
320
+ </tr>
321
+
322
+ <tr class="tall">
323
+ <td></td>
324
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
325
+ <strong>enable all value options</strong></td>
326
+ </tr>
327
+
328
+ <tr>
329
+ <td class="alignright">
330
+ <p class="label big"><?php _e( 'Custom Audience Optimization:', 'pys' ); ?></p>
331
+ </td>
332
+ <td>
333
+ <span class="help"><strong>This is a PRO feature</strong> - <a
334
+ href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></span>
335
+ </td>
336
+ </tr>
337
+
338
+ <tr class="disabled">
339
+ <td></td>
340
+ <td>
341
+ <input type="checkbox">
342
+ <strong><?php _e( 'Add Town, State and Country parameters', 'pys' ); ?></strong>
343
+ <span
344
+ class="help"><?php _e( 'Will pull <code>town</code>, <code>state</code> and <code>country</code>', 'pys' ); ?></span>
345
+ </td>
346
+ </tr>
347
+
348
+ <tr class="disabled">
349
+ <td></td>
350
+ <td>
351
+ <input type="checkbox">
352
+ <strong><?php _e( 'Add Payment Method parameter', 'pys' ); ?></strong>
353
+ <span class="help"><?php _e( 'Will pull <code>payment</code>', 'pys' ); ?></span>
354
+ </td>
355
+ </tr>
356
+
357
+ <tr class="disabled">
358
+ <td></td>
359
+ <td>
360
+ <input type="checkbox">
361
+ <strong><?php _e( 'Add Coupons parameter', 'pys' ); ?></strong>
362
+ <span class="help"><?php _e( 'Will pull <code>coupon_used</code> and <code>coupon_name</code>', 'pys' ); ?></span>
363
+ </td>
364
+ </tr>
365
+
366
+ </table>
367
+
368
+ <p><?php _e( '<strong>Important:</strong> For the Purchase Event to work, the client must be redirected on the EDD Success Page after payment.', 'pys' ); ?></p>
369
+
370
+ <!-- Activate EDD -->
371
+ <hr>
372
+ <table class="layout">
373
+ <tr>
374
+ <td class="alignright">
375
+ <p class="label big"><?php _e( 'Activate Easy Digital Downloads Pixel Settings', 'pys' ); ?></p>
376
+ </td>
377
+ <td>
378
+ <?php pys_checkbox( 'edd', 'enabled' ); ?>
379
+ </td>
380
+ </tr>
381
+ </table>
382
+
383
+ <button class="pys-btn pys-btn-blue pys-btn-big aligncenter"><?php _e( 'Save Settings', 'pys' ); ?></button>
384
+
385
+ </div>
386
+ </div>
inc/html-tab-pixel-activate.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2>Activate Facebook Pixel on Your Site</h2>
@@ -7,7 +15,7 @@
7
  <td class="alignright"><p class="label big">Activate plugin general settings</p></td>
8
  <td>
9
  <input type="checkbox" name="pys[general][enabled]" value="1" class="big"
10
- <?php echo pys_checkbox_state( 'general', 'enabled' ); ?> >
11
  </td>
12
  </tr>
13
  </table>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
  <h2>Activate Facebook Pixel on Your Site</h2>
15
  <td class="alignright"><p class="label big">Activate plugin general settings</p></td>
16
  <td>
17
  <input type="checkbox" name="pys[general][enabled]" value="1" class="big"
18
+ <?php pys_checkbox_state( 'general', 'enabled' ); ?> >
19
  </td>
20
  </tr>
21
  </table>
inc/html-tab-pixel-general.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2>General Event (optional)</h2>
@@ -8,14 +16,14 @@
8
  <td class="alignright"><p class="label">Enable general event setup</p></td>
9
  <td>
10
  <input type="checkbox" name="pys[general][general_event_enabled]" value="1"
11
- <?php echo pys_checkbox_state( 'general', 'general_event_enabled' ); ?> >
12
  </td>
13
  </tr>
14
 
15
  <tr class="tall">
16
  <td></td>
17
  <td>
18
- <input type="checkbox" name="" value="1" class="disabled">Track tags - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
19
  <span class="help">Will pull <code>tags</code> param on posts and custom post types</span>
20
  </td>
21
  </tr>
@@ -40,7 +48,7 @@
40
  <td></td>
41
  <td>
42
  <input type="checkbox" name="pys[general][general_event_on_posts_enabled]" value="1"
43
- <?php echo pys_checkbox_state( 'general', 'general_event_on_posts_enabled' ); ?> >Enable on Posts
44
  <span class="help">Will put post title as <code>content_name</code> and post category name as <code>category_name</code></span>
45
  </td>
46
  </tr>
@@ -49,7 +57,7 @@
49
  <td></td>
50
  <td>
51
  <input type="checkbox" name="pys[general][general_event_on_pages_enabled]" value="1"
52
- <?php echo pys_checkbox_state( 'general', 'general_event_on_pages_enabled' ); ?> >Enable on Pages
53
  <span class="help">Will pull page title as <code>content_name</code></span>
54
  </td>
55
  </tr>
@@ -58,21 +66,38 @@
58
  <td></td>
59
  <td>
60
  <input type="checkbox" name="pys[general][general_event_on_tax_enabled]" value="1"
61
- <?php echo pys_checkbox_state( 'general', 'general_event_on_tax_enabled' ); ?> >Enable on Taxonomies
62
  <span class="help">Will pull taxonomy name as <code>content_name</code></span>
63
  </td>
64
  </tr>
65
-
66
- <?php if( pys_is_edd_active() ) : ?>
67
- <tr>
68
- <td></td>
69
- <td>
70
- <input type="checkbox" name="pys[general][general_event_on_edd_enabled]" value="1"
71
- <?php echo pys_checkbox_state( 'general', 'general_event_on_edd_enabled' ); ?> >Enable on Easy Digital Downloads Products
72
- <span class="help">Will pull product title as <code>content_name</code> and product category name as <code>category_name</code>, product price as <code>value</code>, currency as <code>currency</code>, post type as <code>content_type</code>.</span>
73
- </td>
74
- </tr>
75
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  <?php
78
 
@@ -93,7 +118,7 @@
93
  <td></td>
94
  <td>
95
  <input type="checkbox" name="pys[general][general_event_on_<?php echo $pt->name; ?>_enabled]" value="1"
96
- <?php echo pys_checkbox_state( 'general', 'general_event_on_' . $pt->name . '_enabled' ); ?>
97
  >Enable on <?php echo $pt->label; ?> Post Type
98
  <span class="help">Will pull <?php echo $pt->name; ?> title as <code>content_name</code> and <?php echo $pt->name; ?> category name as <code>category_name</code>, <code>content_type</code> as <code><?php echo $pt->name; ?></code>.</span>
99
  </td>
@@ -105,25 +130,6 @@
105
  </table>
106
 
107
  <p>The General Event can help you create Super Powerful Custom Audiences, so we made a guide about how to use it: <a href="http://www.pixelyoursite.com/general-event" target="_blank">Click Here to Download the Guide For Free</a></p>
108
-
109
- <hr>
110
-
111
- <h2>TimeOnPage Event</h2>
112
- <p>TimeOnPage event will pull the time spent on each page in seconds, the page name as <code>content_name</code>, and the page ID as <code>content_ids</code>. Use it to create CustomAudiences for key pages <strong>where only people that spend a minimum amount of time matter for your business</strong>. This will improve your retargeting as well as Lookalike Audiences. - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></p>
113
-
114
- <table class="layout disabled">
115
-
116
- <tr>
117
- <td class="alignright"><p class="label">Enable TimeOnPage event setup</p></td>
118
- <td>
119
- <input type="checkbox" name="pys[general][timeonpage_enabled]" value="1"
120
- <?php echo pys_checkbox_state( 'general', 'timeonpage_enabled' ); ?> >
121
- </td>
122
- </tr>
123
-
124
- </table>
125
-
126
- <p>You can find more details on this event on <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">our help page</a></p>
127
 
128
  <hr>
129
 
@@ -136,7 +142,7 @@
136
  <td class="alignright"><p class="label">Enable Search event setup</p></td>
137
  <td>
138
  <input type="checkbox" name="pys[general][search_event_enabled]" value="1"
139
- <?php echo pys_checkbox_state( 'general', 'search_event_enabled' ); ?> >
140
  </td>
141
  </tr>
142
 
@@ -170,7 +176,7 @@
170
  <td class="alignright"><?php echo $role_name; ?></td>
171
  <td>
172
  <input type="checkbox" name="pys[general][disable_for_<?php echo $role_value; ?>]" value="1"
173
- <?php echo pys_checkbox_state( 'general', 'disable_for_' . $role_value ); ?> >
174
  </td>
175
  </tr>
176
 
@@ -180,7 +186,7 @@
180
  <td class="alignright">Guest</td>
181
  <td>
182
  <input type="checkbox" name="pys[general][disable_for_guest]" value="1"
183
- <?php echo pys_checkbox_state( 'general', 'disable_for_guest' ); ?> >
184
  </td>
185
  </tr>
186
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
  <h2>General Event (optional)</h2>
16
  <td class="alignright"><p class="label">Enable general event setup</p></td>
17
  <td>
18
  <input type="checkbox" name="pys[general][general_event_enabled]" value="1"
19
+ <?php pys_checkbox_state( 'general', 'general_event_enabled' ); ?> >
20
  </td>
21
  </tr>
22
 
23
  <tr class="tall">
24
  <td></td>
25
  <td>
26
+ <input type="checkbox" class="disabled">Track tags - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
27
  <span class="help">Will pull <code>tags</code> param on posts and custom post types</span>
28
  </td>
29
  </tr>
48
  <td></td>
49
  <td>
50
  <input type="checkbox" name="pys[general][general_event_on_posts_enabled]" value="1"
51
+ <?php pys_checkbox_state( 'general', 'general_event_on_posts_enabled' ); ?> >Enable on Posts
52
  <span class="help">Will put post title as <code>content_name</code> and post category name as <code>category_name</code></span>
53
  </td>
54
  </tr>
57
  <td></td>
58
  <td>
59
  <input type="checkbox" name="pys[general][general_event_on_pages_enabled]" value="1"
60
+ <?php pys_checkbox_state( 'general', 'general_event_on_pages_enabled' ); ?> >Enable on Pages
61
  <span class="help">Will pull page title as <code>content_name</code></span>
62
  </td>
63
  </tr>
66
  <td></td>
67
  <td>
68
  <input type="checkbox" name="pys[general][general_event_on_tax_enabled]" value="1"
69
+ <?php pys_checkbox_state( 'general', 'general_event_on_tax_enabled' ); ?> >Enable on Taxonomies
70
  <span class="help">Will pull taxonomy name as <code>content_name</code></span>
71
  </td>
72
  </tr>
73
+
74
+ <?php if ( pys_is_woocommerce_active() ) : ?>
75
+ <tr>
76
+ <td></td>
77
+ <td>
78
+ <input type="checkbox" class="disabled">
79
+ <?php _e( 'Enable on WooCommerce Products', 'pys' ); ?>
80
+ - <strong>This is a PRO feature</strong> - <a
81
+ href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
82
+ <span
83
+ class="help"><?php _e( 'Will pull product title as <code>content_name</code> and product category name as <code>category_name</code>, product price as <code>value</code>, currency as <code>currency</code>, post type as <code>content_type</code>.', 'pys' ); ?></span>
84
+ </td>
85
+ </tr>
86
+ <?php endif; ?>
87
+
88
+ <?php if ( pys_is_edd_active() ) : ?>
89
+ <tr>
90
+ <td></td>
91
+ <td>
92
+ <input type="checkbox" class="disabled">
93
+ <?php _e( 'Enable on Easy Digital Downloads Products', 'pys' ); ?>
94
+ - <strong>This is a PRO feature</strong> - <a
95
+ href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
96
+ <span
97
+ class="help"><?php _e( 'Will pull product title as <code>content_name</code> and product category name as <code>category_name</code>, product price as <code>value</code>, currency as <code>currency</code>, post type as <code>content_type</code>.', 'pys' ); ?></span>
98
+ </td>
99
+ </tr>
100
+ <?php endif; ?>
101
 
102
  <?php
103
 
118
  <td></td>
119
  <td>
120
  <input type="checkbox" name="pys[general][general_event_on_<?php echo $pt->name; ?>_enabled]" value="1"
121
+ <?php pys_checkbox_state( 'general', 'general_event_on_' . $pt->name . '_enabled' ); ?>
122
  >Enable on <?php echo $pt->label; ?> Post Type
123
  <span class="help">Will pull <?php echo $pt->name; ?> title as <code>content_name</code> and <?php echo $pt->name; ?> category name as <code>category_name</code>, <code>content_type</code> as <code><?php echo $pt->name; ?></code>.</span>
124
  </td>
130
  </table>
131
 
132
  <p>The General Event can help you create Super Powerful Custom Audiences, so we made a guide about how to use it: <a href="http://www.pixelyoursite.com/general-event" target="_blank">Click Here to Download the Guide For Free</a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  <hr>
135
 
142
  <td class="alignright"><p class="label">Enable Search event setup</p></td>
143
  <td>
144
  <input type="checkbox" name="pys[general][search_event_enabled]" value="1"
145
+ <?php pys_checkbox_state( 'general', 'search_event_enabled' ); ?> >
146
  </td>
147
  </tr>
148
 
176
  <td class="alignright"><?php echo $role_name; ?></td>
177
  <td>
178
  <input type="checkbox" name="pys[general][disable_for_<?php echo $role_value; ?>]" value="1"
179
+ <?php pys_checkbox_state( 'general', 'disable_for_' . $role_value ); ?> >
180
  </td>
181
  </tr>
182
 
186
  <td class="alignright">Guest</td>
187
  <td>
188
  <input type="checkbox" name="pys[general][disable_for_guest]" value="1"
189
+ <?php pys_checkbox_state( 'general', 'disable_for_guest' ); ?> >
190
  </td>
191
  </tr>
192
 
inc/html-tab-pixel-id.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2 class="section-title">Add your Pixel ID:</h2>
@@ -8,7 +16,7 @@
8
  <td>
9
  <input type="text" name="pys[general][pixel_id]"
10
  placeholder="Enter your Facebook Pixel ID"
11
- value="<?php esc_attr_e( pys_get_option( 'general', 'pixel_id' ) ); ?>">
12
  <span class="help">Where to find the Pixel ID? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Click here for help</a></span>
13
  </td>
14
  </tr>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
  <h2 class="section-title">Add your Pixel ID:</h2>
16
  <td>
17
  <input type="text" name="pys[general][pixel_id]"
18
  placeholder="Enter your Facebook Pixel ID"
19
+ value="<?php echo pys_get_option( 'general', 'pixel_id' ); ?>">
20
  <span class="help">Where to find the Pixel ID? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Click here for help</a></span>
21
  </td>
22
  </tr>
inc/html-tab-std-add-event.php CHANGED
@@ -1,22 +1,27 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
- <div class="pys-col pys-col-full">
3
- <div style="text-align: center; margin-top: 13px;">
4
-
5
- <?php
6
-
7
- $show_modal_url = add_query_arg(
8
- array(
9
- 'action' => 'pys_edit_std_event',
10
- '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' )
11
- ),
12
- admin_url( 'admin-ajax.php' )
13
- );
14
-
15
- ?>
16
-
17
- <a href="<?php echo esc_url( $show_modal_url ); ?>" class="pys-btn pys-btn-big pys-btn-blue thickbox">Add New
18
- Event</a>
19
- <p>Add Standard or Custom Events that will trigger when an URL is visited</p>
20
- </div>
21
- </div>
22
  </div>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
+ <div class="pys-col pys-col-full">
11
+
12
+ <div style="text-align: center; margin-top: 13px;">
13
+
14
+ <?php
15
+
16
+ $show_modal_url = add_query_arg( array(
17
+ 'action' => 'pys_edit_std_event', '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' )
18
+ ), admin_url( 'admin-ajax.php' ) );
19
+
20
+ ?>
21
+
22
+ <a href="<?php echo esc_url( $show_modal_url ); ?>" class="pys-btn pys-btn-big pys-btn-blue thickbox"><?php _e( 'Add New Event', 'pys' ); ?></a>
23
+ <p><?php _e( 'Add standard or custom events that will trigger when a URL is visited.', 'pys' ); ?></p>
24
+ </div>
25
+
26
+ </div>
 
 
 
27
  </div>
inc/html-tab-std-event-general.php CHANGED
@@ -1,21 +1,26 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
- <!--<h2 class="section-title">On Page/Post Events</h2>-->
4
- <!--<p>Add standard or custom events that will trigger when a URL loads.</p>-->
5
-
6
- <table class="layout">
7
- <tr>
8
- <td class="alignright">
9
- <p class="label big">Activate Events</p>
10
- </td>
11
- <td>
12
- <input type="checkbox" name="pys[std][enabled]" value="1"
13
- <?php echo pys_checkbox_state( 'std', 'enabled' ); ?> >
14
- </td>
15
- </tr>
16
- </table>
17
-
18
- <button class="pys-btn pys-btn-blue pys-btn-big aligncenter">Save Settings</button>
19
-
20
  </div>
21
  </div>
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
+
12
+ <table class="layout">
13
+ <tr>
14
+ <td class="alignright">
15
+ <p class="label big">Activate Events</p>
16
+ </td>
17
+ <td>
18
+ <input type="checkbox" name="pys[std][enabled]" value="1" <?php pys_checkbox_state( 'std', 'enabled' ); ?> >
19
+ </td>
20
+ </tr>
21
+ </table>
22
+
23
+ <button class="pys-btn pys-btn-blue pys-btn-big aligncenter">Save Settings</button>
24
+
 
 
 
25
  </div>
26
  </div>
inc/html-tab-std-event-list.php CHANGED
@@ -1,118 +1,111 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
- <div class="pys-col pys-col-full">
3
- <h2 class="section-title">Active Events</h2>
4
-
5
- <?php
6
-
7
- $show_modal_url = add_query_arg(
8
- array(
9
- 'action' => 'pys_edit_std_event',
10
- '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' )
11
- ),
12
- admin_url( 'admin-ajax.php' )
13
- );
14
-
15
- ?>
16
-
17
- <div class="tablenav top">
18
- <a href="<?php echo esc_url( $show_modal_url ); ?>"
19
- class="button button-primary action thickbox">Add new event</a>
20
- <a href="#" class="button action" id="pys-bulk-delete-std-events">Delete selected</a>
21
- </div>
22
-
23
- <table class="widefat fixed pys-list pys-std-events-list">
24
- <thead>
25
- <tr>
26
- <td class="check-column"><input type="checkbox"></td>
27
- <th scope="col" class="column-type">Type</th>
28
- <th scope="col" class="column-url">URL</th>
29
- <th scope="col" class="column-code">Code</th>
30
- <th scope="col" class="column-actions">Actions</th>
31
- </tr>
32
- </thead>
33
- <tbody>
34
-
35
- <?php if ( $std_events = get_option( 'pixel_your_site_std_events' ) ) : ?>
36
-
37
- <?php foreach ( $std_events as $key => $params ) : ?>
38
-
39
- <?php
40
-
41
- // skip wrong events
42
- if ( ! isset( $params['eventtype'] ) || ! isset( $params['pageurl'] ) ) {
43
- continue;
44
- }
45
-
46
- ?>
47
-
48
- <tr>
49
- <th scope="row" class="check-column">
50
- <input type="checkbox" class="std-event-check" data-id="<?php esc_attr_e( $key ); ?>">
51
- </th>
52
-
53
- <td><?php esc_html_e( $params['eventtype'] ); ?></td>
54
- <td><pre><?php echo $params['pageurl']; ?></pre></td>
55
- <td>
56
-
57
- <?php
58
-
59
- $code = '';
60
- if ( $params['eventtype'] == 'CustomCode' ) {
61
-
62
- $code = $params['code'];
63
-
64
- } else {
65
-
66
- $code = pys_render_event_code( $params['eventtype'], $params );
67
-
68
- }
69
-
70
- $code = stripcslashes( $code );
71
- $code = trim( $code );
72
- echo '<pre>' . $code . '</pre>';
73
-
74
- ?>
75
-
76
- </td>
77
- <td>
78
-
79
- <?php
80
-
81
- $edit_event_url = add_query_arg(
82
- array(
83
- 'action' => 'pys_edit_std_event',
84
- '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' ),
85
- 'id' => $key,
86
- ),
87
- admin_url( 'admin-ajax.php' )
88
- );
89
-
90
- $delete_event_url = add_query_arg(
91
- array(
92
- 'action' => 'pys_delete_events',
93
- '_wpnonce' => wp_create_nonce( 'pys_delete_events' ),
94
- 'events_ids' => array( $key ),
95
- 'events_type' => 'standard'
96
- ),
97
- admin_url( 'admin.php?page=pixel-your-site' )
98
- );
99
-
100
- ?>
101
-
102
- <a href="<?php echo esc_url( $edit_event_url ); ?>" class="button action thickbox">Edit</a>
103
- <a href="<?php echo esc_url( $delete_event_url ); ?>"
104
- class="button btn-delete-std-event action">Delete</a>
105
-
106
- </td>
107
- </tr>
108
-
109
- <?php endforeach; ?>
110
-
111
- <?php endif; ?>
112
-
113
- </tbody>
114
- </table>
115
- </div>
116
  </div>
117
 
118
  <script type="text/javascript">
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
+ <div class="pys-col pys-col-full">
11
+ <h2 class="section-title"><?php _e( 'Active Events', 'pys' ); ?></h2>
12
+
13
+ <?php
14
+
15
+ $show_modal_url = add_query_arg( array(
16
+ 'action' => 'pys_edit_std_event', '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' )
17
+ ), admin_url( 'admin-ajax.php' ) );
18
+
19
+ ?>
20
+
21
+ <div class="tablenav top">
22
+ <a href="<?php echo esc_url( $show_modal_url ); ?>" class="button button-primary action thickbox"><?php _e( 'Add new event', 'pys' ); ?></a>
23
+ <a href="#" class="button action" id="pys-bulk-delete-std-events"><?php _e( 'Delete selected', 'pys' ); ?></a>
24
+ </div>
25
+
26
+ <table class="widefat fixed pys-list pys-std-events-list">
27
+ <thead>
28
+ <tr>
29
+ <td class="check-column"><input type="checkbox"></td>
30
+ <th scope="col" class="column-type"><?php _e( 'Type', 'pys' ); ?></th>
31
+ <th scope="col" class="column-url">URL</th>
32
+ <th scope="col" class="column-code"><?php _e( 'Code', 'pys' ); ?></th>
33
+ <th scope="col" class="column-actions"><?php _e( 'Actions', 'pys' ); ?></th>
34
+ </tr>
35
+ </thead>
36
+ <tbody>
37
+
38
+ <?php if ( $std_events = get_option( 'pixel_your_site_std_events' ) ) : ?>
39
+
40
+ <?php foreach ( $std_events as $key => $params ) : ?>
41
+
42
+ <?php
43
+
44
+ // skip wrong events
45
+ if ( ! isset( $params['eventtype'] ) || ! isset( $params['pageurl'] ) ) {
46
+ continue;
47
+ }
48
+
49
+ ?>
50
+
51
+ <tr>
52
+ <th scope="row" class="check-column">
53
+ <input type="checkbox" class="std-event-check" data-id="<?php esc_attr_e( $key ); ?>">
54
+ </th>
55
+
56
+ <td><?php esc_attr_e( $params['eventtype'] ); ?></td>
57
+ <td>
58
+ <pre><?php echo $params['pageurl']; ?></pre>
59
+ </td>
60
+ <td>
61
+
62
+ <?php
63
+
64
+ $code = '';
65
+ if ( $params['eventtype'] == 'CustomCode' ) {
66
+
67
+ $code = $params['code'];
68
+
69
+ } else {
70
+
71
+ $code = pys_render_event_code( $params['eventtype'], $params );
72
+
73
+ }
74
+
75
+ $code = stripcslashes( $code );
76
+ $code = trim( $code );
77
+ echo '<pre>' . $code . '</pre>';
78
+
79
+ ?>
80
+
81
+ </td>
82
+ <td>
83
+
84
+ <?php
85
+
86
+ $edit_event_url = add_query_arg( array(
87
+ 'action' => 'pys_edit_std_event', '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' ), 'id' => $key,
88
+ ), admin_url( 'admin-ajax.php' ) );
89
+
90
+ $delete_event_url = add_query_arg( array(
91
+ 'action' => 'pys_delete_events', '_wpnonce' => wp_create_nonce( 'pys_delete_events' ), 'events_ids' => array( $key ), 'events_type' => 'standard'
92
+ ), admin_url( 'admin.php?page=pixel-your-site' ) );
93
+
94
+ ?>
95
+
96
+ <a href="<?php echo esc_url( $edit_event_url ); ?>" class="button action thickbox">Edit</a>
97
+ <a href="<?php echo esc_url( $delete_event_url ); ?>" class="button btn-delete-std-event action">Delete</a>
98
+
99
+ </td>
100
+ </tr>
101
+
102
+ <?php endforeach; ?>
103
+
104
+ <?php endif; ?>
105
+
106
+ </tbody>
107
+ </table>
108
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </div>
110
 
111
  <script type="text/javascript">
inc/html-tab-woo-general.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2 class="section-title">WooCommerce Pixel Settings</h2>
@@ -9,12 +17,12 @@
9
  <tr class="tall">
10
  <td colspan="2" class="narrow">
11
  <input type="checkbox" class="woo-events-toggle"><strong>Enable Facebook Dynamic Product Ads</strong>
12
- <span class="help">This will automaticaly add ViewContent on product pages, AddToCart on add to cart button click and cart page, InitiateCheckout on checkout page and Purchase on thank you page. The events will have the required <code>content_ids</code> and <code>content_type</code> parameters.</span>
13
  </td>
14
  </tr>
15
 
16
  <tr>
17
- <td class="alignright"><p class="label">Content ID:</p></td>
18
  <td>
19
  <select name="pys[woo][content_id]">
20
  <option <?php selected( 'id', pys_get_option( 'woo', 'content_id' ) ); ?> value="id">Product ID</option>
@@ -55,7 +63,7 @@
55
  <span class="help">Product name will be pulled as <code>content_name</code>, and Product Category as <code>category_name</code> for all WooCommerce events.</span>
56
  <span class="help" style="margin-bottom: 20px;">The number of items is <code>num_items</code> for InitiateCheckout and Purchase events.</span>
57
 
58
- <input type="checkbox" name="" disabled>Track tags
59
  <span class="help">Will pull <code>tags</code> param on all WooCommerce events.</span>
60
 
61
 
@@ -76,12 +84,10 @@
76
 
77
  <p><strong>Important for Custom Audiences.</strong> Use this together with the General Event option.</p>
78
  <p>Learn how to <strong>Create Powerful Custom Audiences</strong> based on Events: <strong><a href="http://www.pixelyoursite.com/general-event" target="_blank">Click to Download Your Free Guide</a></strong></p>
79
-
80
  </td>
81
  <td>
82
 
83
  <p><strong>Unlock all the PRO features: <a href="http://www.pixelyoursite.com/facebook-pixel-plugin" target="_blank">Upgrade NOW</a></strong></p>
84
-
85
  </td>
86
  </tr>
87
 
@@ -95,7 +101,7 @@
95
  <tr class="tall">
96
  <td colspan="2" class="narrow">
97
  <input type="checkbox" name="pys[woo][on_view_content]" value="1" class="woo-option"
98
- <?php echo pys_checkbox_state( 'woo', 'on_view_content' ); ?> >
99
  <strong>Enable ViewContent on Product Pages</strong>
100
  </td>
101
  </tr>
@@ -103,7 +109,7 @@
103
  <tr>
104
  <td class="alignright disabled"><p class="label">Delay</p></td>
105
  <td>
106
- <input type="number" name="pys[woo][on_view_content_delay]" value="" disabled> seconds - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
107
  <span class="help">Avoid retargeting bouncing users (It is better to add a lower time that the desired one because the pixel code will not load instantaneously). People that spent less time on the page will not be part of your Custom Audiences. You will not spend money retargeting them and your Lookalike Audiences will be more accurate.</span>
108
  </td>
109
  </tr>
@@ -111,12 +117,12 @@
111
  <tr>
112
  <td></td>
113
  <td>
114
- <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
115
- <span class="help">Add value and currency - Important for ROI measurement</span>
116
  </td>
117
  </tr>
118
 
119
- <tr class="disabled">
120
  <td class="alignright"><p class="label big">Define value:</p></td>
121
  <td></td>
122
  </tr>
@@ -124,7 +130,7 @@
124
  <tr class="disabled">
125
  <td class="alignright"><p class="label">Product price</p></td>
126
  <td>
127
- <input type="radio" checked>
128
  </td>
129
  </tr>
130
 
@@ -136,14 +142,20 @@
136
  </td>
137
  </tr>
138
 
139
- <tr class="disabled">
140
  <td class="alignright"><p class="label">Use Global value</p></td>
141
  <td>
142
- <input type="radio">
143
- <input type="text">
144
  </td>
145
  </tr>
146
 
 
 
 
 
 
 
147
  </table>
148
 
149
  <hr>
@@ -154,7 +166,7 @@
154
  <td colspan="2" class="narrow">
155
 
156
  <input type="checkbox" name="pys[woo][on_add_to_cart_btn]" value="1" class="woo-option"
157
- <?php echo pys_checkbox_state( 'woo', 'on_add_to_cart_btn' ); ?> >
158
  <strong>Enable AddToCart on add to cart button</strong>
159
 
160
  </td>
@@ -164,7 +176,7 @@
164
  <td colspan="2" class="narrow">
165
 
166
  <input type="checkbox" name="pys[woo][on_cart_page]" value="1" class="woo-option"
167
- <?php echo pys_checkbox_state( 'woo', 'on_cart_page' ); ?> >
168
  <strong>Enable AddToCart on cart page</strong>
169
 
170
  </td>
@@ -173,12 +185,12 @@
173
  <tr>
174
  <td></td>
175
  <td>
176
- <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
177
- <span class="help">add value and currency - Important for ROI measurement</span>
178
  </td>
179
  </tr>
180
 
181
- <tr class="disabled">
182
  <td class="alignright"><p class="label big">Define value:</p></td>
183
  <td></td>
184
  </tr>
@@ -186,7 +198,7 @@
186
  <tr class="disabled">
187
  <td class="alignright"><p class="label">Product price</p></td>
188
  <td>
189
- <input type="radio" checked>
190
  </td>
191
  </tr>
192
 
@@ -198,14 +210,20 @@
198
  </td>
199
  </tr>
200
 
201
- <tr class="disabled">
202
  <td class="alignright"><p class="label">Use Global value</p></td>
203
  <td>
204
- <input type="radio">
205
- <input type="text">
206
  </td>
207
  </tr>
208
 
 
 
 
 
 
 
209
  </table>
210
 
211
  <hr>
@@ -217,7 +235,7 @@
217
  <td colspan="2" class="narrow">
218
 
219
  <input type="checkbox" name="pys[woo][on_checkout_page]" value="1" class="woo-option"
220
- <?php echo pys_checkbox_state( 'woo', 'on_checkout_page' ); ?> >
221
  <strong>Enable InitiateCheckout on Checkout page</strong>
222
 
223
  </td>
@@ -226,12 +244,12 @@
226
  <tr>
227
  <td></td>
228
  <td>
229
- <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
230
- <span class="help">add value and currency - Important for ROI measurement</span>
231
  </td>
232
  </tr>
233
 
234
- <tr class="disabled">
235
  <td class="alignright"><p class="label big">Define value:</p></td>
236
  <td></td>
237
  </tr>
@@ -239,7 +257,7 @@
239
  <tr class="disabled">
240
  <td class="alignright"><p class="label">Products price (subtotal)</p></td>
241
  <td>
242
- <input type="radio" checked>
243
  </td>
244
  </tr>
245
 
@@ -251,14 +269,20 @@
251
  </td>
252
  </tr>
253
 
254
- <tr class="disabled">
255
  <td class="alignright"><p class="label">Use Global value</p></td>
256
  <td>
257
- <input type="radio">
258
- <input type="text">
259
  </td>
260
  </tr>
261
 
 
 
 
 
 
 
262
  </table>
263
 
264
  <hr>
@@ -270,7 +294,7 @@
270
  <td colspan="2" class="narrow">
271
 
272
  <input type="checkbox" name="pys[woo][on_thank_you_page]" value="1" class="woo-option"
273
- <?php echo pys_checkbox_state( 'woo', 'on_thank_you_page' ); ?> >
274
  <strong>Enable Purchase event on Thank You page</strong>
275
 
276
  </td>
@@ -279,12 +303,23 @@
279
  <tr>
280
  <td></td>
281
  <td>
282
- <input type="checkbox" disabled="disabled">Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
283
- <span class="help">add value and currency - <strong>Very important for ROI measurement</strong></span>
284
  </td>
285
  </tr>
 
 
 
 
 
 
 
 
 
 
 
286
 
287
- <tr class="disabled">
288
  <td class="alignright"><p class="label big">Define value:</p></td>
289
  <td></td>
290
  </tr>
@@ -301,7 +336,7 @@
301
  <tr class="disabled">
302
  <td class="alignright"><p class="label">Total</p></td>
303
  <td>
304
- <input type="radio" checked>
305
  </td>
306
  </tr>
307
 
@@ -313,14 +348,20 @@
313
  </td>
314
  </tr>
315
 
316
- <tr class="tall disabled">
317
  <td class="alignright"><p class="label">Use Global value</p></td>
318
  <td>
319
- <input type="radio" name="priced">
320
- <input type="text">
321
  </td>
322
  </tr>
323
 
 
 
 
 
 
 
324
  <tr>
325
  <td class="alignright"><p class="label big">Custom Audience Optimization:</p></td>
326
  <td>
@@ -331,7 +372,7 @@
331
  <tr class="disabled">
332
  <td class="alignright"></td>
333
  <td>
334
- <input type="checkbox" name="" value="1">
335
  <strong>Add Town, State and Country parameters</strong>
336
  <span class="help">Will pull <code>town</code>, <code>state</code> and <code>country</code></span>
337
 
@@ -341,7 +382,7 @@
341
  <tr class="disabled">
342
  <td></td>
343
  <td>
344
- <input type="checkbox" name="" value="1">
345
  <strong>Add Payment Method parameter</strong>
346
  <span class="help">Will pull <code>payment</code></span>
347
 
@@ -351,7 +392,7 @@
351
  <tr class="disabled">
352
  <td></td>
353
  <td>
354
- <input type="checkbox" name="" value="1">
355
  <strong>Add Shipping Method parameter</strong>
356
  <span class="help">Will pull <code>shipping</code></span>
357
  </td>
@@ -360,7 +401,7 @@
360
  <tr class="disabled">
361
  <td></td>
362
  <td>
363
- <input type="checkbox" name="" value="1">
364
  <strong>Add Coupons parameter</strong>
365
  <span class="help">Will pull <code>coupon_used</code> and <code>coupon_name</code></span>
366
  </td>
@@ -498,7 +539,7 @@
498
  </td>
499
  <td>
500
  <input type="checkbox" name="pys[woo][enabled]" value="1"
501
- <?php echo pys_checkbox_state( 'woo', 'enabled' ); ?> >
502
  </td>
503
  </tr>
504
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box">
10
  <div class="pys-col pys-col-full">
11
  <h2 class="section-title">WooCommerce Pixel Settings</h2>
17
  <tr class="tall">
18
  <td colspan="2" class="narrow">
19
  <input type="checkbox" class="woo-events-toggle"><strong>Enable Facebook Dynamic Product Ads</strong>
20
+ <span class="help">This will automatically add ViewContent on product pages, AddToCart on add to cart button click and cart page, InitiateCheckout on checkout page and Purchase on thank you page. The events will have the required <code>content_ids</code> and <code>content_type</code> parameters.</span>
21
  </td>
22
  </tr>
23
 
24
  <tr>
25
+ <td class="alignright"><p class="label">content_ids:</p></td>
26
  <td>
27
  <select name="pys[woo][content_id]">
28
  <option <?php selected( 'id', pys_get_option( 'woo', 'content_id' ) ); ?> value="id">Product ID</option>
63
  <span class="help">Product name will be pulled as <code>content_name</code>, and Product Category as <code>category_name</code> for all WooCommerce events.</span>
64
  <span class="help" style="margin-bottom: 20px;">The number of items is <code>num_items</code> for InitiateCheckout and Purchase events.</span>
65
 
66
+ <input type="checkbox" disabled>Track tags
67
  <span class="help">Will pull <code>tags</code> param on all WooCommerce events.</span>
68
 
69
 
84
 
85
  <p><strong>Important for Custom Audiences.</strong> Use this together with the General Event option.</p>
86
  <p>Learn how to <strong>Create Powerful Custom Audiences</strong> based on Events: <strong><a href="http://www.pixelyoursite.com/general-event" target="_blank">Click to Download Your Free Guide</a></strong></p>
 
87
  </td>
88
  <td>
89
 
90
  <p><strong>Unlock all the PRO features: <a href="http://www.pixelyoursite.com/facebook-pixel-plugin" target="_blank">Upgrade NOW</a></strong></p>
 
91
  </td>
92
  </tr>
93
 
101
  <tr class="tall">
102
  <td colspan="2" class="narrow">
103
  <input type="checkbox" name="pys[woo][on_view_content]" value="1" class="woo-option"
104
+ <?php pys_checkbox_state( 'woo', 'on_view_content' ); ?> >
105
  <strong>Enable ViewContent on Product Pages</strong>
106
  </td>
107
  </tr>
109
  <tr>
110
  <td class="alignright disabled"><p class="label">Delay</p></td>
111
  <td>
112
+ <input type="number" disabled> seconds - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
113
  <span class="help">Avoid retargeting bouncing users (It is better to add a lower time that the desired one because the pixel code will not load instantaneously). People that spent less time on the page will not be part of your Custom Audiences. You will not spend money retargeting them and your Lookalike Audiences will be more accurate.</span>
114
  </td>
115
  </tr>
117
  <tr>
118
  <td></td>
119
  <td>
120
+ <?php pys_checkbox( 'woo', 'enable_view_content_value' ); ?><?php _e( 'Enable Value', 'pys' ); ?>
121
+ <span class="help"><?php _e( 'Add value and currency - Important for ROI measurement', 'pys' ); ?></span>
122
  </td>
123
  </tr>
124
 
125
+ <tr>
126
  <td class="alignright"><p class="label big">Define value:</p></td>
127
  <td></td>
128
  </tr>
130
  <tr class="disabled">
131
  <td class="alignright"><p class="label">Product price</p></td>
132
  <td>
133
+ <input type="radio">
134
  </td>
135
  </tr>
136
 
142
  </td>
143
  </tr>
144
 
145
+ <tr>
146
  <td class="alignright"><p class="label">Use Global value</p></td>
147
  <td>
148
+ <input type="radio" checked>
149
+ <?php pys_text_field( 'woo', 'view_content_global_value' ); ?>
150
  </td>
151
  </tr>
152
 
153
+ <tr>
154
+ <td></td>
155
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
156
+ <strong>enable all value options</strong></td>
157
+ </tr>
158
+
159
  </table>
160
 
161
  <hr>
166
  <td colspan="2" class="narrow">
167
 
168
  <input type="checkbox" name="pys[woo][on_add_to_cart_btn]" value="1" class="woo-option"
169
+ <?php pys_checkbox_state( 'woo', 'on_add_to_cart_btn' ); ?> >
170
  <strong>Enable AddToCart on add to cart button</strong>
171
 
172
  </td>
176
  <td colspan="2" class="narrow">
177
 
178
  <input type="checkbox" name="pys[woo][on_cart_page]" value="1" class="woo-option"
179
+ <?php pys_checkbox_state( 'woo', 'on_cart_page' ); ?> >
180
  <strong>Enable AddToCart on cart page</strong>
181
 
182
  </td>
185
  <tr>
186
  <td></td>
187
  <td>
188
+ <?php pys_checkbox( 'woo', 'enable_add_to_cart_value' ); ?><?php _e( 'Enable Value', 'pys' ); ?>
189
+ <span class="help">Add value and currency - Important for ROI measurement</span>
190
  </td>
191
  </tr>
192
 
193
+ <tr>
194
  <td class="alignright"><p class="label big">Define value:</p></td>
195
  <td></td>
196
  </tr>
198
  <tr class="disabled">
199
  <td class="alignright"><p class="label">Product price</p></td>
200
  <td>
201
+ <input type="radio">
202
  </td>
203
  </tr>
204
 
210
  </td>
211
  </tr>
212
 
213
+ <tr>
214
  <td class="alignright"><p class="label">Use Global value</p></td>
215
  <td>
216
+ <input type="radio" checked>
217
+ <?php pys_text_field( 'woo', 'add_to_cart_global_value' ); ?>
218
  </td>
219
  </tr>
220
 
221
+ <tr>
222
+ <td></td>
223
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
224
+ <strong>enable all value options</strong></td>
225
+ </tr>
226
+
227
  </table>
228
 
229
  <hr>
235
  <td colspan="2" class="narrow">
236
 
237
  <input type="checkbox" name="pys[woo][on_checkout_page]" value="1" class="woo-option"
238
+ <?php pys_checkbox_state( 'woo', 'on_checkout_page' ); ?> >
239
  <strong>Enable InitiateCheckout on Checkout page</strong>
240
 
241
  </td>
244
  <tr>
245
  <td></td>
246
  <td>
247
+ <?php pys_checkbox( 'woo', 'enable_checkout_value' ); ?><?php _e( 'Enable Value', 'pys' ); ?>
248
+ <span class="help">Add value and currency - Important for ROI measurement</span>
249
  </td>
250
  </tr>
251
 
252
+ <tr>
253
  <td class="alignright"><p class="label big">Define value:</p></td>
254
  <td></td>
255
  </tr>
257
  <tr class="disabled">
258
  <td class="alignright"><p class="label">Products price (subtotal)</p></td>
259
  <td>
260
+ <input type="radio">
261
  </td>
262
  </tr>
263
 
269
  </td>
270
  </tr>
271
 
272
+ <tr>
273
  <td class="alignright"><p class="label">Use Global value</p></td>
274
  <td>
275
+ <input type="radio" checked>
276
+ <?php pys_text_field( 'woo', 'checkout_global_value' ); ?>
277
  </td>
278
  </tr>
279
 
280
+ <tr>
281
+ <td></td>
282
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
283
+ <strong>enable all value options</strong></td>
284
+ </tr>
285
+
286
  </table>
287
 
288
  <hr>
294
  <td colspan="2" class="narrow">
295
 
296
  <input type="checkbox" name="pys[woo][on_thank_you_page]" value="1" class="woo-option"
297
+ <?php pys_checkbox_state( 'woo', 'on_thank_you_page' ); ?> >
298
  <strong>Enable Purchase event on Thank You page</strong>
299
 
300
  </td>
303
  <tr>
304
  <td></td>
305
  <td>
306
+ <?php pys_checkbox( 'woo', 'enable_purchase_value' ); ?><?php _e( 'Enable Value', 'pys' ); ?>
307
+ <span class="help">Add value and currency - <strong>Very important for ROI measurement</strong></span>
308
  </td>
309
  </tr>
310
+
311
+ <tr>
312
+ <td class="alignright disabled"><p class="label"><?php _e( 'Fire the event on transaction only', 'pys' );
313
+ ?></p></td>
314
+ <td>
315
+ <select disabled>
316
+ <option><?php _e( 'Off', 'pys' ); ?></option>
317
+ </select>- <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
318
+ <span class="help"><?php _e( 'This will avoid the Purchase event to be fired when the order-received page is visited but no transaction has occurred. <b>It will improve conversion tracking.</b>', 'pys' ); ?></span>
319
+ </td>
320
+ </tr>
321
 
322
+ <tr>
323
  <td class="alignright"><p class="label big">Define value:</p></td>
324
  <td></td>
325
  </tr>
336
  <tr class="disabled">
337
  <td class="alignright"><p class="label">Total</p></td>
338
  <td>
339
+ <input type="radio">
340
  </td>
341
  </tr>
342
 
348
  </td>
349
  </tr>
350
 
351
+ <tr>
352
  <td class="alignright"><p class="label">Use Global value</p></td>
353
  <td>
354
+ <input type="radio" checked>
355
+ <?php pys_text_field( 'woo', 'purchase_global_value' ); ?>
356
  </td>
357
  </tr>
358
 
359
+ <tr class="tall">
360
+ <td></td>
361
+ <td><a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update to PRO</a> to
362
+ <strong>enable all value options</strong></td>
363
+ </tr>
364
+
365
  <tr>
366
  <td class="alignright"><p class="label big">Custom Audience Optimization:</p></td>
367
  <td>
372
  <tr class="disabled">
373
  <td class="alignright"></td>
374
  <td>
375
+ <input type="checkbox">
376
  <strong>Add Town, State and Country parameters</strong>
377
  <span class="help">Will pull <code>town</code>, <code>state</code> and <code>country</code></span>
378
 
382
  <tr class="disabled">
383
  <td></td>
384
  <td>
385
+ <input type="checkbox">
386
  <strong>Add Payment Method parameter</strong>
387
  <span class="help">Will pull <code>payment</code></span>
388
 
392
  <tr class="disabled">
393
  <td></td>
394
  <td>
395
+ <input type="checkbox">
396
  <strong>Add Shipping Method parameter</strong>
397
  <span class="help">Will pull <code>shipping</code></span>
398
  </td>
401
  <tr class="disabled">
402
  <td></td>
403
  <td>
404
+ <input type="checkbox">
405
  <strong>Add Coupons parameter</strong>
406
  <span class="help">Will pull <code>coupon_used</code> and <code>coupon_name</code></span>
407
  </td>
539
  </td>
540
  <td>
541
  <input type="checkbox" name="pys[woo][enabled]" value="1"
542
+ <?php pys_checkbox_state( 'woo', 'enabled' ); ?> >
543
  </td>
544
  </tr>
545
 
inc/html-tab-woo-red.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="pys-box pys-box-red">
2
  <div class="pys-col pys-col-narrow">
3
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ ?>
8
+
9
  <div class="pys-box pys-box-red">
10
  <div class="pys-col pys-col-narrow">
11
 
inc/migrate.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
  /**
3
  * Allow to migrate old settings format without data lost.
4
  * @since 3.0.0
1
  <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
  /**
8
  * Allow to migrate old settings format without data lost.
9
  * @since 3.0.0
js/admin.js CHANGED
@@ -41,4 +41,35 @@ jQuery(function($){
41
 
42
  });
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }); /* Dom Loaded */
41
 
42
  });
43
 
44
+ /**
45
+ * EDD events toggle
46
+ * Set main switcher state on page load.
47
+ */
48
+ if ($('.edd-option').length == $('.edd-option:checked').length) {
49
+ $('.edd-events-toggle').prop('checked', 'checked');
50
+ }
51
+
52
+ /**
53
+ * EDD events toggle
54
+ * Add multiple select / deselect functionality.
55
+ */
56
+ $('.edd-events-toggle').click(function () {
57
+ var options = $('.edd-option');
58
+ options.prop('checked', this.checked);
59
+ });
60
+
61
+ /**
62
+ * EDD events toggle
63
+ * If all checkboxes are selected, check the main checkbox and vice versa.
64
+ */
65
+ $('.edd-option').click(function () {
66
+
67
+ if ($('.edd-option').length == $('.edd-option:checked').length) {
68
+ $('.edd-events-toggle').prop('checked', 'checked');
69
+ } else {
70
+ $('.edd-events-toggle').removeAttr('checked');
71
+ }
72
+
73
+ });
74
+
75
  }); /* Dom Loaded */
js/public.js CHANGED
@@ -23,6 +23,37 @@ jQuery(document).ready(function( $ ) {
23
 
24
  });
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * Process Init, General, Search, Standard (except custom code), WooCommerce (except AJAX AddToCart, Affiliate and
28
  * PayPal events. In case if delay param is present - event will be fired after desired timeout.
23
 
24
  });
25
 
26
+ // EDD AddToCart
27
+ $('.edd-add-to-cart').click(function () {
28
+
29
+ try {
30
+
31
+ // extract pixel event ids from classes like 'pys-event-id-{UNIQUE ID}'
32
+ var classes = $.grep(this.className.split(" "), function (element, index) {
33
+ return element.indexOf('pys-event-id-') === 0;
34
+ });
35
+
36
+ // verify that we have at least one matching class
37
+ if (typeof classes == 'undefined' || classes.length == 0) {
38
+ return;
39
+ }
40
+
41
+ // extract event id from class name
42
+ var regexp = /pys-event-id-(.*)/;
43
+ var event_id = regexp.exec(classes[0]);
44
+
45
+ if (event_id == null) {
46
+ return;
47
+ }
48
+
49
+ evaluateEventByID(event_id[1], pys_edd_ajax_events);
50
+
51
+ } catch (e) {
52
+ console.log(e);
53
+ }
54
+
55
+ });
56
+
57
  /**
58
  * Process Init, General, Search, Standard (except custom code), WooCommerce (except AJAX AddToCart, Affiliate and
59
  * PayPal events. In case if delay param is present - event will be fired after desired timeout.
readme.txt CHANGED
@@ -1,26 +1,32 @@
1
- ===Facebook Pixel by PixelYourSite - Standard Events & WooCommerce===
2
  Contributors: PixelYourSite, c0d3fev3r, 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, Facebook Pixel PayPal
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
- Stable tag: 4.0.3
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
- Insert the new Facebook Pixel on WordPress, add Standard Events, enjoy superb WooCommerce Facebook Pixel integration
11
 
12
  == Description ==
13
- <strong>Manage the New Facebook Pixel With Just a Few Clicks</strong></br>
14
 
15
- As you probably know, Facebook will retire the old Facebook Conversion Pixel in 2016. They recommend us to use the New Facebook Pixel for conversion tracking, optimization and remarketing.
16
 
17
- >**PixelYourSite will help you insert the pixel code on every page with just one click** and set up Custom or Standard Events. There is **out of the box WooCommerce setup** that will configure all the necessary standard events for you.
 
 
 
 
 
 
18
  >
19
- >**Facebook Dynamic Ads is fully supported for WooCommerce**, with ViewContent, AddToCart and Purchase events being added on the corresponding pages (content_ids and content_type are pulled automatically by the plugin).
20
  >
21
  >The plugin is **Custom Audience Super-Friendly**, extracting content_name, post_type, content_ids, content_category on every page of your site. Tags and product tags are tracked by the pro version of the plugin.
22
 
23
- You’ll find a **[Learning Section](http://www.pixelyoursite.com/learn)** on our website, with helpful articles that answer to our users common (and sometimes uncommon) questions, together with top notch “how to”pages.
24
 
25
  Find more info [about how to use the FB pixel plugin - Click here](http://www.pixelyoursite.com/facebook-pixel-plugin-help)
26
 
@@ -34,62 +40,146 @@ Not ready to install yet? Read on some of the key features that make PYS a power
34
 
35
  * **Search Event** on the search page with the search string pulled as parameter - super useful for creating search based Custom Audiences
36
 
 
 
 
 
 
 
 
 
37
  * You can turn ON/OFF the pixel based on user roles (remove it for admins, editors and so on)
38
 
39
  * You can **set up and track Standard or Custom Events** and add parameters for each of them
40
 
41
- * **Delay Events**, so you don't spend your money on retargeting bouncing visitors
42
-
43
  * All the events will have a **domain name parameter**, so you can easily create Custom Audiences from events when you have more than one site
44
 
45
- * **Traffic Source and URL tags (UTM)** are added to all the events and you can use them to create Custom Audiences based on where your visitors are coming from. It is possible to track a particular Facebook Ad too. ([Pro Version](http://www.pixelyoursite.com))
46
 
47
- * **Dynamic Events:** optimize your Facebook Campaigns for actions on your website (CLICKS on links, buttons, forms, page scroll or mouse over). Works with **Contact Form 7 and any other form or pop-up plugins.** ([Pro Version](http://www.pixelyoursite.com))
 
 
48
 
49
- * Track **conversion value** for standard and custom events
50
 
51
- * Track tags and use them for Custom Audiences ([Pro Version](http://www.pixelyoursite.com))
 
 
 
 
 
 
 
 
 
52
 
53
- * Enable **Advanced Matching** - this new FB feature increases the chances to correctly identify users visiting your website without being logged to their Facebook accounts ([Pro Version](http://www.pixelyoursite.com))
54
 
55
- * We automatically add a TimeOnPage event that measures the time each visitor spends on every page. It can be used for Custom Audiences and is super useful when you have key pages with offers or video content. You'll find an article on our site about how to use this feature. ([Pro Version](http://www.pixelyoursite.com))
56
 
57
- > <strong>How to create powerful Custom Audiences with PixelyourSite</strong>
58
 
59
- > You can use the General Event option to create powerful Custom Audiences based on events (Custom Combination).
60
 
61
- > Because this is such a useful feature, we made a special guide that you can download for free: [Click here for the guide](http://www.pixelyoursite.com/general-event)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  <strong>Superb WooCommerce Integration</strong><br>
64
 
65
  * You can **insert the Facebook pixel and start tracking events on any WooCommerce** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
66
 
67
- * Out of the box **Facebook Dynamic Ads** pixel setup for your Woocommerce website (we also have a dedicated feed plugin for Facebook Dynamic Ads Product Catalog)
68
 
69
  * **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
70
 
71
- * **Track conversion value for WooCommerce** ([Pro Version](http://www.pixelyoursite.com))
72
 
73
- * **WooCommerce Conversion Value Optimization:** You can include or exclude TAX for all the WooCommere events and Shipping cost for the Purchase event. You can use the full product price or just a percent of the price for each event Value. You can also set a general value for each event. ([Pro Version](http://www.pixelyoursite.com))
74
 
75
  * You can turn ON/OFF each WooCommerce event.
76
 
77
  * You can turn ON/OFF value for each WooCommerce event.
78
 
79
- * Delay the WooCommerce ViewContent Event, so you don't spend your money on retargeting bouncing visitors ([Pro Version](http://www.pixelyoursite.com))
80
 
81
- * **Super-Powerful Custom Audiences for WooCommerce:** we automatically track product name and product category (you can create audiences based on them), together with customer's city, state, and country. Additionally, we track payment and shipping methods. Use of coupons and coupon names are also automatically extracted. With this data, you can unleash some fantastic retargeting campaigns based on highly granulated audiences. ([Pro Version](http://www.pixelyoursite.com))
82
 
83
- * **Advance Matching** is supported for all the events - this is a useful feature from Facebook that increases the chances to correctly identify users visiting your website without being logged to their Facebook accounts. Not sure what "Advanced Matching" does? We have not one, but two articles with more details on our site. ([Pro Version](http://www.pixelyoursite.com))
84
 
85
- * **Track product tags** for all the events and use them to built Custom Audiences ([Pro Version](http://www.pixelyoursite.com))
86
 
87
- * **WooCommerce Affiliate Products Events:** you can add a dynamic event that will trigger on affiliate button clicks ([Pro Version](http://www.pixelyoursite.com))
 
 
 
88
 
89
- * **WooCommerce PayPal Standard Events:** you can add a dynamic AddPaymentInfo event that will trigger on WooCommerce PayPal button clicks ([Pro Version](http://www.pixelyoursite.com))
 
 
 
 
 
 
90
 
91
  * Fully tested with the latest version of WooCommerce
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  <strong>What's next<strong>
94
 
95
  We are working on some new handy features for the plugin and we will release them soon.
@@ -100,13 +190,12 @@ If you are testing your pixel with Pixel Helper Chrome Extension, it is possible
100
 
101
  **Facebook Pixel can't match products**
102
 
103
- It means that the product ID is not found in a Dynamic Ads Product Catalog. If you are not doing Dynamic Ads, or if that event is not Dynamic Ads related, then you are fine. Otherwise, check your product catalog feed and make sure that that id is present in there.
104
 
105
  For more details on how to use Facebook Pixel Helper and how to interpret its reported errors [read this special Pixel Helper article](http://www.pixelyoursite.com/facebook-pixel-helper-errors)
106
 
107
  **Let’s start now!** Join other thousands of users and install the plugin, because it is easy to use, and will help you with your Facebook campaigns for real
108
 
109
-
110
  == Installation ==
111
  * From the WP admin panel, click \"Plugins\" -> \"Add new\".
112
  * In the browser input box, type \"PixelYourSite\".
@@ -125,7 +214,7 @@ OR...
125
 
126
  * Download the plugin from this page.
127
  * Extract the .zip file to a location on your computer.
128
- * Use either FTP or your hosts cPanel to gain access to your website file directories.
129
  * Browse to the `wp-content/plugins` directory.
130
  * Upload the extracted `wp_edit` folder to this directory location.
131
  * Open the WP admin panel.. click the \"Plugins\" page.. and click \"Activate\" under the newly added plugin.
@@ -153,7 +242,7 @@ a. The pixel code will be added on every page of your site
153
 
154
  b. A "Search" standard event will be added to the search page of your site
155
 
156
- c. A GeneralEvent will be added on every page, pulling content_name, content_ids and content_type. It can be used for Custom Audiences.
157
 
158
  **What happens when I activate the WooCommerce Setup?**
159
 
@@ -203,6 +292,12 @@ We have an article about how to optimize Facebook Ads Reports:
203
 
204
  == Changelog ==
205
 
 
 
 
 
 
 
206
  = PixelYourSite 4.0.3 =
207
 
208
  * Important security updates
@@ -223,7 +318,7 @@ We have an article about how to optimize Facebook Ads Reports:
223
 
224
  * Delay Event option added for the GeneralEvent
225
 
226
- * Head/Footer option - you can decide where the pixel JS will be called. The default setting is in head.
227
 
228
  * Various text changes to reflect the new pro features
229
 
@@ -259,7 +354,7 @@ We have an article about how to optimize Facebook Ads Reports:
259
 
260
  = PixelYourSite 3.0 =
261
 
262
- This is a major release, with new design and new features:
263
 
264
  * Completely new design
265
 
@@ -343,6 +438,6 @@ This is a major release, with new design and new features:
343
 
344
  == Upgrade Notice ==
345
 
346
- = 4.0.3 =
347
 
348
- Version 4.0.3 has some important security improvements and it's recommended to update right now.
1
+ ===Facebook Pixel by PixelYourSite - Events, WooCommerce & Easy Digital Downloads===
2
  Contributors: PixelYourSite, c0d3fev3r, 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 Facebook Pixel
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
+ Stable tag: 5.0.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
+ Insert the new Facebook Pixel on WordPress, add Events, enjoy superb WooCommerce & EDD Facebook Pixel integration
11
 
12
  == Description ==
13
+ <strong>Manage the New Facebook Pixel With Just a Few Clicks. WooCommerce and Easy Digital Downloads integration.</strong></br>
14
 
15
+ The New Facebook Pixel can be a very powerful tool for anyone doing Facebook ads, and with the PixelYourSite plugin, you can unleash its real potential.
16
 
17
+ **Take a look at this video to see the plugin in action:**
18
+
19
+ [youtube https://www.youtube.com/watch?v=V_IWVxUrzSM]
20
+
21
+ >**PixelYourSite will help you insert the Facebook pixel code on every page of your site with just one click** and set up Custom or Standard Events.
22
+
23
+ >There is an automatic **WooCommerce and Easy Digital Downloads setup** that will configure all the necessary standard events for you. **You don't have to add any event yourself.**
24
  >
25
+ >**Facebook Dynamic Ads (Promote a product catalog) is fully supported for WooCommerce and Easy Digital Downloads**, with ViewContent, AddToCart and Purchase events being added on the corresponding pages (content_ids and content_type are pulled automatically by the plugin).
26
  >
27
  >The plugin is **Custom Audience Super-Friendly**, extracting content_name, post_type, content_ids, content_category on every page of your site. Tags and product tags are tracked by the pro version of the plugin.
28
 
29
+ You’ll find a **[Learning Section](http://www.pixelyoursite.com/learn)** on our website, with helpful articles that answer to our users common (and sometimes uncommon) questions, together with top notch “how to” pages.
30
 
31
  Find more info [about how to use the FB pixel plugin - Click here](http://www.pixelyoursite.com/facebook-pixel-plugin-help)
32
 
40
 
41
  * **Search Event** on the search page with the search string pulled as parameter - super useful for creating search based Custom Audiences
42
 
43
+ >**How to use the Search Event:**
44
+ >
45
+ Retargeting the users that performed a search on your site is a smart strategy because this is a highly engaged audience that knows you and it's interested in what you offer.
46
+ >
47
+ >It can be a good idea to go a little further and create Custom Audiences based on a few important keywords that potential buyers might search for.
48
+
49
+ * **Delay Events**, so you don't spend your money on retargeting bouncing visitors.
50
+
51
  * You can turn ON/OFF the pixel based on user roles (remove it for admins, editors and so on)
52
 
53
  * You can **set up and track Standard or Custom Events** and add parameters for each of them
54
 
 
 
55
  * All the events will have a **domain name parameter**, so you can easily create Custom Audiences from events when you have more than one site
56
 
57
+ * **Traffic Source and URL tags (UTM)** are added to all the events and you can use them to create Custom Audiences based on where your visitors are coming from. It is possible to track a particular Facebook Ad too. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
58
 
59
+ >You can create Custom Audiences based on where the traffic is coming from, like Google, Facebook or a particular referer.
60
+ >
61
+ >Additionally, if you are using URL parameters they will be tracked and added as parameters for all your events. This is extremely useful because you can create Custom Audiences from people coming from a particular ad or campaign, for example.
62
 
63
+ * **Dynamic Events:** optimize your Facebook Campaigns for actions on your website (CLICKS on links, buttons, forms, page scroll or mouse over). Works with **almost all forms or pop-up plugins.** ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
64
 
65
+ >Fire a Dynamic Event when the visitor performs a key action on your site and optimize your ads for that event (perfect for affiliate sites, newsletter signups and so on).
66
+ >
67
+ >Additionally, you can create Custom Audiences based on dynamic events. These are people with a high interest in your products or offers and you can retarget them successfully.
68
+ >
69
+ >With PixelYourSite PRO you can fire Dynamic Events:
70
+ >
71
+ >* When a URL is clicked
72
+ >* When a CSS element is clicked (any form button, for example)
73
+ >* When the mouse is moved over a page element
74
+ >* On page scroll (scroll percent).
75
 
 
76
 
77
+ * Track **conversion value** for standard and custom events
78
 
79
+ * Track tags and use them for Custom Audiences ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
80
 
81
+ * Enable **Advanced Matching** - this new FB feature increases the chances to correctly identify users visiting your website without being logged to their Facebook accounts. The plugin will automatically send to Facebook the data you have about the visitors. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
82
 
83
+ >**What's the deal with the GeneralEvent**
84
+ >
85
+ >The plugin will fire a GeneralEvent that can be used in two different ways:
86
+ >
87
+ >**1. Custom Audiences** - you can create Custom Audiences using Website Trafic > Custom Combination > Event. From here you can select the GeneralEvent and add the desired parameters.
88
+ >
89
+ >The GeneralEvent will have the following parameters:
90
+ >
91
+ >* post_id
92
+ >* post_type (it will pull the WordPress post type, like post, category and so on)
93
+ >* content_category (for posts, it will show the post category)
94
+ >* domain (it will pull the domain name - useful if you are using the pixel on more than one sites)
95
+ >* tags - pro version
96
+ >
97
+ >**How to use the GeneralEvent for Custom Audiences**
98
+ >
99
+ >**Example:** you can create a Custom Audience from people that viewed articles from one specific category in the last 30 days or people that visited articles having one or more tags, a particular page (using the name or the ID), or content that has a particular word in the name.
100
+ >
101
+ >
102
+ >**2. Custom Conversions** - similar to Custom Audiences, you can create Custom Conversions based on the GeneralEvent.
103
+ >
104
+ >**Example:** You can define a Custom Conversion when someone reads at least 3 articles from a particular category, or when it lands on a specific page, or on any article that has a particular tag.
105
+ >
106
+ >
107
+ >Because this is such a useful feature, we made a special guide that you can download for free: [Click here for the guide](http://www.pixelyoursite.com/general-event)
108
 
109
  <strong>Superb WooCommerce Integration</strong><br>
110
 
111
  * You can **insert the Facebook pixel and start tracking events on any WooCommerce** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
112
 
113
+ * Out of the box **Facebook Dynamic Ads** (promote a product catalog) pixel setup for your Woocommerce website (we also have a dedicated feed plugin for Facebook Dynamic Ads Product Catalog)
114
 
115
  * **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
116
 
117
+ * **Track conversion value for WooCommerce** ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
118
 
119
+ * **WooCommerce Conversion Value Optimization:** You can include or exclude TAX for all the WooCommere events and Shipping cost for the Purchase event. You can use the full product price or just a percent of the price for each event Value. You can also set a general value for each event. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
120
 
121
  * You can turn ON/OFF each WooCommerce event.
122
 
123
  * You can turn ON/OFF value for each WooCommerce event.
124
 
125
+ * Set up a general value for each WooCommerce event.
126
 
127
+ * Delay the WooCommerce ViewContent Event, so you don't spend your money on retargeting bouncing visitors ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
128
 
129
+ * **Super-Powerful Custom Audiences for WooCommerce:** - we automatically track product name, product category and product tags. You can use them to create highly targeted Custom Audiences for improved retargeting campaigns. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
130
 
131
+ * **Improved Purchase Event** - The purchase event will have payment and shipping methods, client city, state and country, plus use of coupons and coupons names tracked as parameters. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
132
 
133
+ >With the Improved Purchased Event you can create extremely useful Custom Audiences and retarget them with highly efficient ads.
134
+ >Example: Clients that bought products from category X for at least $100 and that never used coupon ABC.
135
+ >
136
+ >Retargeting this audience with products from the same or similar category and give them the coupon ABC might be a winning strategy.
137
 
138
+ * **Advance Matching** is supported for all the events - this is a useful feature from Facebook that increases the chances to correctly identify users visiting your website without being logged to their Facebook accounts. Not sure what "Advanced Matching" does? We have not one, but two articles with more details on our site. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
139
+
140
+ >With Advanced Matching ON, the plugin will send to Facebook the data you have about your clients, like their names, address, email or phone, improving conversion attribution and retargeting
141
+
142
+ * **WooCommerce Affiliate Products Events:** you can add a dynamic event that will trigger on affiliate button clicks ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
143
+
144
+ * **WooCommerce PayPal Standard Events:** you can add a dynamic AddPaymentInfo event that will trigger on WooCommerce PayPal button clicks ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
145
 
146
  * Fully tested with the latest version of WooCommerce
147
 
148
+ <strong>Easy Digital Downloads Integration<strong>
149
+
150
+ * You can **insert the Facebook pixel and start tracking events on any Easy Digital Downloads** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
151
+
152
+ * Out of the box **Facebook Dynamic Ads** (promote a product catalog) pixel setup for your Easy Digital Downloads website.
153
+
154
+ * **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
155
+
156
+ * **Track conversion value for Easy Digital Downloads** ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
157
+
158
+ * **Easy Digital Downloads Conversion Value Optimization:** You can include or exclude TAX for all the Easy Digital Downloads events. You can use the full product price or just a percent of the price for each event Value. You can also set a general value for each event. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
159
+
160
+ * You can turn ON/OFF each Easy Digital Downloads event.
161
+
162
+ * You can turn ON/OFF value for each Easy Digital Downloads event.
163
+
164
+ * Set up a general value for each Easy Digital Downloads event.
165
+
166
+ * Delay the Easy Digital Downloads ViewContent Event, so you don't spend your money on retargeting bouncing visitors ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
167
+
168
+ * **Super-Powerful Custom Audiences for Easy Digital Downloads:** - we automatically track download name, download category, and download tags. You can use them to create highly targeted Custom Audiences for improved retargeting campaigns. Transaction day, month and year are also tracked as parameters, together with transaction type (free or paid). ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
169
+
170
+ * **EDD License Software* integration: license version and license time limit are added as parameters, giving you the possibility to split your custom audiences based on this info.
171
+
172
+ * **Improved Purchase Event** - The purchase event will have payment methods, client's city, state and country, plus use of discount codes and the discount codes names tracked as parameters. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
173
+
174
+ >With the Improved Purchased Event you can create extremely useful Custom Audiences and retarget them with highly efficient ads.
175
+ >Example: Clients that bought download X for and that never used the discount code ABC.
176
+ >
177
+ >Retargeting this audience with downloads from a similar category and giving them the discount code ABC might be a winning strategy.
178
+
179
+ * **Advance Matching** is supported for all the events - this is a useful feature that increases the chances to correctly identify users visiting your website without being logged to their Facebook accounts. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
180
+
181
+ >With Advanced Matching ON, the plugin will send to Facebook the data you have about your clients, like their names, address, email or phone, improving conversion attribution and retargeting results.
182
+
183
  <strong>What's next<strong>
184
 
185
  We are working on some new handy features for the plugin and we will release them soon.
190
 
191
  **Facebook Pixel can't match products**
192
 
193
+ It means that the product ID is not found in a Dynamic Ads Product Catalog. If you are not doing Dynamic Ads, or if that event is not Dynamic Ads related, then you are fine. Otherwise, check your product catalog feed and make sure that the product ID is present in there.
194
 
195
  For more details on how to use Facebook Pixel Helper and how to interpret its reported errors [read this special Pixel Helper article](http://www.pixelyoursite.com/facebook-pixel-helper-errors)
196
 
197
  **Let’s start now!** Join other thousands of users and install the plugin, because it is easy to use, and will help you with your Facebook campaigns for real
198
 
 
199
  == Installation ==
200
  * From the WP admin panel, click \"Plugins\" -> \"Add new\".
201
  * In the browser input box, type \"PixelYourSite\".
214
 
215
  * Download the plugin from this page.
216
  * Extract the .zip file to a location on your computer.
217
+ * Use either FTP or your host's cPanel to gain access to your website file directories.
218
  * Browse to the `wp-content/plugins` directory.
219
  * Upload the extracted `wp_edit` folder to this directory location.
220
  * Open the WP admin panel.. click the \"Plugins\" page.. and click \"Activate\" under the newly added plugin.
242
 
243
  b. A "Search" standard event will be added to the search page of your site
244
 
245
+ c. A GeneralEvent will be added on every page, pulling content_name, content_ids, and content_type. It can be used for Custom Audiences.
246
 
247
  **What happens when I activate the WooCommerce Setup?**
248
 
292
 
293
  == Changelog ==
294
 
295
+ = PixelYourSite 5.0 =
296
+
297
+ * Easy Digital Downloads Integration - Dynamic Ads (promote a product catalog) are fully supported.
298
+
299
+ * WooCommerce & Easy Digital Downloads events global value.
300
+
301
  = PixelYourSite 4.0.3 =
302
 
303
  * Important security updates
318
 
319
  * Delay Event option added for the GeneralEvent
320
 
321
+ * Head/Footer option - you can decide where the pixel JS will be called. The default setting is in the page head.
322
 
323
  * Various text changes to reflect the new pro features
324
 
354
 
355
  = PixelYourSite 3.0 =
356
 
357
+ This is a major release, with a new design and new features:
358
 
359
  * Completely new design
360
 
438
 
439
  == Upgrade Notice ==
440
 
441
+ = 5.0 =
442
 
443
+ Version 5.0 comes with full Easy Digital Downloads integrations plus the ability to give each WooCommerce and EDD event a global value.