Version Description
3.0 is a complete rewrite, with a new design and improve functionality. You have a new GeneralEvent that can be used to create Custom Audiences (plus a FREE guide on how to do it!) and Facebook Dynamic Ads are fully supported for WooCommerce. Update, then open the plugin menu for details
Download this release
Release Info
Developer | PixelYourSite |
Plugin | PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.7 to 3.0
- css/admin.css +273 -194
- facebook-pixel-master.php +98 -121
- img/logo.png +0 -0
- inc/admin_notices.php +23 -47
- inc/ajax-standard.php +261 -0
- inc/common.php +1459 -0
- inc/core.php +151 -0
- inc/html-admin.php +94 -0
- inc/html-box-bottom.php +14 -0
- inc/html-box-middle.php +23 -0
- inc/html-box-top-dynamic.php +13 -0
- inc/html-box-top-general.php +10 -0
- inc/html-box-top-post-event.php +13 -0
- inc/html-box-top-woo.php +13 -0
- inc/html-offer-content.php +22 -0
- inc/html-tab-dynamic-events-general.php +44 -0
- inc/html-tab-dynamic-events-list.php +25 -0
- inc/html-tab-pixel-activate.php +18 -0
- inc/html-tab-pixel-general.php +166 -0
- inc/html-tab-pixel-id.php +17 -0
- inc/html-tab-std-add-event.php +10 -0
- inc/html-tab-std-event-general.php +21 -0
- inc/html-tab-std-event-list.php +67 -0
- inc/html-tab-woo-general.php +507 -0
- inc/html-tab-woo-red.php +23 -0
- inc/migrate.php +72 -0
- js/admin.js +93 -388
- js/public.js +9 -108
- readme.txt +125 -73
css/admin.css
CHANGED
@@ -1,286 +1,365 @@
|
|
1 |
-
|
2 |
-
|
3 |
}
|
4 |
|
|
|
|
|
|
|
5 |
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
.
|
9 |
-
|
10 |
-
|
11 |
-
width: auto;
|
12 |
-
border: 1px solid #d3d3d3;
|
13 |
-
padding: 0 10px;
|
14 |
}
|
15 |
|
16 |
-
.
|
|
|
|
|
|
|
17 |
|
18 |
-
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
-
|
22 |
-
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
|
29 |
-
.
|
30 |
-
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
font-weight: normal;
|
36 |
-
margin-top: 2px;
|
37 |
-
padding: 1px 6px;
|
38 |
-
display: block;
|
39 |
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
line-height: 1.3;
|
44 |
-
padding: 10px 0px 10px 0;
|
45 |
-
text-align: left;
|
46 |
-
vertical-align: top;
|
47 |
-
width: 170px;
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
.
|
56 |
-
|
57 |
-
position: relative;
|
58 |
}
|
59 |
|
|
|
|
|
|
|
60 |
|
61 |
-
.
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
display: inline-block;
|
66 |
-
font-size: 14px;
|
67 |
-
font-weight: bold;
|
68 |
-
height: 16px;
|
69 |
-
line-height: 16px;
|
70 |
-
margin-right: 10px;
|
71 |
-
padding: 4px 2px;
|
72 |
-
position: relative;
|
73 |
-
text-align: center;
|
74 |
-
width: 20px;
|
75 |
}
|
76 |
|
77 |
-
.
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
font-size: 11px;
|
83 |
-
height: 200px;
|
84 |
-
margin: 8px 5px 0 10px;
|
85 |
-
overflow-y: scroll;
|
86 |
-
padding: 5px 0;
|
87 |
-
position: absolute;
|
88 |
-
top: 0;
|
89 |
-
width: 300px;
|
90 |
-
z-index: 99;
|
91 |
-
font-weight: normal;
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
-
.
|
|
|
|
|
|
|
99 |
display: block;
|
|
|
100 |
}
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
color: #00a0d2;
|
106 |
-
float: left;
|
107 |
-
font-size: 12px;
|
108 |
-
width: 100%;
|
109 |
}
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
-
.
|
121 |
-
|
122 |
-
|
123 |
-
font-size: 12px;
|
124 |
-
width: 120px;
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
-
.
|
129 |
-
|
|
|
|
|
130 |
}
|
131 |
|
132 |
-
.
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
-
|
142 |
-
|
143 |
}
|
144 |
|
|
|
|
|
|
|
145 |
|
146 |
-
.
|
|
|
|
|
|
|
147 |
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
|
|
|
|
|
153 |
}
|
154 |
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
157 |
}
|
158 |
|
159 |
-
|
160 |
-
|
|
|
|
|
161 |
}
|
162 |
|
163 |
-
.
|
164 |
-
|
165 |
}
|
166 |
|
167 |
-
/*
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
180 |
|
|
|
|
|
|
|
|
|
181 |
|
182 |
-
|
|
|
|
|
|
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
cursor: pointer;
|
189 |
-
|
190 |
-
-moz-border-bottom-colors: none;
|
191 |
-
-moz-border-left-colors: none;
|
192 |
-
-moz-border-right-colors: none;
|
193 |
-
-moz-border-top-colors: none;
|
194 |
-
border-top-color: none;
|
195 |
-
border-bottom-color: none;
|
196 |
-
border-left-color: none;
|
197 |
-
border-right-color: none;
|
198 |
|
199 |
-
|
200 |
-
border-color: #ccc #ccc -moz-use-text-color;
|
201 |
-
border-image: none;
|
202 |
-
border-style: solid solid none;
|
203 |
-
border-width: 1px 1px medium;
|
204 |
-
color: #555;
|
205 |
-
margin: -4px 4px -1px 0;
|
206 |
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
|
|
|
|
|
|
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
color: #464646;
|
213 |
}
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
line-height: 24px;
|
219 |
-
padding: 6px 10px;
|
220 |
-
display: inline-block;
|
221 |
-
cursor: pointer;
|
222 |
-
-moz-border-bottom-colors: none;
|
223 |
-
-moz-border-left-colors: none;
|
224 |
-
-moz-border-right-colors: none;
|
225 |
-
-moz-border-top-colors: none;
|
226 |
-
border-top-color: none;
|
227 |
-
border-bottom-color: none;
|
228 |
-
border-left-color: none;
|
229 |
-
border-right-color: none;
|
230 |
-
border-image: none;
|
231 |
-
margin: -4px 4px -1px 0;
|
232 |
|
|
|
|
|
233 |
}
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
color: #000;
|
239 |
}
|
240 |
|
|
|
|
|
|
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
font-size: 14px;
|
245 |
}
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
250 |
font-weight: bold;
|
251 |
-
font-size: 11px;
|
252 |
}
|
253 |
|
254 |
-
.
|
255 |
-
|
256 |
-
text-align: center;
|
257 |
-
width: 300px;
|
258 |
-
padding: 10px 0;
|
259 |
}
|
260 |
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
font-size:
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
}
|
279 |
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
width: 98%;
|
284 |
}
|
285 |
|
286 |
-
|
|
|
|
|
|
1 |
+
.wrap {
|
2 |
+
margin-top: 25px;
|
3 |
}
|
4 |
|
5 |
+
.disabled {
|
6 |
+
pointer-events: none;
|
7 |
+
}
|
8 |
|
9 |
+
.pys-btn.disabled,
|
10 |
+
table.disabled {
|
11 |
+
opacity: 0.6;
|
12 |
+
}
|
13 |
|
14 |
+
tr.disabled,
|
15 |
+
form.disabled {
|
16 |
+
opacity: 0.6;
|
17 |
+
pointer-events: none;
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
+
.aligncenter {
|
21 |
+
display: block !important;
|
22 |
+
margin: 0 auto;
|
23 |
+
}
|
24 |
|
25 |
+
.pys-logo {
|
26 |
+
background: url('../img/logo.png') no-repeat;
|
27 |
+
width: 261px;
|
28 |
+
height: 58px;
|
29 |
}
|
30 |
|
31 |
+
a {
|
32 |
+
color: #F4524D;
|
33 |
}
|
34 |
|
35 |
+
a:hover {
|
36 |
+
color: #F4524D;
|
37 |
}
|
38 |
|
39 |
+
a.big {
|
40 |
+
font-size: 24px;
|
41 |
}
|
42 |
|
43 |
+
h2 {
|
44 |
+
margin-top: 0;
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
+
hr {
|
48 |
+
margin: 25px 0;
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
+
code {
|
52 |
+
padding: 1px 4px;
|
53 |
}
|
54 |
|
55 |
+
.pys-list pre {
|
56 |
+
margin-top: 0;
|
57 |
+
|
58 |
+
white-space: pre-wrap; /* CSS 3 */
|
59 |
+
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
60 |
+
white-space: -pre-wrap; /* Opera 4-6 */
|
61 |
+
white-space: -o-pre-wrap; /* Opera 7 */
|
62 |
+
word-wrap: break-word;
|
63 |
+
}
|
64 |
|
65 |
+
.pys-rating {
|
66 |
+
text-align: center;
|
|
|
67 |
}
|
68 |
|
69 |
+
.pys-content {
|
70 |
+
margin: -1px 0 15px;
|
71 |
+
}
|
72 |
|
73 |
+
ul.dashed {
|
74 |
+
list-style: none;
|
75 |
+
margin-left: 0;
|
76 |
+
padding-left: 1.5em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
+
ul.dashed > li:before {
|
80 |
+
display: inline-block;
|
81 |
+
content: "\2014\a0";
|
82 |
+
width: 1.5em;
|
83 |
+
margin-left: -1.5em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
+
|
86 |
+
/* nav menu */
|
87 |
+
|
88 |
+
.pys-menu {
|
89 |
+
overflow: hidden;
|
90 |
+
clear: both;
|
91 |
+
margin-bottom: 0;
|
92 |
}
|
93 |
|
94 |
+
.pys-menu .nav-tab {
|
95 |
+
border-top-left-radius: 5px;
|
96 |
+
border-top-right-radius: 5px;
|
97 |
+
cursor: pointer;
|
98 |
display: block;
|
99 |
+
margin-bottom: 0;
|
100 |
}
|
101 |
|
102 |
+
.pys-menu .nav-tab-active {
|
103 |
+
background: #fff;
|
104 |
+
border-bottom: 1px solid #fff;
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
+
/* panels */
|
108 |
+
|
109 |
+
.pys-panel {
|
110 |
+
display: none;
|
111 |
}
|
112 |
|
113 |
+
/* boxes */
|
114 |
+
|
115 |
+
.pys-box {
|
116 |
+
overflow: hidden;
|
117 |
+
clear: both;
|
118 |
+
border-radius: 5px;
|
119 |
+
border: 1px solid #ccc;
|
120 |
+
padding: 25px 0;
|
121 |
+
margin-bottom: 15px;
|
122 |
+
background: #fff;
|
123 |
}
|
124 |
|
125 |
+
.pys-box-red {
|
126 |
+
background: #F4524D;
|
127 |
+
color: #fff;
|
|
|
|
|
128 |
}
|
129 |
|
130 |
+
.pys-box-red h1,
|
131 |
+
.pys-box-red h2,
|
132 |
+
.pys-box-red p,
|
133 |
+
.pys-box-red u,
|
134 |
+
.pys-box-red i,
|
135 |
+
.pys-box-red ul {
|
136 |
+
color: #fff;
|
137 |
+
}
|
138 |
|
139 |
+
.pys-box-middle {
|
140 |
+
color: #fff;
|
141 |
+
text-align: center;
|
142 |
+
background: #516F9F;
|
143 |
}
|
144 |
|
145 |
+
.pys-box-middle h2,
|
146 |
+
.pys-box-middle h3,
|
147 |
+
.pys-box-middle p,
|
148 |
+
.pys-box-middle u,
|
149 |
+
.pys-box-middle i {
|
150 |
+
color: #fff;
|
151 |
}
|
152 |
|
153 |
+
/* grid */
|
154 |
+
|
155 |
+
.pys-col {
|
156 |
+
float: left;
|
157 |
+
width: 100%;
|
158 |
+
box-sizing: border-box;
|
159 |
+
padding: 0 25px;
|
160 |
}
|
161 |
|
162 |
+
.pys-col-full {
|
163 |
+
width: 100%;
|
164 |
}
|
165 |
|
166 |
+
.pys-col-one-half {
|
167 |
+
width: 50%;
|
168 |
+
}
|
169 |
|
170 |
+
.pys-col-narrow {
|
171 |
+
float: none;
|
172 |
+
width: 70%;
|
173 |
+
margin: 25px auto;
|
174 |
}
|
175 |
|
176 |
+
.pys-col-border-left {
|
177 |
+
border-left: 1px solid #ccc;
|
178 |
+
}
|
179 |
|
180 |
+
.pys-col-border-right {
|
181 |
+
border-right: 1px solid #ccc;
|
182 |
}
|
183 |
|
184 |
+
/* aligns */
|
185 |
+
|
186 |
+
h3.align-one-third {
|
187 |
+
margin-left: 30%;
|
188 |
+
padding: 0 18px;
|
189 |
}
|
190 |
|
191 |
+
/* @todo: verify me */
|
192 |
+
|
193 |
+
tr.align-one-third td:first-child {
|
194 |
+
width: 30%;
|
195 |
}
|
196 |
|
197 |
+
tr.align-one-third td:last-child {
|
198 |
+
width: 70%;
|
199 |
}
|
200 |
|
201 |
+
/* buttons */
|
202 |
|
203 |
+
.pys-btn,
|
204 |
+
.pys-btn:hover,
|
205 |
+
a.pys-btn,
|
206 |
+
a.pys-btn:hover {
|
207 |
+
line-height: normal;
|
208 |
+
display: inline-block;
|
209 |
+
color: #fff;
|
210 |
+
font-weight: bold;
|
211 |
+
text-decoration: none;
|
212 |
+
cursor: pointer;
|
213 |
+
padding: 10px 25px;
|
214 |
+
border: none;
|
215 |
}
|
216 |
|
217 |
+
.pys-btn:hover.pys-btn-big,
|
218 |
+
a.pys-btn:hover.pys-btn-big {
|
219 |
+
line-height: normal;
|
220 |
+
padding: 12px 35px;
|
221 |
+
}
|
222 |
|
223 |
+
.pys-btn-red,
|
224 |
+
a.pys-btn-red {
|
225 |
+
background: #F4524D;
|
226 |
+
}
|
227 |
|
228 |
+
.pys-btn-blue,
|
229 |
+
a.pys-btn-blue {
|
230 |
+
background: #516F9F;
|
231 |
+
}
|
232 |
|
233 |
+
.pys-btn.pys-btn-big {
|
234 |
+
font-size: 20px;
|
235 |
+
padding: 12px 35px;
|
236 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
+
/* tables */
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
+
table.layout {
|
241 |
+
width: 100%;
|
242 |
+
margin: 25px 0;
|
243 |
+
table-layout: fixed;
|
244 |
}
|
245 |
|
246 |
+
table.layout tr {
|
247 |
+
margin-bottom: 5px;
|
248 |
+
}
|
249 |
|
250 |
+
table.layout tr.tall td {
|
251 |
+
padding-bottom: 25px;
|
|
|
252 |
}
|
253 |
|
254 |
+
table.layout td {
|
255 |
+
padding: 5px 15px;
|
256 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
+
table.layout td.legend {
|
259 |
+
vertical-align: top;
|
260 |
}
|
261 |
|
262 |
+
table.layout td.narrow {
|
263 |
+
padding-left: 25%;
|
264 |
+
padding-right: 25%;
|
|
|
265 |
}
|
266 |
|
267 |
+
table.pys-list .button {
|
268 |
+
margin-right: 5px;
|
269 |
+
}
|
270 |
|
271 |
+
table.layout.search {
|
272 |
+
background-color: transparent; /* default styles bug fix */
|
|
|
273 |
}
|
274 |
|
275 |
+
/* forms */
|
276 |
+
|
277 |
+
.label {
|
278 |
+
text-align: right;
|
279 |
+
margin: 0;
|
280 |
+
line-height: 27px;
|
281 |
font-weight: bold;
|
|
|
282 |
}
|
283 |
|
284 |
+
.label.big {
|
285 |
+
font-size: 16.9px;
|
|
|
|
|
|
|
286 |
}
|
287 |
|
288 |
+
.legend > .label {
|
289 |
+
line-height: inherit;
|
290 |
+
}
|
291 |
+
|
292 |
+
.help {
|
293 |
+
display: block;
|
294 |
+
color: #666;
|
295 |
+
font-size: 13px;
|
296 |
+
margin: 5px 0;
|
297 |
+
}
|
298 |
+
|
299 |
+
input[type="text"] {
|
300 |
+
width: 300px;
|
301 |
+
max-width: 100%;
|
302 |
+
}
|
303 |
+
|
304 |
+
input[type="checkbox"] {
|
305 |
+
margin-right: 10px;
|
306 |
+
}
|
307 |
+
|
308 |
+
input[type="checkbox"].big {
|
309 |
+
margin-top: -3px;
|
310 |
+
}
|
311 |
+
|
312 |
+
/* tickbox */
|
313 |
+
|
314 |
+
#TB_window h2 {
|
315 |
+
margin: 1em 0;
|
316 |
+
}
|
317 |
+
|
318 |
+
#TB_window table tr td:last-child {
|
319 |
+
width: 70%;
|
320 |
+
}
|
321 |
+
|
322 |
+
#TB_window .actions-row {
|
323 |
+
text-align: right;
|
324 |
+
padding: 5px 15px;
|
325 |
+
}
|
326 |
+
|
327 |
+
/* event fields show/hide classes */
|
328 |
+
|
329 |
+
.ViewContent-visible,
|
330 |
+
.Search-visible,
|
331 |
+
.AddToCart-visible,
|
332 |
+
.AddToWishlist-visible,
|
333 |
+
.InitiateCheckout-visible,
|
334 |
+
.AddPaymentInfo-visible,
|
335 |
+
.Purchase-visible,
|
336 |
+
.Lead-visible,
|
337 |
+
.CompleteRegistration-visible,
|
338 |
+
.CustomCode-visible,
|
339 |
+
.CustomEvent-visible{
|
340 |
+
display: none;
|
341 |
+
}
|
342 |
+
|
343 |
+
.ViewContent .ViewContent-visible,
|
344 |
+
.AddToCart .AddToCart-visible,
|
345 |
+
.AddToWishlist .AddToWishlist-visible,
|
346 |
+
.InitiateCheckout .InitiateCheckout-visible,
|
347 |
+
.AddPaymentInfo .AddPaymentInfo-visible,
|
348 |
+
.Purchase .Purchase-visible,
|
349 |
+
.Lead .Lead-visible,
|
350 |
+
.CompleteRegistration .CompleteRegistration-visible,
|
351 |
+
.Search .Search-visible,
|
352 |
+
.CustomCode .CustomCode-visible,
|
353 |
+
.CustomEvent .CustomEvent-visible {
|
354 |
+
display: table-row;
|
355 |
}
|
356 |
|
357 |
+
.URL-visible,
|
358 |
+
.CSS-visible {
|
359 |
+
display: none;
|
|
|
360 |
}
|
361 |
|
362 |
+
.URL .URL-visible,
|
363 |
+
.CSS .CSS-visible {
|
364 |
+
display: table-row;
|
365 |
+
}
|
facebook-pixel-master.php
CHANGED
@@ -1,183 +1,160 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: PixelYourSite
|
4 |
-
Description: Add the Facebook Pixel code into your Wordpress site and set up standard events with just a few clicks. Fully compatible with Woocommerce, purchase event included.
|
5 |
-
Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
|
6 |
-
Author: PixelYourSite
|
7 |
-
Author URI: http://www.pixelyoursite.com
|
8 |
-
Version:
|
9 |
-
License: GPLv3
|
10 |
*/
|
11 |
|
12 |
// If this file is called directly, abort.
|
13 |
-
if ( ! defined( 'WPINC' ) ) {
|
14 |
-
die;
|
15 |
-
}
|
16 |
-
|
17 |
-
/*
|
18 |
-
* Constants
|
19 |
-
*/
|
20 |
-
//Plugin Version
|
21 |
-
define( 'FBPMP_VERSION', '2.2');
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
29 |
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
/* Register Admin Page for plugin */
|
36 |
-
|
37 |
-
|
38 |
-
/* Register scripts for admin Settings */
|
39 |
-
add_action('admin_enqueue_scripts', 'woofp_adminscripts');
|
40 |
-
|
41 |
-
//Ajax Save Admin Settings
|
42 |
-
/*add_action('wp_ajax_nopriv_woofbsavesettings' , 'ajax_woofbsavesettings');*/
|
43 |
-
add_action('wp_ajax_woofbsavesettings' , 'ajax_woofbsavesettings');
|
44 |
|
45 |
-
add_action('
|
46 |
-
|
47 |
|
|
|
48 |
|
49 |
-
function woofp_init(){
|
50 |
-
|
51 |
-
if( !is_admin() ){
|
52 |
-
//Display Facebook Pixel Code
|
53 |
-
add_action('login_enqueue_scripts', 'woofp_pixelcode', 1);
|
54 |
-
add_action('wp_head', 'woofp_pixelcode', 1);
|
55 |
-
|
56 |
-
|
57 |
-
//add addtocart ajax support
|
58 |
-
//only if woocommerce installed
|
59 |
-
if( woofp_is_woocommerce() ){
|
60 |
-
add_action('wp_footer', 'woofp_addtocart_pixel');
|
61 |
}
|
62 |
-
}
|
63 |
|
64 |
}
|
65 |
|
66 |
-
|
|
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
|
74 |
-
|
75 |
|
76 |
-
$results = array('status' => 0 );
|
77 |
}
|
78 |
|
79 |
-
die( json_encode( $results ) );
|
80 |
}
|
81 |
|
|
|
|
|
82 |
|
83 |
-
|
84 |
-
function
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
}
|
89 |
|
90 |
-
|
91 |
-
function woofp_adminmenu(){
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
/* Admin page content */
|
97 |
-
function woofp_admin_page(){
|
98 |
-
|
99 |
-
$facebookpixel = woofp_admin_settings('facebookpixel');
|
100 |
-
$standardevent = woofp_admin_settings('standardevent');
|
101 |
-
$woocommerce_settings = woofp_admin_settings('woocommerce');
|
102 |
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
105 |
|
106 |
}
|
107 |
|
108 |
-
/*
|
109 |
-
|
110 |
|
111 |
-
|
112 |
-
if(isset($_GET['page']) && $_GET['page'] == 'woo-facebookpixel' ){
|
113 |
|
114 |
-
|
115 |
-
wp_enqueue_script( 'woo-facebookpixel-script', plugins_url( 'js/admin.js', __FILE__ ), array('jquery'), '1.0');
|
116 |
-
wp_localize_script( 'woo-facebookpixel-script', 'woofp', array( 'ajaxurl'=> admin_url('admin-ajax.php'), 'loading' => admin_url('images/loading.gif') ) );
|
117 |
-
}
|
118 |
-
}
|
119 |
|
|
|
120 |
|
121 |
-
|
122 |
-
* Save Admin Settings
|
123 |
-
*
|
124 |
-
* @return array
|
125 |
-
* @author PixelYourSite
|
126 |
-
**/
|
127 |
-
function ajax_woofbsavesettings(){
|
128 |
|
129 |
-
$woo = 0;
|
130 |
-
if( woofp_is_woocommerce() ){
|
131 |
-
$woo = 1;
|
132 |
}
|
133 |
|
134 |
-
|
135 |
-
if( wp_verify_nonce( $_POST['woofpnonce'], 'woofp-nonce-action' ) ){
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
$woocommerce = isset($_POST['woocommerce']) ? $_POST['woocommerce'] : '';
|
140 |
|
141 |
-
|
142 |
-
|
143 |
|
144 |
-
|
145 |
-
'standardevent' => $standardevent,
|
146 |
-
'woocommerce' => $woocommerce
|
147 |
|
148 |
-
|
149 |
|
150 |
-
|
151 |
-
update_option('woofp_admin_settings', $woofp_options_update);
|
152 |
-
|
153 |
|
|
|
154 |
|
155 |
-
|
156 |
|
157 |
-
|
158 |
|
159 |
-
$
|
160 |
-
|
161 |
-
}
|
162 |
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
-
|
166 |
|
167 |
-
|
|
|
168 |
|
|
|
169 |
|
170 |
-
|
171 |
-
function woofp_plugin_activated(){
|
172 |
|
|
|
|
|
|
|
|
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
}
|
180 |
|
181 |
-
}
|
182 |
|
183 |
-
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: PixelYourSite
|
4 |
+
Description: Add the Facebook Pixel code into your Wordpress site and set up standard events with just a few clicks. Fully compatible with Woocommerce, purchase event included.
|
5 |
+
Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
|
6 |
+
Author: PixelYourSite
|
7 |
+
Author URI: http://www.pixelyoursite.com
|
8 |
+
Version: 3.0
|
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', '3.0');
|
20 |
|
21 |
+
require_once( 'inc/common.php' );
|
22 |
+
require_once( 'inc/admin_notices.php' );
|
23 |
+
require_once( 'inc/core.php' );
|
24 |
+
require_once( 'inc/ajax-standard.php' );
|
25 |
|
26 |
+
add_action( 'plugins_loaded', 'pys_free_init' );
|
27 |
+
function pys_free_init() {
|
28 |
|
29 |
+
if( !is_admin() ){
|
30 |
+
|
31 |
+
// display Facebook Pixel Code
|
32 |
+
//add_action( 'login_enqueue_scripts', 'pys_pixel_code', 1 );
|
33 |
+
add_action( 'wp_head', 'pys_pixel_code', 1 );
|
34 |
+
|
35 |
+
// add addtocart ajax support only if woocommerce installed
|
36 |
+
if( pys_is_woocommerce_active() ){
|
37 |
+
add_action( 'wp_enqueue_scripts', 'pys_public_scripts' );
|
38 |
+
add_filter( 'woocommerce_loop_add_to_cart_link', 'pys_add_code_to_woo_cart_link', 10, 2 );
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
44 |
|
45 |
/* Register Admin Page for plugin */
|
46 |
+
if( !function_exists( 'pys_admin_menu' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
add_action( 'admin_menu', 'pys_admin_menu' );
|
49 |
+
function pys_admin_menu() {
|
50 |
|
51 |
+
add_menu_page( 'PixelYourSite', 'PixelYourSite', 'manage_options', 'pixel-your-site', 'pys_admin_page_callback' );
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
|
|
54 |
|
55 |
}
|
56 |
|
57 |
+
/* Admin page display callback */
|
58 |
+
if( !function_exists( 'pys_admin_page_callback' ) ) {
|
59 |
|
60 |
+
function pys_admin_page_callback() {
|
61 |
|
62 |
+
// update general and woo settings
|
63 |
+
if( isset($_POST['pys']) ) {
|
64 |
+
update_option( 'pixel_your_site', $_POST['pys'] );
|
65 |
+
}
|
66 |
|
67 |
+
include( 'inc/html-admin.php' );
|
68 |
|
|
|
69 |
}
|
70 |
|
|
|
71 |
}
|
72 |
|
73 |
+
/* Register scripts for plugin admin screen */
|
74 |
+
if( !function_exists( 'pys_admin_scripts' ) ) {
|
75 |
|
76 |
+
add_action( 'admin_enqueue_scripts', 'pys_admin_scripts' );
|
77 |
+
function pys_admin_scripts() {
|
78 |
|
79 |
+
// include only if plugin admin page
|
80 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == 'pixel-your-site' ) {
|
|
|
81 |
|
82 |
+
add_thickbox();
|
|
|
83 |
|
84 |
+
wp_enqueue_style( 'pys', plugins_url( 'css/admin.css', __FILE__ ), array(), PYS_FREE_VERSION );
|
85 |
+
wp_enqueue_script( 'pys', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
wp_localize_script( 'pys', 'pys', array(
|
88 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
89 |
+
) );
|
90 |
+
}
|
91 |
|
92 |
+
}
|
93 |
|
94 |
}
|
95 |
|
96 |
+
/* Register front-end scripts. */
|
97 |
+
if( !function_exists( 'pys_public_scripts' ) ) {
|
98 |
|
99 |
+
function pys_public_scripts() {
|
|
|
100 |
|
101 |
+
if( pys_is_woocommerce_active() && pys_get_option( 'woo', 'enabled' ) && pys_get_option( 'woo', 'on_add_to_cart_btn' ) ) {
|
|
|
|
|
|
|
|
|
102 |
|
103 |
+
wp_enqueue_script( 'pys', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION );
|
104 |
|
105 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
+
}
|
|
|
110 |
|
111 |
+
/* Plugin activation. */
|
112 |
+
if( !function_exists( 'pys_free_plugin_activated' ) ) {
|
|
|
113 |
|
114 |
+
register_activation_hook( __FILE__, 'pys_free_plugin_activated' );
|
115 |
+
function pys_free_plugin_activated() {
|
116 |
|
117 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
|
|
|
|
118 |
|
119 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
120 |
|
121 |
+
}
|
|
|
|
|
122 |
|
123 |
+
if ( is_plugin_active( 'pixelyoursite-pro/pixelyoursite-pro.php' ) ) {
|
124 |
|
125 |
+
wp_die( 'Please deactivate PixelYourSite Pro version First.', 'Plugin Activation' );
|
126 |
|
127 |
+
}
|
128 |
|
129 |
+
$options = get_option( 'pixel_your_site' );
|
130 |
+
if ( ! $options ) {
|
|
|
131 |
|
132 |
+
// set default options values
|
133 |
+
$defaults = pys_get_default_options();
|
134 |
+
update_option( 'pixel_your_site', $defaults );
|
135 |
|
136 |
+
// migrate settings from old versions
|
137 |
+
if( get_option( 'woofp_admin_settings' ) ) {
|
138 |
|
139 |
+
require_once( 'inc/migrate.php' );
|
140 |
+
pys_migrate_from_22x();
|
141 |
|
142 |
+
}
|
143 |
|
144 |
+
}
|
|
|
145 |
|
146 |
+
//@todo: refactor options names in future releases
|
147 |
+
// set plugin activation data and remember version (used in admin notices)
|
148 |
+
$activation_date = get_option('pysf_activation_date', '');
|
149 |
+
$version = get_option('pysf_plugin_version', '');
|
150 |
|
151 |
+
if( empty($activation_date) || version_compare($version, PYS_FREE_VERSION, '<') ) {
|
152 |
+
update_option( 'pysf_activation_date', time() );
|
153 |
+
update_option( 'pysf_plugin_version', PYS_FREE_VERSION );
|
154 |
+
update_option( 'pysf_notice_dismiss', '' );
|
155 |
+
update_option( 'woo_pysf_notice_dismiss', '' );
|
156 |
}
|
157 |
|
158 |
+
}
|
159 |
|
160 |
+
}
|
img/logo.png
ADDED
Binary file
|
inc/admin_notices.php
CHANGED
@@ -8,10 +8,10 @@ $version = get_option('pysf_plugin_version', '');
|
|
8 |
|
9 |
$current_time = time();
|
10 |
|
11 |
-
if( empty($activation_time) || version_compare($version,
|
12 |
$activation_time = $current_time;
|
13 |
update_option( 'pysf_activation_date', $activation_time);
|
14 |
-
update_option( 'pysf_plugin_version',
|
15 |
update_option( 'pysf_notice_dismiss', '');
|
16 |
update_option( 'woo_pysf_notice_dismiss', '');
|
17 |
}
|
@@ -28,29 +28,28 @@ $days_passed = woofp_days_passed($current_time, $activation_time);
|
|
28 |
$expiration_date = date('l jS \of F Y', $expiration_time);
|
29 |
|
30 |
$link_1 = 'http://www.pixelyoursite.com/limited-offer?utm_source=wadmin&utm_medium=wordpress&utm_campaign=limited-offer';
|
31 |
-
$link_2 = 'http://www.pixelyoursite.com/
|
32 |
|
33 |
|
34 |
|
35 |
//Message for day 1
|
36 |
-
$day_1_text
|
37 |
-
$day_1_text .= '<a href="http://www.pixelyoursite.com/
|
38 |
-
$day_1_text .= ' - you are leaving money on the table. Optimize your ads for actions on your website, create better Custom Audiences, and get better conversion reports. ';
|
39 |
-
$day_1_text .= '<a href="'.$link_1.'" target="_blank">Enable Dynamic Events with PixelYourSite PRO</a>';
|
40 |
|
41 |
//Message for day 2
|
42 |
-
$day_2_text = '<span class="pysf_note"><b>
|
43 |
-
$day_2_text .= '<a href="
|
44 |
|
45 |
//Message for day 3
|
46 |
-
$day_3_text
|
47 |
-
$day_3_text .= '
|
48 |
|
49 |
//Message for day 4 to 7;
|
50 |
-
$day_4_to_7_text = '';
|
|
|
51 |
|
52 |
//Message for day 7 to 12
|
53 |
-
$day_7_to_12_text = '<span class="pysf_note"><b>Special
|
54 |
|
55 |
|
56 |
$options = array(
|
@@ -118,27 +117,31 @@ $options = array(
|
|
118 |
|
119 |
//WooCommerce Message for day 1
|
120 |
$woo_day_1_text = 'WooCommerce Day 1 Message';
|
121 |
-
$woo_day_1_text
|
122 |
-
$woo_day_1_text .= '<a href="
|
|
|
123 |
|
124 |
|
125 |
//WooCommerce Message for day 2
|
126 |
$woo_day_2_text = 'WooCommerce Day 2 Message.';
|
127 |
-
$woo_day_2_text = '<span class="pysf_note"><b>
|
128 |
-
$woo_day_2_text .= '<a href="
|
|
|
129 |
|
130 |
//WooCommerce Message for day 3
|
131 |
$woo_day_3_text = 'WooCommerce Day 3 Message.';
|
132 |
-
$woo_day_3_text
|
133 |
-
$woo_day_3_text .= '
|
134 |
|
135 |
|
136 |
//WooCommerce Message for day 4 to 7;
|
137 |
$woo_day_4_to_7_text = 'WooCommerce Day 4 to 7 Message.';
|
|
|
|
|
138 |
|
139 |
//WooCommerce Message for day 7 to 12
|
140 |
$woo_day_7_to_12_text = 'WooCommerce Day 7 to 12 Message.';
|
141 |
-
$woo_day_7_to_12_text = '<span class="pysf_note"><b>Special Offer:</b></span> Update to PixelYourSite PRO and enable
|
142 |
|
143 |
|
144 |
|
@@ -329,16 +332,6 @@ if( isset($_GET['page']) && $_GET['page'] == 'woo-facebookpixel' ){
|
|
329 |
add_action( 'admin_notices', 'woofp_admin_notices_action' );
|
330 |
}
|
331 |
|
332 |
-
|
333 |
-
//add jquery if not already included;
|
334 |
-
function woofp_admin_notices_script(){
|
335 |
-
|
336 |
-
wp_enqueue_script('jquery');
|
337 |
-
|
338 |
-
}
|
339 |
-
add_action('wp_enqueue_scripts', 'woofp_admin_notices_script');
|
340 |
-
|
341 |
-
|
342 |
function ajax_pysf_notice_dismiss(){
|
343 |
|
344 |
if ( class_exists( 'WooCommerce' ) ) {
|
@@ -357,23 +350,6 @@ function ajax_pysf_notice_dismiss(){
|
|
357 |
}
|
358 |
add_action('wp_ajax_pysf_notice_dismiss', 'ajax_pysf_notice_dismiss');
|
359 |
|
360 |
-
//save activated time on plugin activation
|
361 |
-
function pysf_plugin_activated(){
|
362 |
-
|
363 |
-
$activation_date = get_option('pysf_activation_date', '');
|
364 |
-
$version = get_option('pysf_plugin_version', '');
|
365 |
-
|
366 |
-
if( empty($activation_date) || version_compare($version, FBPMP_VERSION, '<') ){
|
367 |
-
update_option( 'pysf_activation_date', time());
|
368 |
-
update_option( 'pysf_plugin_version', FBPMP_VERSION);
|
369 |
-
update_option( 'pysf_notice_dismiss', '');
|
370 |
-
update_option( 'woo_pysf_notice_dismiss', '');
|
371 |
-
}
|
372 |
-
}
|
373 |
-
register_activation_hook(__FILE__, 'pysf_plugin_activated');
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
//get number of days passed since activation
|
378 |
function woofp_days_passed($current_time, $activation_time){
|
379 |
|
8 |
|
9 |
$current_time = time();
|
10 |
|
11 |
+
if( empty($activation_time) || version_compare($version, PYS_FREE_VERSION, '<') ){
|
12 |
$activation_time = $current_time;
|
13 |
update_option( 'pysf_activation_date', $activation_time);
|
14 |
+
update_option( 'pysf_plugin_version', PYS_FREE_VERSION);
|
15 |
update_option( 'pysf_notice_dismiss', '');
|
16 |
update_option( 'woo_pysf_notice_dismiss', '');
|
17 |
}
|
28 |
$expiration_date = date('l jS \of F Y', $expiration_time);
|
29 |
|
30 |
$link_1 = 'http://www.pixelyoursite.com/limited-offer?utm_source=wadmin&utm_medium=wordpress&utm_campaign=limited-offer';
|
31 |
+
$link_2 = 'http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wadmin&utm_medium=wordpress&utm_campaign=last-message';
|
32 |
|
33 |
|
34 |
|
35 |
//Message for day 1
|
36 |
+
$day_1_text = '<span class="pysf_note"><b>PixelYourSite Update -</b></span> You can use the new General Event option to create Super Powerful Custom Audiences and this is why we prepared a FREE GUIDE on how to do it: ';
|
37 |
+
$day_1_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
|
|
|
|
|
38 |
|
39 |
//Message for day 2
|
40 |
+
$day_2_text = '<span class="pysf_note"><b>PixelYourSite General Event -</b></span> The guide about how to build Powerful Custom Audiences will not be FREE for long, so you better download it now: ';
|
41 |
+
$day_2_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
|
42 |
|
43 |
//Message for day 3
|
44 |
+
$day_3_text = '<span class="pysf_note"><b>PixelYourSite Free Guide -</b></span> Last chanche to download the FREE guide about how to use General Event Option to build powerful Custom Audiences: ';
|
45 |
+
$day_3_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
|
46 |
|
47 |
//Message for day 4 to 7;
|
48 |
+
$day_4_to_7_text = '<span class="pysf_note"><b>Thank You for using PixelYourSite!</b></span> We put many hours into developing and mantaining this plugin, but having you on board makes us proud and happy. If you like PixelYourSite <a href="https://wordpress.org/support/view/plugin-reviews/pixelyoursite?rate=5#postform" target="_blank">click here to give us a 5 stars rating</a>, because it will mean a lot for our team';
|
49 |
+
|
50 |
|
51 |
//Message for day 7 to 12
|
52 |
+
$day_7_to_12_text = '<span class="pysf_note"><b>PixelYourSite Special Discount:</b></span> Update to PixelYourSite PRO and enable Facebook Dynamic Events: optimize your ads for website actions, create better Custom Audiences, get better conversion reports. <a href="'.$link_2.'" target="_blank">Click here for your discount</a>';
|
53 |
|
54 |
|
55 |
$options = array(
|
117 |
|
118 |
//WooCommerce Message for day 1
|
119 |
$woo_day_1_text = 'WooCommerce Day 1 Message';
|
120 |
+
$woo_day_1_text = '<span class="pysf_note"><b>PixelYourSite Update -</b></span> You can use the new General Event option to create Super Powerful Custom Audiences and this is why we prepared a FREE GUIDE on how to do it: ';
|
121 |
+
$woo_day_1_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
|
122 |
+
|
123 |
|
124 |
|
125 |
//WooCommerce Message for day 2
|
126 |
$woo_day_2_text = 'WooCommerce Day 2 Message.';
|
127 |
+
$woo_day_2_text = '<span class="pysf_note"><b>PixelYourSite Guide -</b></span> The guide on how to use the new General Event has plenty of PRO TIPS on how to create better FB campaings for your WooCommerce site. Grab it now, because it will not be free for long: ';
|
128 |
+
$woo_day_2_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
|
129 |
+
|
130 |
|
131 |
//WooCommerce Message for day 3
|
132 |
$woo_day_3_text = 'WooCommerce Day 3 Message.';
|
133 |
+
$woo_day_3_text = '<span class="pysf_note"><b>Start With Facebook Dynamic Ads.</b></span> Download PixelYourSite PRO and Product Catalog Feed Plugin Bundle, so you can track your ADS ROI and start with Dynamic Ads in minutes: ';
|
134 |
+
$woo_day_3_text .= '<a href="http://www.pixelyoursite.com/bundle-offer" target="_blank">Click to download both plugins for a big discount</a>';
|
135 |
|
136 |
|
137 |
//WooCommerce Message for day 4 to 7;
|
138 |
$woo_day_4_to_7_text = 'WooCommerce Day 4 to 7 Message.';
|
139 |
+
$woo_day_4_to_7_text = '<span class="pysf_note"><b>Thank You for using PixelYourSite!</b></span> We put many hours into developing and mantaining this plugin, but having you on board makes us proud and happy. If you like PixelYourSite <a href="https://wordpress.org/support/view/plugin-reviews/pixelyoursite?rate=5#postform" target="_blank">click here to give us a 5 stars rating</a>, because it will mean a lot for our team';
|
140 |
+
|
141 |
|
142 |
//WooCommerce Message for day 7 to 12
|
143 |
$woo_day_7_to_12_text = 'WooCommerce Day 7 to 12 Message.';
|
144 |
+
$woo_day_7_to_12_text = '<span class="pysf_note"><b>Special Offer:</b></span> Update to PixelYourSite PRO and enable fine-tuned Value Tracking. Optimize your ads for website actions, create better Custom Audiences, get better conversion reports. <a href="'.$link_2.'" target="_blank">Click here for your discount</a>';
|
145 |
|
146 |
|
147 |
|
332 |
add_action( 'admin_notices', 'woofp_admin_notices_action' );
|
333 |
}
|
334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
function ajax_pysf_notice_dismiss(){
|
336 |
|
337 |
if ( class_exists( 'WooCommerce' ) ) {
|
350 |
}
|
351 |
add_action('wp_ajax_pysf_notice_dismiss', 'ajax_pysf_notice_dismiss');
|
352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
//get number of days passed since activation
|
354 |
function woofp_days_passed($current_time, $activation_time){
|
355 |
|
inc/ajax-standard.php
ADDED
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Show Std Event edit modal content.
|
5 |
+
*/
|
6 |
+
if( !function_exists( 'pys_edit_std_event' ) ) {
|
7 |
+
|
8 |
+
add_action( 'wp_ajax_pys_edit_std_event', 'pys_edit_std_event' );
|
9 |
+
function pys_edit_std_event() {
|
10 |
+
|
11 |
+
$id = isset( $_REQUEST['id'] ) == true ? $_REQUEST['id'] : uniqid();
|
12 |
+
|
13 |
+
// get event data
|
14 |
+
$events = (array) get_option( 'pixel_your_site_std_events' );
|
15 |
+
$std_event = $events[ $id ];
|
16 |
+
|
17 |
+
?>
|
18 |
+
|
19 |
+
<form action="" method="post" id="std-event-form">
|
20 |
+
<input type="hidden" name="action" value="add_std_event">
|
21 |
+
<input type="hidden" name="std_event[id]" value="<?php echo $id; ?>">
|
22 |
+
|
23 |
+
<table class="layout <?php echo $std_event['eventtype']; ?>">
|
24 |
+
<tr>
|
25 |
+
<td class="legend"><p class="label">URL:</p></td>
|
26 |
+
<td>
|
27 |
+
<input type="text" name="std_event[pageurl]" value="<?php echo $std_event['pageurl']; ?>">
|
28 |
+
<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>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
|
32 |
+
<tr>
|
33 |
+
<td class="legend"><p class="label">Event type:</p></td>
|
34 |
+
<td>
|
35 |
+
<select name="std_event[eventtype]" autocomplete="off" id="std-event-type">
|
36 |
+
<?php echo pys_event_types_select_options( $std_event['eventtype'] ); ?>
|
37 |
+
</select>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
|
41 |
+
<tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
|
42 |
+
<td class="legend"><p class="label">Value:</p></td>
|
43 |
+
<td>
|
44 |
+
<input type="text" name="std_event[value]" value="<?php echo $std_event['value']; ?>">
|
45 |
+
<span class="help">Mandatory for purchase event only.</span>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
|
49 |
+
<tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
|
50 |
+
<td class="legend"><p class="label">Currency:</p></td>
|
51 |
+
<td>
|
52 |
+
<select name="std_event[currency]">
|
53 |
+
<option value="">Select Currency</option>
|
54 |
+
<?php echo pys_currency_options( $std_event['currency'] ); ?>
|
55 |
+
</select>
|
56 |
+
<span class="help">Mandatory for purchase event only.</span>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
|
60 |
+
<tr class="ViewContent-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible Purchase-visible Lead-visible CompleteRegistration-visible">
|
61 |
+
<td class="legend"><p class="label">content_name:</p></td>
|
62 |
+
<td>
|
63 |
+
<input type="text" name="std_event[content_name]"
|
64 |
+
value="<?php echo $std_event['content_name']; ?>">
|
65 |
+
<span class="help">Name of the page/product i.e 'Really Fast Running Shoes'.</span>
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
+
|
69 |
+
<tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible">
|
70 |
+
<td class="legend"><p class="label">content_ids:</p></td>
|
71 |
+
<td>
|
72 |
+
<input type="text" name="std_event[content_ids]"
|
73 |
+
value="<?php echo $std_event['content_ids']; ?>">
|
74 |
+
<span class="help">Product ids/SKUs associated with the event.</span>
|
75 |
+
</td>
|
76 |
+
</tr>
|
77 |
+
|
78 |
+
<tr class="ViewContent-visible AddToCart-visible InitiateCheckout-visible Purchase-visible">
|
79 |
+
<td class="legend"><p class="label">content_type:</p></td>
|
80 |
+
<td>
|
81 |
+
<input type="text" name="std_event[content_type]"
|
82 |
+
value="<?php echo $std_event['content_type']; ?>">
|
83 |
+
<span class="help">The type of content. i.e product or product_group.</span>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
|
87 |
+
<tr class="Search-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Lead-visible">
|
88 |
+
<td class="legend"><p class="label">content_category:</p></td>
|
89 |
+
<td>
|
90 |
+
<input type="text" name="std_event[content_category]"
|
91 |
+
value="<?php echo $std_event['content_category']; ?>">
|
92 |
+
<span class="help">Category of the page/product.</span>
|
93 |
+
</td>
|
94 |
+
</tr>
|
95 |
+
|
96 |
+
<tr class="InitiateCheckout-visible Purchase-visible">
|
97 |
+
<td class="legend"><p class="label">num_items:</p></td>
|
98 |
+
<td>
|
99 |
+
<input type="text" name="std_event[num_items]" value="<?php echo $std_event['num_items']; ?>">
|
100 |
+
<span class="help">The number of items in the cart. i.e '3'.</span>
|
101 |
+
</td>
|
102 |
+
</tr>
|
103 |
+
|
104 |
+
<tr class="Purchase-visible">
|
105 |
+
<td class="legend"><p class="label">order_id:</p></td>
|
106 |
+
<td>
|
107 |
+
<input type="text" name="std_event[order_id]" value="<?php echo $std_event['order_id']; ?>">
|
108 |
+
<span class="help">The unique order id of the successful purchase. i.e 19.</span>
|
109 |
+
</td>
|
110 |
+
</tr>
|
111 |
+
|
112 |
+
<tr class="Search-visible">
|
113 |
+
<td class="legend"><p class="label">search_string:</p></td>
|
114 |
+
<td>
|
115 |
+
<input type="text" name="std_event[search_string]"
|
116 |
+
value="<?php echo $std_event['search_string']; ?>">
|
117 |
+
<span class="help">The string entered by the user for the search. i.e 'Shoes'.</span>
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
|
121 |
+
<tr class="CompleteRegistration-visible">
|
122 |
+
<td class="legend"><p class="label">status:</p></td>
|
123 |
+
<td>
|
124 |
+
<input type="text" name="std_event[status]" value="<?php echo $std_event['status']; ?>">
|
125 |
+
<span class="help">The status of the registration. i.e completed.</span>
|
126 |
+
</td>
|
127 |
+
</tr>
|
128 |
+
|
129 |
+
<tr class="CustomCode-visible">
|
130 |
+
<td class="legend"><p class="label" style="line-height: inherit;">Custom event code (advanced users
|
131 |
+
only):</p></td>
|
132 |
+
<td>
|
133 |
+
<textarea name="std_event[code]" rows="5"
|
134 |
+
style="width:100%;"><?php echo stripslashes( $std_event['code'] ); ?></textarea>
|
135 |
+
<span class="help">The code inserted in the field MUST be complete, including <code>fbq('track',
|
136 |
+
'AddToCart', { … });</code></span>
|
137 |
+
</td>
|
138 |
+
</tr>
|
139 |
+
|
140 |
+
<tr class="CustomEvent-visible">
|
141 |
+
<td class="legend"></td>
|
142 |
+
<td>
|
143 |
+
<p><strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></p>
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
|
147 |
+
</table>
|
148 |
+
|
149 |
+
<div class="actions-row">
|
150 |
+
<a href="#" class="button button-close action">Cancel</a>
|
151 |
+
<a href="#" class="button button-save button-primary action"><?php echo isset( $_REQUEST['id'] ) == true ? 'Save' : 'Add'; ?></a>
|
152 |
+
</div>
|
153 |
+
|
154 |
+
</form>
|
155 |
+
|
156 |
+
<script>
|
157 |
+
jQuery(function ($) {
|
158 |
+
|
159 |
+
/* Standard event fields show/hide on event type change. */
|
160 |
+
$('#std-event-type').on('change', function () {
|
161 |
+
var wrapper = $(this).closest('table');
|
162 |
+
|
163 |
+
wrapper.removeClass(); // clear all classes
|
164 |
+
wrapper.addClass('layout');
|
165 |
+
wrapper.addClass(this.value);
|
166 |
+
});
|
167 |
+
|
168 |
+
/* Close modal window */
|
169 |
+
$('.button-close').on('click', function (e) {
|
170 |
+
e.preventDefault();
|
171 |
+
tb_remove();
|
172 |
+
});
|
173 |
+
|
174 |
+
/* Save / Add event */
|
175 |
+
$('.button-save').on('click', function (e) {
|
176 |
+
e.preventDefault();
|
177 |
+
|
178 |
+
$('#std-event-form').addClass('disabled');
|
179 |
+
$(this).text('Saving...');
|
180 |
+
|
181 |
+
var data = $('#std-event-form').serialize();
|
182 |
+
data = data + '&action=pys_update_std_event';
|
183 |
+
|
184 |
+
$.ajax({
|
185 |
+
url: '<?php echo admin_url('admin-ajax.php'); ?>',
|
186 |
+
type: 'post',
|
187 |
+
dataType: 'json',
|
188 |
+
data: data
|
189 |
+
})
|
190 |
+
.done(function (data) {
|
191 |
+
|
192 |
+
$("input[name='active_tab']").val('posts-events');
|
193 |
+
$('.pys-content > form').submit();
|
194 |
+
//location.reload(true);
|
195 |
+
|
196 |
+
});
|
197 |
+
|
198 |
+
});
|
199 |
+
|
200 |
+
});
|
201 |
+
</script>
|
202 |
+
|
203 |
+
<?php
|
204 |
+
exit();
|
205 |
+
}
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Update or Add Std Event.
|
211 |
+
*/
|
212 |
+
if( !function_exists( 'pys_update_std_event' ) ) {
|
213 |
+
|
214 |
+
add_action( 'wp_ajax_pys_update_std_event', 'pys_update_std_event' );
|
215 |
+
function pys_update_std_event() {
|
216 |
+
|
217 |
+
$events = (array) get_option( 'pixel_your_site_std_events' );
|
218 |
+
$std_event = $_REQUEST['std_event'];
|
219 |
+
|
220 |
+
$id = $std_event['id'];
|
221 |
+
unset( $std_event['action'] );
|
222 |
+
unset( $std_event['id'] );
|
223 |
+
|
224 |
+
unset( $std_event['custom_names'] );
|
225 |
+
unset( $std_event['custom_values'] );
|
226 |
+
|
227 |
+
$events[ $id ] = $std_event;
|
228 |
+
update_option( 'pixel_your_site_std_events', $events );
|
229 |
+
|
230 |
+
echo json_encode( 'success' );
|
231 |
+
|
232 |
+
exit();
|
233 |
+
}
|
234 |
+
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Delete Std Event(s).
|
239 |
+
*/
|
240 |
+
if( !function_exists( 'pys_delete_std_event' ) ) {
|
241 |
+
|
242 |
+
add_action( 'wp_ajax_pys_delete_std_event', 'pys_delete_std_event' );
|
243 |
+
function pys_delete_std_event() {
|
244 |
+
|
245 |
+
$events = (array) get_option( 'pixel_your_site_std_events' );
|
246 |
+
$ids = $_REQUEST['ids'];
|
247 |
+
|
248 |
+
// remove requested ids
|
249 |
+
foreach ( $ids as $id ) {
|
250 |
+
|
251 |
+
unset( $events[ $id ] );
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
update_option( 'pixel_your_site_std_events', $events );
|
256 |
+
|
257 |
+
echo json_encode( 'success' );
|
258 |
+
exit();
|
259 |
+
}
|
260 |
+
|
261 |
+
}
|
inc/common.php
ADDED
@@ -0,0 +1,1459 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Common functions for both versions.
|
4 |
+
*/
|
5 |
+
|
6 |
+
if( !function_exists( 'dd' ) ) {
|
7 |
+
|
8 |
+
function dd( $data ) {
|
9 |
+
echo "<pre>" . print_r( $data, 1 ) . "</pre>";
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
if( !function_exists( 'precho' ) ) {
|
16 |
+
|
17 |
+
function precho( $data ) {
|
18 |
+
echo "<pre>" . print_r( $data, 1 ) . "</pre>";
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Check if WooCommerce plugin is installed and activated.
|
25 |
+
*/
|
26 |
+
if( !function_exists( 'pys_is_woocommerce_active' ) ) {
|
27 |
+
|
28 |
+
function pys_is_woocommerce_active() {
|
29 |
+
return class_exists( 'WooCommerce' ) == true ? true : false;
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Check if Easy Digital Downloads plugin is installed and activated.
|
36 |
+
*/
|
37 |
+
if( !function_exists( 'pys_is_edd_active' ) ) {
|
38 |
+
|
39 |
+
function pys_is_edd_active() {
|
40 |
+
return class_exists( 'Easy_Digital_Downloads' ) == true ? true : false;
|
41 |
+
}
|
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' );
|
53 |
+
|
54 |
+
return isset( $options[ $section ][ $option ] ) ? $options[ $section ][ $option ] : $default;
|
55 |
+
|
56 |
+
}
|
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 |
+
*/
|
82 |
+
if( !function_exists( 'pys_radio_state' ) ) {
|
83 |
+
|
84 |
+
function pys_radio_state( $section, $option, $value ) {
|
85 |
+
|
86 |
+
$options = get_option( 'pixel_your_site' );
|
87 |
+
|
88 |
+
if ( isset( $options[ $section ][ $option ] ) ) {
|
89 |
+
return $options[ $section ][ $option ] == $value ? 'checked' : '';
|
90 |
+
}
|
91 |
+
|
92 |
+
return null;
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Facebook Pixel Event types options html.
|
99 |
+
*/
|
100 |
+
if( !function_exists( 'pys_event_types_select_options' ) ) {
|
101 |
+
|
102 |
+
function pys_event_types_select_options( $current = null, $full = true ) {
|
103 |
+
?>
|
104 |
+
|
105 |
+
<option <?php echo selected( null, $current, true ); ?> disabled>Select Type</option>
|
106 |
+
<option <?php echo selected( 'ViewContent', $current, true ); ?> value="ViewContent">ViewContent</option>
|
107 |
+
|
108 |
+
<?php if ( $full ) : ?>
|
109 |
+
<option <?php echo selected( 'Search', $current, true ); ?> value="Search">Search</option>
|
110 |
+
<?php endif; ?>
|
111 |
+
|
112 |
+
<option <?php echo selected( 'AddToCart', $current, true ); ?> value="AddToCart">AddToCart</option>
|
113 |
+
<option <?php echo selected( 'AddToWishlist', $current, true ); ?> value="AddToWishlist">AddToWishlist</option>
|
114 |
+
<option <?php echo selected( 'InitiateCheckout', $current, true ); ?> value="InitiateCheckout">InitiateCheckout</option>
|
115 |
+
<option <?php echo selected( 'AddPaymentInfo', $current, true ); ?> value="AddPaymentInfo">AddPaymentInfo</option>
|
116 |
+
<option <?php echo selected( 'Purchase', $current, true ); ?> value="Purchase">Purchase</option>
|
117 |
+
<option <?php echo selected( 'Lead', $current, true ); ?> value="Lead">Lead</option>
|
118 |
+
<option <?php echo selected( 'CompleteRegistration', $current, true ); ?> value="CompleteRegistration">
|
119 |
+
CompleteRegistration
|
120 |
+
</option>
|
121 |
+
|
122 |
+
<?php if ( $full ) : ?>
|
123 |
+
|
124 |
+
<option disabled></option>
|
125 |
+
<option <?php echo selected( 'CustomEvent', $current, true ); ?> value="CustomEvent">Custom event</option>
|
126 |
+
<option <?php echo selected( 'CustomCode', $current, true ); ?> value="CustomCode">Custom event code</option>
|
127 |
+
|
128 |
+
<?php endif; ?>
|
129 |
+
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Current Page Full URL without trailing slash
|
137 |
+
*/
|
138 |
+
if( !function_exists( 'pys_get_current_url' ) ) {
|
139 |
+
|
140 |
+
function pys_get_current_url() {
|
141 |
+
|
142 |
+
$current_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
143 |
+
$current_url = rtrim( $current_url, '/' );
|
144 |
+
|
145 |
+
return $current_url;
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Returns relative path without protocol, host, slashes.
|
153 |
+
*/
|
154 |
+
if( !function_exists( 'pys_get_relative_path' ) ) {
|
155 |
+
|
156 |
+
function pys_get_relative_path( $url ) {
|
157 |
+
|
158 |
+
$host = str_replace( array( 'http://', 'https://', 'http://www.', 'https://www.', 'www.' ), '', home_url() );
|
159 |
+
|
160 |
+
$url = str_replace( array( 'http://', 'https://', 'http://www.', 'https://www.', 'www.' ), '', $url );
|
161 |
+
$url = str_replace( $host, '', $url );
|
162 |
+
|
163 |
+
$url = trim( $url );
|
164 |
+
$url = ltrim( $url, '/' );
|
165 |
+
$url = rtrim( $url, '/' );
|
166 |
+
|
167 |
+
return $url;
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Check if needle URL (full or relative) matches with current.
|
175 |
+
* @todo: review and test
|
176 |
+
*/
|
177 |
+
if( !function_exists( 'pys_match_url' ) ) {
|
178 |
+
|
179 |
+
function pys_match_url( $match_url, $current_url = '' ) {
|
180 |
+
|
181 |
+
// use current url by default
|
182 |
+
if ( ! isset( $current_url ) || empty( $current_url ) ) {
|
183 |
+
$current_url = pys_get_current_url();
|
184 |
+
}
|
185 |
+
|
186 |
+
$current_url = pys_get_relative_path( $current_url );
|
187 |
+
$match_url = pys_get_relative_path( $match_url );
|
188 |
+
|
189 |
+
if ( substr( $match_url, - 1 ) == '*' ) {
|
190 |
+
// if match_url ends with wildcard
|
191 |
+
|
192 |
+
$match_url = rtrim( $match_url, '*' );
|
193 |
+
|
194 |
+
if ( pys_startsWith( $current_url, $match_url ) ) {
|
195 |
+
return true;
|
196 |
+
}
|
197 |
+
|
198 |
+
} else {
|
199 |
+
// exact url
|
200 |
+
|
201 |
+
if ( $current_url == $match_url ) {
|
202 |
+
return true;
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
return false;
|
208 |
+
|
209 |
+
}
|
210 |
+
|
211 |
+
}
|
212 |
+
|
213 |
+
if( !function_exists( 'pys_startsWith' ) ) {
|
214 |
+
|
215 |
+
function pys_startsWith( $haystack, $needle ) {
|
216 |
+
// search backwards starting from haystack length characters from the end
|
217 |
+
return $needle === "" || strrpos( $haystack, $needle, - strlen( $haystack ) ) !== false;
|
218 |
+
}
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
if( !function_exists( 'pys_endsWith' ) ) {
|
223 |
+
|
224 |
+
function pys_endsWith( $haystack, $needle ) {
|
225 |
+
// search forward starting from end minus needle length characters
|
226 |
+
return $needle === "" || ( ( $temp = strlen( $haystack ) - strlen( $needle ) ) >= 0 && strpos( $haystack, $needle, $temp ) !== false );
|
227 |
+
}
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Clean string to be UTF-8
|
233 |
+
*/
|
234 |
+
if( !function_exists( 'pys_clean_param_value' ) ) {
|
235 |
+
|
236 |
+
function pys_clean_param_value( $value ) {
|
237 |
+
|
238 |
+
$replace = array(
|
239 |
+
'<' => '',
|
240 |
+
'>' => '',
|
241 |
+
''' => '',
|
242 |
+
'&' => '',
|
243 |
+
'"' => '',
|
244 |
+
'À' => 'A',
|
245 |
+
'Á' => 'A',
|
246 |
+
'Â' => 'A',
|
247 |
+
'Ã' => 'A',
|
248 |
+
'Ä' => 'Ae',
|
249 |
+
'Ä' => 'A',
|
250 |
+
'Å' => 'A',
|
251 |
+
'Ā' => 'A',
|
252 |
+
'Ą' => 'A',
|
253 |
+
'Ă' => 'A',
|
254 |
+
'Æ' => 'Ae',
|
255 |
+
'Ç' => 'C',
|
256 |
+
'Ć' => 'C',
|
257 |
+
'Č' => 'C',
|
258 |
+
'Ĉ' => 'C',
|
259 |
+
'Ċ' => 'C',
|
260 |
+
'Ď' => 'D',
|
261 |
+
'Đ' => 'D',
|
262 |
+
'Ð' => 'D',
|
263 |
+
'È' => 'E',
|
264 |
+
'É' => 'E',
|
265 |
+
'Ê' => 'E',
|
266 |
+
'Ë' => 'E',
|
267 |
+
'Ē' => 'E',
|
268 |
+
'Ę' => 'E',
|
269 |
+
'Ě' => 'E',
|
270 |
+
'Ĕ' => 'E',
|
271 |
+
'Ė' => 'E',
|
272 |
+
'Ĝ' => 'G',
|
273 |
+
'Ğ' => 'G',
|
274 |
+
'Ġ' => 'G',
|
275 |
+
'Ģ' => 'G',
|
276 |
+
'Ĥ' => 'H',
|
277 |
+
'Ħ' => 'H',
|
278 |
+
'Ì' => 'I',
|
279 |
+
'Í' => 'I',
|
280 |
+
'Î' => 'I',
|
281 |
+
'Ï' => 'I',
|
282 |
+
'Ī' => 'I',
|
283 |
+
'Ĩ' => 'I',
|
284 |
+
'Ĭ' => 'I',
|
285 |
+
'Į' => 'I',
|
286 |
+
'İ' => 'I',
|
287 |
+
'IJ' => 'IJ',
|
288 |
+
'Ĵ' => 'J',
|
289 |
+
'Ķ' => 'K',
|
290 |
+
'Ł' => 'K',
|
291 |
+
'Ľ' => 'K',
|
292 |
+
'Ĺ' => 'K',
|
293 |
+
'Ļ' => 'K',
|
294 |
+
'Ŀ' => 'K',
|
295 |
+
'Ñ' => 'N',
|
296 |
+
'Ń' => 'N',
|
297 |
+
'Ň' => 'N',
|
298 |
+
'Ņ' => 'N',
|
299 |
+
'Ŋ' => 'N',
|
300 |
+
'Ò' => 'O',
|
301 |
+
'Ó' => 'O',
|
302 |
+
'Ô' => 'O',
|
303 |
+
'Õ' => 'O',
|
304 |
+
'Ö' => 'Oe',
|
305 |
+
'Ö' => 'Oe',
|
306 |
+
'Ø' => 'O',
|
307 |
+
'Ō' => 'O',
|
308 |
+
'Ő' => 'O',
|
309 |
+
'Ŏ' => 'O',
|
310 |
+
'Œ' => 'OE',
|
311 |
+
'Ŕ' => 'R',
|
312 |
+
'Ř' => 'R',
|
313 |
+
'Ŗ' => 'R',
|
314 |
+
'Ś' => 'S',
|
315 |
+
'Š' => 'S',
|
316 |
+
'Ş' => 'S',
|
317 |
+
'Ŝ' => 'S',
|
318 |
+
'Ș' => 'S',
|
319 |
+
'Ť' => 'T',
|
320 |
+
'Ţ' => 'T',
|
321 |
+
'Ŧ' => 'T',
|
322 |
+
'Ț' => 'T',
|
323 |
+
'Ù' => 'U',
|
324 |
+
'Ú' => 'U',
|
325 |
+
'Û' => 'U',
|
326 |
+
'Ü' => 'Ue',
|
327 |
+
'Ū' => 'U',
|
328 |
+
'Ü' => 'Ue',
|
329 |
+
'Ů' => 'U',
|
330 |
+
'Ű' => 'U',
|
331 |
+
'Ŭ' => 'U',
|
332 |
+
'Ũ' => 'U',
|
333 |
+
'Ų' => 'U',
|
334 |
+
'Ŵ' => 'W',
|
335 |
+
'Ý' => 'Y',
|
336 |
+
'Ŷ' => 'Y',
|
337 |
+
'Ÿ' => 'Y',
|
338 |
+
'Ź' => 'Z',
|
339 |
+
'Ž' => 'Z',
|
340 |
+
'Ż' => 'Z',
|
341 |
+
'Þ' => 'T',
|
342 |
+
'à' => 'a',
|
343 |
+
'á' => 'a',
|
344 |
+
'â' => 'a',
|
345 |
+
'ã' => 'a',
|
346 |
+
'ä' => 'ae',
|
347 |
+
'ä' => 'ae',
|
348 |
+
'å' => 'a',
|
349 |
+
'ā' => 'a',
|
350 |
+
'ą' => 'a',
|
351 |
+
'ă' => 'a',
|
352 |
+
'æ' => 'ae',
|
353 |
+
'ç' => 'c',
|
354 |
+
'ć' => 'c',
|
355 |
+
'č' => 'c',
|
356 |
+
'ĉ' => 'c',
|
357 |
+
'ċ' => 'c',
|
358 |
+
'ď' => 'd',
|
359 |
+
'đ' => 'd',
|
360 |
+
'ð' => 'd',
|
361 |
+
'è' => 'e',
|
362 |
+
'é' => 'e',
|
363 |
+
'ê' => 'e',
|
364 |
+
'ë' => 'e',
|
365 |
+
'ē' => 'e',
|
366 |
+
'ę' => 'e',
|
367 |
+
'ě' => 'e',
|
368 |
+
'ĕ' => 'e',
|
369 |
+
'ė' => 'e',
|
370 |
+
'ƒ' => 'f',
|
371 |
+
'ĝ' => 'g',
|
372 |
+
'ğ' => 'g',
|
373 |
+
'ġ' => 'g',
|
374 |
+
'ģ' => 'g',
|
375 |
+
'ĥ' => 'h',
|
376 |
+
'ħ' => 'h',
|
377 |
+
'ì' => 'i',
|
378 |
+
'í' => 'i',
|
379 |
+
'î' => 'i',
|
380 |
+
'ï' => 'i',
|
381 |
+
'ī' => 'i',
|
382 |
+
'ĩ' => 'i',
|
383 |
+
'ĭ' => 'i',
|
384 |
+
'į' => 'i',
|
385 |
+
'ı' => 'i',
|
386 |
+
'ij' => 'ij',
|
387 |
+
'ĵ' => 'j',
|
388 |
+
'ķ' => 'k',
|
389 |
+
'ĸ' => 'k',
|
390 |
+
'ł' => 'l',
|
391 |
+
'ľ' => 'l',
|
392 |
+
'ĺ' => 'l',
|
393 |
+
'ļ' => 'l',
|
394 |
+
'ŀ' => 'l',
|
395 |
+
'ñ' => 'n',
|
396 |
+
'ń' => 'n',
|
397 |
+
'ň' => 'n',
|
398 |
+
'ņ' => 'n',
|
399 |
+
'ʼn' => 'n',
|
400 |
+
'ŋ' => 'n',
|
401 |
+
'ò' => 'o',
|
402 |
+
'ó' => 'o',
|
403 |
+
'ô' => 'o',
|
404 |
+
'õ' => 'o',
|
405 |
+
'ö' => 'oe',
|
406 |
+
'ö' => 'oe',
|
407 |
+
'ø' => 'o',
|
408 |
+
'ō' => 'o',
|
409 |
+
'ő' => 'o',
|
410 |
+
'ŏ' => 'o',
|
411 |
+
'œ' => 'oe',
|
412 |
+
'ŕ' => 'r',
|
413 |
+
'ř' => 'r',
|
414 |
+
'ŗ' => 'r',
|
415 |
+
'š' => 's',
|
416 |
+
'ù' => 'u',
|
417 |
+
'ú' => 'u',
|
418 |
+
'û' => 'u',
|
419 |
+
'ü' => 'ue',
|
420 |
+
'ū' => 'u',
|
421 |
+
'ü' => 'ue',
|
422 |
+
'ů' => 'u',
|
423 |
+
'ű' => 'u',
|
424 |
+
'ŭ' => 'u',
|
425 |
+
'ũ' => 'u',
|
426 |
+
'ų' => 'u',
|
427 |
+
'ŵ' => 'w',
|
428 |
+
'ý' => 'y',
|
429 |
+
'ÿ' => 'y',
|
430 |
+
'ŷ' => 'y',
|
431 |
+
'ž' => 'z',
|
432 |
+
'ż' => 'z',
|
433 |
+
'ź' => 'z',
|
434 |
+
'þ' => 't',
|
435 |
+
'ß' => 'ss',
|
436 |
+
'ſ' => 'ss',
|
437 |
+
'ый' => 'iy',
|
438 |
+
'А' => 'A',
|
439 |
+
'Б' => 'B',
|
440 |
+
'В' => 'V',
|
441 |
+
'Г' => 'G',
|
442 |
+
'Д' => 'D',
|
443 |
+
'Е' => 'E',
|
444 |
+
'Ё' => 'YO',
|
445 |
+
'Ж' => 'ZH',
|
446 |
+
'З' => 'Z',
|
447 |
+
'И' => 'I',
|
448 |
+
'Й' => 'Y',
|
449 |
+
'К' => 'K',
|
450 |
+
'Л' => 'L',
|
451 |
+
'М' => 'M',
|
452 |
+
'Н' => 'N',
|
453 |
+
'О' => 'O',
|
454 |
+
'П' => 'P',
|
455 |
+
'Р' => 'R',
|
456 |
+
'С' => 'S',
|
457 |
+
'Т' => 'T',
|
458 |
+
'У' => 'U',
|
459 |
+
'Ф' => 'F',
|
460 |
+
'Х' => 'H',
|
461 |
+
'Ц' => 'C',
|
462 |
+
'Ч' => 'CH',
|
463 |
+
'Ш' => 'SH',
|
464 |
+
'Щ' => 'SCH',
|
465 |
+
'Ъ' => '',
|
466 |
+
'Ы' => 'Y',
|
467 |
+
'Ь' => '',
|
468 |
+
'Э' => 'E',
|
469 |
+
'Ю' => 'YU',
|
470 |
+
'Я' => 'YA',
|
471 |
+
'а' => 'a',
|
472 |
+
'б' => 'b',
|
473 |
+
'в' => 'v',
|
474 |
+
'г' => 'g',
|
475 |
+
'д' => 'd',
|
476 |
+
'е' => 'e',
|
477 |
+
'ё' => 'yo',
|
478 |
+
'ж' => 'zh',
|
479 |
+
'з' => 'z',
|
480 |
+
'и' => 'i',
|
481 |
+
'й' => 'y',
|
482 |
+
'к' => 'k',
|
483 |
+
'л' => 'l',
|
484 |
+
'м' => 'm',
|
485 |
+
'н' => 'n',
|
486 |
+
'о' => 'o',
|
487 |
+
'п' => 'p',
|
488 |
+
'р' => 'r',
|
489 |
+
'с' => 's',
|
490 |
+
'т' => 't',
|
491 |
+
'у' => 'u',
|
492 |
+
'ф' => 'f',
|
493 |
+
'х' => 'h',
|
494 |
+
'ц' => 'c',
|
495 |
+
'ч' => 'ch',
|
496 |
+
'ш' => 'sh',
|
497 |
+
'щ' => 'sch',
|
498 |
+
'ъ' => '',
|
499 |
+
'ы' => 'y',
|
500 |
+
'ь' => '',
|
501 |
+
'э' => 'e',
|
502 |
+
'ю' => 'yu',
|
503 |
+
'я' => 'ya'
|
504 |
+
);
|
505 |
+
|
506 |
+
$value = str_replace( array_keys( $replace ), $replace, $value );
|
507 |
+
//$value = preg_replace('/[^A-Za-z0-9\\x{0590}-\\x{05FF}\p{Arabic}]/u',' ', strip_tags($value));
|
508 |
+
$value = preg_replace( '/[^A-Za-z0-9\p{Hebrew}\p{Arabic}]/u', ' ', strip_tags( $value ) );
|
509 |
+
$value = preg_replace( '/ {2,}/', ' ', $value );
|
510 |
+
|
511 |
+
return trim( $value );
|
512 |
+
|
513 |
+
}
|
514 |
+
|
515 |
+
}
|
516 |
+
|
517 |
+
if( !function_exists( 'pys_currency_options' ) ) {
|
518 |
+
|
519 |
+
function pys_currency_options( $current = 'USD' ) {
|
520 |
+
?>
|
521 |
+
|
522 |
+
<option <?php echo selected( 'AUD', $current, true ); ?> value="AUD">Australian Dollar</option>
|
523 |
+
<option <?php echo selected( 'BRL', $current, true ); ?> value="BRL">Brazilian Real</option>
|
524 |
+
<option <?php echo selected( 'CAD', $current, true ); ?> value="CAD">Canadian Dollar</option>
|
525 |
+
<option <?php echo selected( 'CZK', $current, true ); ?> value="CZK">Czech Koruna</option>
|
526 |
+
<option <?php echo selected( 'DKK', $current, true ); ?> value="DKK">Danish Krone</option>
|
527 |
+
<option <?php echo selected( 'EUR', $current, true ); ?> value="EUR">Euro</option>
|
528 |
+
<option <?php echo selected( 'HKD', $current, true ); ?> value="HKD">Hong Kong Dollar</option>
|
529 |
+
<option <?php echo selected( 'HUF', $current, true ); ?> value="HUF">Hungarian Forint</option>
|
530 |
+
<option <?php echo selected( 'IDR', $current, true ); ?> value="IDR">Indonesian Rupiah</option>
|
531 |
+
<option <?php echo selected( 'ILS', $current, true ); ?> value="ILS">Israeli New Sheqel</option>
|
532 |
+
<option <?php echo selected( 'JPY', $current, true ); ?> value="JPY">Japanese Yen</option>
|
533 |
+
<option <?php echo selected( 'KRW', $current, true ); ?> value="KRW">Korean Won</option>
|
534 |
+
<option <?php echo selected( 'MYR', $current, true ); ?> value="MYR">Malaysian Ringgit</option>
|
535 |
+
<option <?php echo selected( 'MXN', $current, true ); ?> value="MXN">Mexican Peso</option>
|
536 |
+
<option <?php echo selected( 'NOK', $current, true ); ?> value="NOK">Norwegian Krone</option>
|
537 |
+
<option <?php echo selected( 'NZD', $current, true ); ?> value="NZD">New Zealand Dollar</option>
|
538 |
+
<option <?php echo selected( 'PHP', $current, true ); ?> value="PHP">Philippine Peso</option>
|
539 |
+
<option <?php echo selected( 'PLN', $current, true ); ?> value="PLN">Polish Zloty</option>
|
540 |
+
<option <?php echo selected( 'RON', $current, true ); ?> value="RON">Romanian Leu</option>
|
541 |
+
<option <?php echo selected( 'GBP', $current, true ); ?> value="GBP">Pound Sterling</option>
|
542 |
+
<option <?php echo selected( 'SGD', $current, true ); ?> value="SGD">Singapore Dollar</option>
|
543 |
+
<option <?php echo selected( 'SEK', $current, true ); ?> value="SEK">Swedish Krona</option>
|
544 |
+
<option <?php echo selected( 'CHF', $current, true ); ?> value="CHF">Swiss Franc</option>
|
545 |
+
<option <?php echo selected( 'TWD', $current, true ); ?> value="TWD">Taiwan New Dollar</option>
|
546 |
+
<option <?php echo selected( 'THB', $current, true ); ?> value="THB">Thai Baht</option>
|
547 |
+
<option <?php echo selected( 'TRY', $current, true ); ?> value="TRY">Turkish Lira</option>
|
548 |
+
<option <?php echo selected( 'USD', $current, true ); ?> value="USD">U.S. Dollar</option>
|
549 |
+
<option <?php echo selected( 'ZAR', $current, true ); ?> value="USD">South African Rands</option>
|
550 |
+
|
551 |
+
<?php
|
552 |
+
}
|
553 |
+
|
554 |
+
}
|
555 |
+
|
556 |
+
/**
|
557 |
+
* Build taxonomies list for current post.
|
558 |
+
* Examples:
|
559 |
+
* Cat1, Cat2;
|
560 |
+
* Cat1, Cat2 > Cat3; Movie1; Tax1 > Tax2
|
561 |
+
*/
|
562 |
+
if( !function_exists( 'pys_get_content_taxonomies' ) ) {
|
563 |
+
|
564 |
+
function pys_get_content_taxonomies( $taxonomy = 'category', $id = null ) {
|
565 |
+
|
566 |
+
$post_id = isset( $id ) ? $id : get_the_ID();
|
567 |
+
$tax = get_the_terms( $post_id, $taxonomy );
|
568 |
+
|
569 |
+
if ( is_wp_error( $tax ) || empty ( $tax ) ) {
|
570 |
+
return false;
|
571 |
+
}
|
572 |
+
|
573 |
+
$tree = pys_build_taxonomy_tree( $tax );
|
574 |
+
|
575 |
+
return pys_explode_taxonomies( $tree );
|
576 |
+
|
577 |
+
}
|
578 |
+
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Build hierarchy tree array from array of WP_Terms.
|
583 |
+
*/
|
584 |
+
if( !function_exists( 'pys_build_taxonomy_tree' ) ) {
|
585 |
+
|
586 |
+
function pys_build_taxonomy_tree( array $wp_terms ) {
|
587 |
+
|
588 |
+
// convert WP_Term objects to array
|
589 |
+
$terms = array();
|
590 |
+
foreach ( $wp_terms as $id => $term ) {
|
591 |
+
$terms[ $id ] = array(
|
592 |
+
'id' => $term->term_id,
|
593 |
+
'parent' => $term->parent,
|
594 |
+
'name' => $term->name
|
595 |
+
);
|
596 |
+
}
|
597 |
+
|
598 |
+
// build tree
|
599 |
+
$tree = array();
|
600 |
+
$references = array();
|
601 |
+
foreach ( $terms as $id => &$node ) {
|
602 |
+
|
603 |
+
$references[ $node['id'] ] = &$node;
|
604 |
+
|
605 |
+
if ( $node['parent'] == 0 ) {
|
606 |
+
|
607 |
+
// it is root node. add direct to tree root
|
608 |
+
$tree[ $node['id'] ] = &$node;
|
609 |
+
|
610 |
+
} else {
|
611 |
+
|
612 |
+
// it is child node. add to parent 'children'
|
613 |
+
$references[ $node['parent'] ]['children'][ $node['id'] ] = &$node;
|
614 |
+
|
615 |
+
}
|
616 |
+
|
617 |
+
}
|
618 |
+
|
619 |
+
return $tree;
|
620 |
+
}
|
621 |
+
|
622 |
+
}
|
623 |
+
|
624 |
+
/**
|
625 |
+
* Format taxonomies tree to string.
|
626 |
+
*/
|
627 |
+
if( !function_exists( 'pys_explode_taxonomies' ) ) {
|
628 |
+
|
629 |
+
function pys_explode_taxonomies( $tree ) {
|
630 |
+
|
631 |
+
$str = '';
|
632 |
+
foreach ( $tree as $node ) {
|
633 |
+
|
634 |
+
if ( isset( $node['children'] ) && count( $node['children'] ) ) {
|
635 |
+
|
636 |
+
$str .= $node['name'] . ' > ';
|
637 |
+
$str .= pys_explode_taxonomies( $node['children'] );
|
638 |
+
|
639 |
+
} else {
|
640 |
+
|
641 |
+
$str .= $node['name'] . '; ';
|
642 |
+
|
643 |
+
}
|
644 |
+
}
|
645 |
+
|
646 |
+
return $str;
|
647 |
+
|
648 |
+
}
|
649 |
+
|
650 |
+
}
|
651 |
+
|
652 |
+
if( !function_exists( 'pys_get_noscript_code' ) ) {
|
653 |
+
|
654 |
+
function pys_get_noscript_code( $type, $params ) {
|
655 |
+
|
656 |
+
$args = array();
|
657 |
+
|
658 |
+
$args['id'] = pys_get_option( 'general', 'pixel_id' );
|
659 |
+
$args['ev'] = $type;
|
660 |
+
$args['noscript'] = 1;
|
661 |
+
|
662 |
+
foreach ( $params as $param => $value ) {
|
663 |
+
@$args[ 'cd[' . $param . ']' ] .= urlencode( $value );
|
664 |
+
}
|
665 |
+
|
666 |
+
$src = add_query_arg( $args, 'https://www.facebook.com/tr' );
|
667 |
+
|
668 |
+
$nojscode = "<noscript>\n";
|
669 |
+
$nojscode .= "<img height='1' width='1' style='display:none' src='" . $src . "'>\n";
|
670 |
+
$nojscode .= "</noscript>";
|
671 |
+
$nojscode .= "\n\n";
|
672 |
+
|
673 |
+
return $nojscode;
|
674 |
+
|
675 |
+
}
|
676 |
+
|
677 |
+
}
|
678 |
+
|
679 |
+
/**
|
680 |
+
* Prepare event code string for Standard Event.
|
681 |
+
*/
|
682 |
+
if( !function_exists( 'pys_get_event_code' ) ) {
|
683 |
+
|
684 |
+
//@todo: replace this function with `pys_build_event_pixel_code`
|
685 |
+
function pys_get_event_code( $event ) {
|
686 |
+
|
687 |
+
$result = array();
|
688 |
+
|
689 |
+
// remember event type
|
690 |
+
$type = $event['eventtype'];
|
691 |
+
|
692 |
+
// remove unused params
|
693 |
+
unset( $event['pageurl'] );
|
694 |
+
unset( $event['eventtype'] );
|
695 |
+
unset( $event['code'] );
|
696 |
+
unset( $event['trigger_type'] ); // pro
|
697 |
+
unset( $event['url'] ); // pro
|
698 |
+
unset( $event['css'] ); // pro
|
699 |
+
unset( $event['custom_name'] ); // custom events
|
700 |
+
|
701 |
+
if ( $event['content_type'] == 'none' ) {
|
702 |
+
unset( $event['content_type'] );
|
703 |
+
}
|
704 |
+
|
705 |
+
$track = pys_is_standard_event( $type ) ? 'track' : 'trackCustom';
|
706 |
+
|
707 |
+
// @todo: sanitize event type name
|
708 |
+
|
709 |
+
$js_str = "";
|
710 |
+
$nojs_params = array();
|
711 |
+
|
712 |
+
// build js and no js codes from params
|
713 |
+
if ( isset( $event ) && ! empty( $event ) ) {
|
714 |
+
foreach ( $event as $param => $value ) {
|
715 |
+
|
716 |
+
if ( empty( $value ) ) {
|
717 |
+
continue;
|
718 |
+
}
|
719 |
+
|
720 |
+
$val = pys_clean_param_value( $value );
|
721 |
+
|
722 |
+
$js_str .= "$param: '" . $val . "', ";
|
723 |
+
$nojs_params[ $param ] = $val;
|
724 |
+
|
725 |
+
}
|
726 |
+
}
|
727 |
+
|
728 |
+
$result['js'] = "fbq('$track', '$type', {" . $js_str . "} );";
|
729 |
+
$result['nojs'] = pys_get_noscript_code( $type, $nojs_params );
|
730 |
+
|
731 |
+
return $result;
|
732 |
+
}
|
733 |
+
|
734 |
+
}
|
735 |
+
|
736 |
+
if( !function_exists( 'pys_build_event_pixel_code' ) ) {
|
737 |
+
|
738 |
+
function pys_build_event_pixel_code( $name, array $params, $type ) {
|
739 |
+
|
740 |
+
$result = array();
|
741 |
+
|
742 |
+
// explode params to formatted string
|
743 |
+
$js_str = "";
|
744 |
+
$nojs_params = array();
|
745 |
+
foreach ( $params as $param => $value ) {
|
746 |
+
|
747 |
+
// skip cleanup
|
748 |
+
if ( ! in_array( $param, array( 'content_ids', 'value', 'time' ) ) ) {
|
749 |
+
$value = pys_clean_param_value( $value );
|
750 |
+
}
|
751 |
+
|
752 |
+
$js_str .= "$param: '" . $value . "', ";
|
753 |
+
$nojs_params[ $param ] = $value;
|
754 |
+
|
755 |
+
}
|
756 |
+
|
757 |
+
$track = pys_is_standard_event( $type ) ? 'track' : 'trackCustom';
|
758 |
+
|
759 |
+
// build complete event pixel code
|
760 |
+
if ( $name ) {
|
761 |
+
$pixelcode = "// " . ucfirst( $name ) . " Event \n";
|
762 |
+
$pixelcode .= "fbq('$track', '$type', { $js_str } );";
|
763 |
+
$pixelcode .= "\n\n";
|
764 |
+
} else {
|
765 |
+
$pixelcode = "fbq('$track', '$type', { $js_str } );";
|
766 |
+
}
|
767 |
+
|
768 |
+
$nojscode = "<!-- " . ucfirst( $name ) . " Event -->\n";
|
769 |
+
$nojscode .= pys_get_noscript_code( $type, $nojs_params );
|
770 |
+
|
771 |
+
$result['js'] = $pixelcode;
|
772 |
+
$result['nojs'] = $nojscode;
|
773 |
+
|
774 |
+
return $result;
|
775 |
+
}
|
776 |
+
|
777 |
+
}
|
778 |
+
|
779 |
+
/**
|
780 |
+
* Return product id or sku.
|
781 |
+
*/
|
782 |
+
if( !function_exists( 'pys_get_product_content_id' ) ) {
|
783 |
+
|
784 |
+
function pys_get_product_content_id( $product_id ) {
|
785 |
+
global $wpdb;
|
786 |
+
|
787 |
+
if ( pys_get_option( 'woo', 'content_id' ) == 'sku' ) {
|
788 |
+
|
789 |
+
$sku = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_sku' AND post_id='%s' LIMIT 1", $product_id ) );
|
790 |
+
|
791 |
+
return '"' . $sku . '"';
|
792 |
+
|
793 |
+
} else {
|
794 |
+
|
795 |
+
return $product_id;
|
796 |
+
|
797 |
+
}
|
798 |
+
|
799 |
+
}
|
800 |
+
|
801 |
+
}
|
802 |
+
|
803 |
+
/**
|
804 |
+
* Return main or variation product id.
|
805 |
+
*/
|
806 |
+
if( !function_exists( 'pys_get_product_id' ) ) {
|
807 |
+
|
808 |
+
function pys_get_product_id( $product ) {
|
809 |
+
|
810 |
+
$id = $product['product_id'];
|
811 |
+
|
812 |
+
if ( pys_get_option( 'woo', 'variation_id' ) == 'variation' && isset( $product['variation_id'] ) && $product['variation_id'] != 0 ) {
|
813 |
+
$id = $product['variation_id'];
|
814 |
+
}
|
815 |
+
|
816 |
+
return $id;
|
817 |
+
}
|
818 |
+
|
819 |
+
}
|
820 |
+
|
821 |
+
/**
|
822 |
+
* Add attribute with value to a HTML tag.
|
823 |
+
* @param $attr_name
|
824 |
+
* @param $attr_value
|
825 |
+
* @param $tag
|
826 |
+
*/
|
827 |
+
if( !function_exists( 'pys_insert_attribute' ) ) {
|
828 |
+
|
829 |
+
function pys_insert_attribute( $attr_name, $attr_value, $tag, $overwrite = false ) {
|
830 |
+
|
831 |
+
$old_value = false;
|
832 |
+
$is_javascript = strpos( $attr_name, 'on' ) === 0; // like onclick, onmouseup, onload, etc.
|
833 |
+
$quote = false; // quotes format. ' or "
|
834 |
+
|
835 |
+
$attr_value = trim( $attr_value );
|
836 |
+
|
837 |
+
// check if attribute already exist on tag
|
838 |
+
if ( preg_match( '#\s' . $attr_name . '="([^"]*)"#iu', $tag, $matches )
|
839 |
+
|| preg_match( '#\s' . $attr_name . "='([^']*)'#iu", $tag, $matches )
|
840 |
+
) {
|
841 |
+
|
842 |
+
$old_value = $matches[1];
|
843 |
+
$quote = false !== stripos( $tag, $attr_name . "='" ) ? "'" : '"';
|
844 |
+
|
845 |
+
}
|
846 |
+
|
847 |
+
// attribute does not currently exist, add it
|
848 |
+
if ( false === $old_value ) {
|
849 |
+
return str_ireplace( '>', " $attr_name=\"" . esc_attr( $attr_value ) . '">', $tag );
|
850 |
+
}
|
851 |
+
|
852 |
+
// overwrite existing value
|
853 |
+
if ( $overwrite ) {
|
854 |
+
return str_ireplace( "$attr_name=" . $quote . "$old_value" . $quote,
|
855 |
+
$attr_name . '="' . esc_attr( $attr_value ) . '"', $tag );
|
856 |
+
}
|
857 |
+
|
858 |
+
if ( $is_javascript ) {
|
859 |
+
|
860 |
+
// new attribute value should use correct quotes
|
861 |
+
$attr_value = $quote == "'" ? str_replace( $quote, '"', $attr_value ) : $attr_value;
|
862 |
+
|
863 |
+
// this is a javascript attribute ensure we must add code after any existing codes
|
864 |
+
$attr_value = ( $last_char = substr( trim( $old_value ), - 1 ) ) && $last_char != '}' && $last_char != ';'
|
865 |
+
? $old_value . ';' . $attr_value
|
866 |
+
: $old_value . $attr_value;
|
867 |
+
|
868 |
+
} else {
|
869 |
+
// regular attribute, simply append new attribute values if they're not already there
|
870 |
+
|
871 |
+
if ( 0 === stripos( $old_value, $attr_value ) ) {
|
872 |
+
|
873 |
+
// attribute value already exists, no need to add anything
|
874 |
+
|
875 |
+
} else {
|
876 |
+
|
877 |
+
// add new attribute value
|
878 |
+
$attr_value = $old_value . ' ' . $attr_value;
|
879 |
+
|
880 |
+
}
|
881 |
+
|
882 |
+
}
|
883 |
+
|
884 |
+
return str_ireplace( "$attr_name=" . $quote . "$old_value" . $quote,
|
885 |
+
$attr_name . '="' . esc_attr( $attr_value ) . '"', $tag );
|
886 |
+
|
887 |
+
}
|
888 |
+
|
889 |
+
}
|
890 |
+
|
891 |
+
if( !function_exists( 'pys_convert_quotes' ) ) {
|
892 |
+
|
893 |
+
function pys_convert_quotes( $str ) {
|
894 |
+
|
895 |
+
$chr_map = array(
|
896 |
+
// Windows codepage 1252
|
897 |
+
"\xC2\x82" => "'", // U+0082⇒U+201A single low-9 quotation mark
|
898 |
+
"\xC2\x84" => '"', // U+0084⇒U+201E double low-9 quotation mark
|
899 |
+
"\xC2\x8B" => "'", // U+008B⇒U+2039 single left-pointing angle quotation mark
|
900 |
+
"\xC2\x91" => "'", // U+0091⇒U+2018 left single quotation mark
|
901 |
+
"\xC2\x92" => "'", // U+0092⇒U+2019 right single quotation mark
|
902 |
+
"\xC2\x93" => '"', // U+0093⇒U+201C left double quotation mark
|
903 |
+
"\xC2\x94" => '"', // U+0094⇒U+201D right double quotation mark
|
904 |
+
"\xC2\x9B" => "'", // U+009B⇒U+203A single right-pointing angle quotation mark
|
905 |
+
|
906 |
+
// Regular Unicode // U+0022 quotation mark (")
|
907 |
+
// U+0027 apostrophe (')
|
908 |
+
"\xC2\xAB" => '"', // U+00AB left-pointing double angle quotation mark
|
909 |
+
"\xC2\xBB" => '"', // U+00BB right-pointing double angle quotation mark
|
910 |
+
"\xE2\x80\x98" => "'", // U+2018 left single quotation mark
|
911 |
+
"\xE2\x80\x99" => "'", // U+2019 right single quotation mark
|
912 |
+
"\xE2\x80\x9A" => "'", // U+201A single low-9 quotation mark
|
913 |
+
"\xE2\x80\x9B" => "'", // U+201B single high-reversed-9 quotation mark
|
914 |
+
"\xE2\x80\x9C" => '"', // U+201C left double quotation mark
|
915 |
+
"\xE2\x80\x9D" => '"', // U+201D right double quotation mark
|
916 |
+
"\xE2\x80\x9E" => '"', // U+201E double low-9 quotation mark
|
917 |
+
"\xE2\x80\x9F" => '"', // U+201F double high-reversed-9 quotation mark
|
918 |
+
"\xE2\x80\xB9" => "'", // U+2039 single left-pointing angle quotation mark
|
919 |
+
"\xE2\x80\xBA" => "'", // U+203A single right-pointing angle quotation mark
|
920 |
+
);
|
921 |
+
|
922 |
+
$chr = array_keys( $chr_map ); // but: for efficiency you should
|
923 |
+
$rpl = array_values( $chr_map ); // pre-calculate these two arrays
|
924 |
+
$str = str_replace( $chr, $rpl, html_entity_decode( $str, ENT_QUOTES, "UTF-8" ) );
|
925 |
+
|
926 |
+
return $str;
|
927 |
+
}
|
928 |
+
|
929 |
+
}
|
930 |
+
|
931 |
+
/**
|
932 |
+
* Output pixel code.
|
933 |
+
*/
|
934 |
+
if( !function_exists( 'pys_pixel_code' ) ) {
|
935 |
+
|
936 |
+
function pys_pixel_code() {
|
937 |
+
|
938 |
+
// put pixel only on front-end
|
939 |
+
if ( is_admin() ) {
|
940 |
+
return;
|
941 |
+
}
|
942 |
+
|
943 |
+
// if pixel setup disabled
|
944 |
+
if ( pys_get_option( 'general', 'enabled' ) == false ) {
|
945 |
+
return;
|
946 |
+
}
|
947 |
+
|
948 |
+
// if ID is not set
|
949 |
+
$pixel_id = pys_get_option( 'general', 'pixel_id' );
|
950 |
+
if ( ! isset( $pixel_id ) || empty( $pixel_id ) ) {
|
951 |
+
return;
|
952 |
+
}
|
953 |
+
|
954 |
+
// if disabled for current role
|
955 |
+
$disabled_roles = get_option( 'pixel_your_site' );
|
956 |
+
$user = wp_get_current_user();
|
957 |
+
foreach ( (array) $user->roles as $role ) {
|
958 |
+
|
959 |
+
if ( array_key_exists( "disable_for_$role", $disabled_roles['general'] ) ) {
|
960 |
+
return;
|
961 |
+
}
|
962 |
+
|
963 |
+
}
|
964 |
+
|
965 |
+
// build pixel code...
|
966 |
+
$pixelcode = "\n";
|
967 |
+
$nojscode = "\n";
|
968 |
+
|
969 |
+
// pixel id
|
970 |
+
$pixelcode .= "fbq('init', '$pixel_id' " . pys_get_additional_matching_code() ." ); \n\n";
|
971 |
+
|
972 |
+
// default event
|
973 |
+
$pixelcode .= "// Default Event \n" . "fbq('track', 'PageView');" . "\n\n";
|
974 |
+
$nojscode .= "<!-- Default Event -->\n" . pys_get_noscript_code( 'PageView', array() );
|
975 |
+
|
976 |
+
// general event
|
977 |
+
if ( pys_get_option( 'general', 'general_event_enabled' ) ) {
|
978 |
+
|
979 |
+
$code = pys_get_general_event_code();
|
980 |
+
|
981 |
+
$pixelcode .= $code['js'];
|
982 |
+
$nojscode .= $code['nojs'];
|
983 |
+
|
984 |
+
}
|
985 |
+
|
986 |
+
// search event
|
987 |
+
if ( pys_get_option( 'general', 'search_event_enabled' ) && is_search() ) {
|
988 |
+
|
989 |
+
$pixelcode .= "// Search Event \n";
|
990 |
+
$pixelcode .= "fbq('track', 'Search', { search_string: '" . pys_clean_param_value( $_REQUEST['s'] ) . "'} );";
|
991 |
+
$pixelcode .= "\n\n";
|
992 |
+
|
993 |
+
$nojscode .= "<!-- Search Event -->\n";
|
994 |
+
$nojscode .= pys_get_noscript_code( 'Search', array(
|
995 |
+
'search_string' => pys_clean_param_value( $_REQUEST['s'] )
|
996 |
+
) );
|
997 |
+
|
998 |
+
}
|
999 |
+
|
1000 |
+
// add standard events
|
1001 |
+
$std_events = get_option( 'pixel_your_site_std_events' );
|
1002 |
+
if ( pys_get_option( 'std', 'enabled' ) && count( $std_events ) > 0 ) {
|
1003 |
+
|
1004 |
+
foreach ( $std_events as $event ) {
|
1005 |
+
|
1006 |
+
// add event on url's match
|
1007 |
+
if ( pys_match_url( $event['pageurl'] ) ) {
|
1008 |
+
|
1009 |
+
if ( $event['eventtype'] == 'CustomCode' ) {
|
1010 |
+
|
1011 |
+
$custom_code = $event['code'];
|
1012 |
+
$custom_code = stripcslashes( $custom_code );
|
1013 |
+
$custom_code = trim( $custom_code );
|
1014 |
+
|
1015 |
+
$pixelcode .= "// Standard Event (custom code) \n" . $custom_code . " \n\n";
|
1016 |
+
|
1017 |
+
} else {
|
1018 |
+
|
1019 |
+
$event_code = pys_get_event_code( $event );
|
1020 |
+
|
1021 |
+
$pixelcode .= "// Standard Event \n" . $event_code['js'] . " \n\n";
|
1022 |
+
|
1023 |
+
$nojscode .= "<!-- Standard Event -->\n";
|
1024 |
+
$nojscode .= $event_code['nojs'];
|
1025 |
+
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
// add woocommerce events
|
1035 |
+
if ( pys_get_option( 'woo', 'enabled' ) && pys_is_woocommerce_active() ) {
|
1036 |
+
|
1037 |
+
$event_code = pys_get_woo_code();
|
1038 |
+
|
1039 |
+
$pixelcode .= $event_code['js'];
|
1040 |
+
$nojscode .= $event_code['nojs'];
|
1041 |
+
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
// WooCommerce non-ajax AddToCart Event handler
|
1045 |
+
if ( pys_get_option( 'woo', 'enabled' ) && pys_is_woocommerce_active() && isset( $_REQUEST['add-to-cart'] ) ) {
|
1046 |
+
|
1047 |
+
$product_id = isset( $_REQUEST['add-to-cart'] ) ? $_REQUEST['add-to-cart'] : null;
|
1048 |
+
|
1049 |
+
if ( pys_get_option( 'woo', 'variation_id' ) == 'variation' && isset( $_REQUEST['variation_id'] ) ) {
|
1050 |
+
$product_id = $_REQUEST['variation_id'];
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
$params = pys_get_woo_ajax_addtocart_params( $product_id );
|
1054 |
+
$event_code = pys_build_event_pixel_code( 'WooCommerce', $params, 'AddToCart' );
|
1055 |
+
|
1056 |
+
$pixelcode .= $event_code['js'];
|
1057 |
+
$nojscode .= $event_code['nojs'];
|
1058 |
+
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
?>
|
1062 |
+
|
1063 |
+
<!-- Facebook Pixel Code -->
|
1064 |
+
<script>
|
1065 |
+
var PYS_DOMReady = function (a, b, c) {
|
1066 |
+
b = document, c = 'addEventListener';
|
1067 |
+
b[c] ? b[c]('DOMContentLoaded', a) : window.attachEvent('onload', a)
|
1068 |
+
};
|
1069 |
+
!function (f, b, e, v, n, t, s) {
|
1070 |
+
if (f.fbq)return;
|
1071 |
+
n = f.fbq = function () {
|
1072 |
+
n.callMethod ?
|
1073 |
+
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
|
1074 |
+
};
|
1075 |
+
if (!f._fbq)f._fbq = n;
|
1076 |
+
n.push = n;
|
1077 |
+
n.loaded = !0;
|
1078 |
+
n.version = '2.0';
|
1079 |
+
n.queue = [];
|
1080 |
+
t = b.createElement(e);
|
1081 |
+
t.async = !0;
|
1082 |
+
t.src = v;
|
1083 |
+
s = b.getElementsByTagName(e)[0];
|
1084 |
+
s.parentNode.insertBefore(t, s)
|
1085 |
+
}(window,
|
1086 |
+
document, 'script', '//connect.facebook.net/en_US/fbevents.js');
|
1087 |
+
|
1088 |
+
/* pixel plugin code */
|
1089 |
+
PYS_DOMReady(function () {
|
1090 |
+
<?php echo $pixelcode; ?>
|
1091 |
+
});
|
1092 |
+
/* pixel plugin code */
|
1093 |
+
|
1094 |
+
</script>
|
1095 |
+
<!-- End Facebook Pixel Code -->
|
1096 |
+
|
1097 |
+
<?php
|
1098 |
+
|
1099 |
+
// noscript fallback
|
1100 |
+
echo $nojscode;
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
}
|
1104 |
+
|
1105 |
+
/**
|
1106 |
+
* Build General Event code.
|
1107 |
+
*/
|
1108 |
+
if( !function_exists( 'pys_get_general_event_code' ) ) {
|
1109 |
+
|
1110 |
+
function pys_get_general_event_code() {
|
1111 |
+
global $post;
|
1112 |
+
|
1113 |
+
$params = array();
|
1114 |
+
$pys = get_option( 'pixel_your_site' );
|
1115 |
+
$event_name = $pys['general']['general_event_name'];
|
1116 |
+
$post_type = get_post_type();
|
1117 |
+
|
1118 |
+
// Posts
|
1119 |
+
if ( pys_get_option( 'general', 'general_event_on_posts_enabled' ) && is_singular( 'post' ) ) {
|
1120 |
+
|
1121 |
+
$params['content_type'] = 'post';
|
1122 |
+
$params['content_name'] = $post->post_title;
|
1123 |
+
$params['content_ids'] = $post->ID;
|
1124 |
+
|
1125 |
+
$terms = pys_get_content_taxonomies();
|
1126 |
+
if ( $terms ) {
|
1127 |
+
$params['content_category'] = $terms;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
return pys_build_event_pixel_code( 'General', $params, $event_name );
|
1131 |
+
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
// Pages or Front Page
|
1135 |
+
if ( pys_get_option( 'general', 'general_event_on_pages_enabled' ) && ( is_singular( 'page' ) || is_home() ) ) {
|
1136 |
+
|
1137 |
+
// exclude WooCommerce Cart page
|
1138 |
+
if ( pys_is_woocommerce_active() && is_cart() ) {
|
1139 |
+
return false;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
$params['content_type'] = 'page';
|
1143 |
+
$params['content_name'] = is_home() == true ? get_bloginfo( 'name' ) : $post->post_title;
|
1144 |
+
|
1145 |
+
is_home() != true ? $params['content_ids'] = $post->ID : null;
|
1146 |
+
|
1147 |
+
return pys_build_event_pixel_code( 'General', $params, $event_name );
|
1148 |
+
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
// WooCommerce Shop page
|
1152 |
+
if( pys_get_option( 'general', 'general_event_on_pages_enabled' ) && pys_is_woocommerce_active() && is_shop() ) {
|
1153 |
+
|
1154 |
+
$page_id = wc_get_page_id( 'shop' );
|
1155 |
+
|
1156 |
+
$params['content_type'] = 'page';
|
1157 |
+
$params['content_ids'] = $page_id;
|
1158 |
+
$params['content_name'] = get_the_title( $page_id );;
|
1159 |
+
|
1160 |
+
return pys_build_event_pixel_code( 'General', $params, $event_name );
|
1161 |
+
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
// Taxonomies (built-in and custom)
|
1165 |
+
if ( pys_get_option( 'general', 'general_event_on_tax_enabled' ) && ( is_category() || is_tax() || is_tag() ) ) {
|
1166 |
+
|
1167 |
+
$term = null;
|
1168 |
+
$type = null;
|
1169 |
+
|
1170 |
+
if ( is_category() ) {
|
1171 |
+
|
1172 |
+
$cat = get_query_var( 'cat' );
|
1173 |
+
$term = get_category( $cat );
|
1174 |
+
|
1175 |
+
$params['content_type'] = 'category';
|
1176 |
+
$params['content_name'] = $term->name;
|
1177 |
+
$params['content_ids'] = $cat;
|
1178 |
+
|
1179 |
+
} elseif ( is_tag() ) {
|
1180 |
+
|
1181 |
+
$slug = get_query_var( 'tag' );
|
1182 |
+
$term = get_term_by( 'slug', $slug, 'post_tag' );
|
1183 |
+
|
1184 |
+
$params['content_type'] = 'tag';
|
1185 |
+
$params['content_name'] = $term->name;
|
1186 |
+
$params['content_ids'] = $term->term_id;
|
1187 |
+
|
1188 |
+
} else {
|
1189 |
+
|
1190 |
+
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
|
1191 |
+
|
1192 |
+
$params['content_type'] = get_query_var( 'taxonomy' );
|
1193 |
+
$params['content_name'] = $term->name;
|
1194 |
+
$params['content_ids'] = $term->term_id;
|
1195 |
+
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
return pys_build_event_pixel_code( 'General', $params, $event_name );
|
1199 |
+
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
// Custom Post Type
|
1203 |
+
if ( pys_get_option( 'general', 'general_event_on_' . $post_type . '_enabled' )
|
1204 |
+
&& $post_type != 'post' && $post_type != 'page'
|
1205 |
+
) {
|
1206 |
+
|
1207 |
+
// skip products and downloads is plugins are activated
|
1208 |
+
if ( ( pys_is_woocommerce_active() && $post_type == 'product' ) || ( pys_is_edd_active() && $post_type == 'download' ) ) {
|
1209 |
+
return false;
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
$params['content_type'] = $post_type;
|
1213 |
+
$params['content_name'] = $post->post_title;
|
1214 |
+
$params['content_ids'] = $post->ID;
|
1215 |
+
|
1216 |
+
$taxonomies = get_post_taxonomies( get_post() );
|
1217 |
+
$terms = pys_get_content_taxonomies( $taxonomies[0] );
|
1218 |
+
if ( $terms ) {
|
1219 |
+
$params['content_category'] = $terms;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
return pys_build_event_pixel_code( 'General', $params, $event_name );
|
1223 |
+
|
1224 |
+
}
|
1225 |
+
|
1226 |
+
// Easy Digital Downloads
|
1227 |
+
if ( pys_get_option( 'general', 'general_event_on_edd_enabled' ) && pys_is_edd_active() && $post_type == 'download' ) {
|
1228 |
+
|
1229 |
+
$download = new EDD_Download( $post->ID );
|
1230 |
+
|
1231 |
+
$params['content_type'] = 'download';
|
1232 |
+
$params['content_name'] = $download->post_title;
|
1233 |
+
$params['content_ids'] = $post->ID;
|
1234 |
+
$params['value'] = $download->get_price();
|
1235 |
+
$params['currency'] = edd_get_currency();
|
1236 |
+
|
1237 |
+
$terms = pys_get_content_taxonomies( 'download_category' );
|
1238 |
+
if ( $terms ) {
|
1239 |
+
$params['content_category'] = $terms;
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
return pys_build_event_pixel_code( 'General', $params, $event_name );
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
return false;
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
if( !function_exists( 'pys_get_woo_checkout_params' ) ) {
|
1251 |
+
|
1252 |
+
function pys_get_woo_checkout_params( $additional_params_enabled ) {
|
1253 |
+
global $woocommerce;
|
1254 |
+
|
1255 |
+
// set defaults params
|
1256 |
+
$params = array();
|
1257 |
+
$params['content_type'] = 'product';
|
1258 |
+
|
1259 |
+
$ids = array(); // cart items ids or sku
|
1260 |
+
$names = ''; // cart items names
|
1261 |
+
$categories = ''; // cart items categories
|
1262 |
+
|
1263 |
+
foreach ( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
|
1264 |
+
|
1265 |
+
$product_id = pys_get_product_id( $item );
|
1266 |
+
$value = pys_get_product_content_id( $product_id );
|
1267 |
+
$ids[] = $value;
|
1268 |
+
|
1269 |
+
// content_name, category_name for each cart item
|
1270 |
+
if ( $additional_params_enabled ) {
|
1271 |
+
|
1272 |
+
$temp = array();
|
1273 |
+
pys_get_additional_woo_params( $product_id, $temp );
|
1274 |
+
|
1275 |
+
$names .= isset( $temp['content_name'] ) ? $temp['content_name'] . ' ' : null;
|
1276 |
+
$categories .= isset( $temp['category_name'] ) ? $temp['category_name'] . ' ' : null;
|
1277 |
+
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
if ( $additional_params_enabled ) {
|
1283 |
+
$params['num_items'] = $woocommerce->cart->get_cart_contents_count();
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
$params['content_ids'] = '[' . implode( ',', $ids ) . ']';
|
1287 |
+
|
1288 |
+
if ( ! empty( $names ) ) {
|
1289 |
+
$params['content_name'] = $names;
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
if ( ! empty( $categories ) ) {
|
1293 |
+
$params['category_name'] = $categories;
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
return $params;
|
1297 |
+
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
if( !function_exists( 'pys_get_default_options' ) ) {
|
1303 |
+
|
1304 |
+
function pys_get_default_options() {
|
1305 |
+
|
1306 |
+
$options = array();
|
1307 |
+
|
1308 |
+
$options['general']['pixel_id'] = '';
|
1309 |
+
$options['general']['enabled'] = 0;
|
1310 |
+
|
1311 |
+
$options['general']['general_event_enabled'] = 1;
|
1312 |
+
$options['general']['general_event_name'] = 'GeneralEvent';
|
1313 |
+
$options['general']['general_event_on_posts_enabled'] = 1;
|
1314 |
+
$options['general']['general_event_on_pages_enabled'] = 1;
|
1315 |
+
$options['general']['general_event_on_tax_enabled'] = 1;
|
1316 |
+
$options['general']['general_event_on_edd_enabled'] = 0;
|
1317 |
+
|
1318 |
+
$options['general']['timeonpage_enabled'] = 1;
|
1319 |
+
|
1320 |
+
$options['general']['search_event_enabled'] = 1;
|
1321 |
+
|
1322 |
+
$options['std']['enabled'] = 0;
|
1323 |
+
|
1324 |
+
$options['dyn']['enabled'] = 0;
|
1325 |
+
$options['dyn']['enabled_on_content'] = 0;
|
1326 |
+
$options['dyn']['enabled_on_widget'] = 0;
|
1327 |
+
|
1328 |
+
$options['woo']['enabled'] = pys_is_woocommerce_active() ? 1 : 0;
|
1329 |
+
|
1330 |
+
$options['woo']['content_id'] = 'id';
|
1331 |
+
$options['woo']['variation_id'] = 'main';
|
1332 |
+
|
1333 |
+
$options['woo']['enable_additional_params'] = 1;
|
1334 |
+
$options['woo']['tax'] = 'incl';
|
1335 |
+
|
1336 |
+
$options['woo']['on_view_content'] = 1;
|
1337 |
+
$options['woo']['enable_view_content_value'] = 1;
|
1338 |
+
$options['woo']['view_content_value_option'] = 'price';
|
1339 |
+
$options['woo']['view_content_percent_value'] = '';
|
1340 |
+
$options['woo']['view_content_global_value'] = '';
|
1341 |
+
|
1342 |
+
$options['woo']['on_add_to_cart_btn'] = 1;
|
1343 |
+
$options['woo']['on_cart_page'] = 1;
|
1344 |
+
$options['woo']['enable_add_to_cart_value'] = 1;
|
1345 |
+
$options['woo']['add_to_cart_value_option'] = 'price';
|
1346 |
+
$options['woo']['add_to_cart_percent_value'] = '';
|
1347 |
+
$options['woo']['add_to_cart_global_value'] = '';
|
1348 |
+
|
1349 |
+
$options['woo']['on_checkout_page'] = 1;
|
1350 |
+
$options['woo']['enable_checkout_value'] = 1;
|
1351 |
+
$options['woo']['checkout_value_option'] = 'price';
|
1352 |
+
$options['woo']['checkout_percent_value'] = '';
|
1353 |
+
$options['woo']['checkout_global_value'] = '';
|
1354 |
+
|
1355 |
+
$options['woo']['on_thank_you_page'] = 1;
|
1356 |
+
$options['woo']['enable_purchase_value'] = 1;
|
1357 |
+
$options['woo']['purchase_transport'] = 'included';
|
1358 |
+
$options['woo']['purchase_value_option'] = 'total';
|
1359 |
+
$options['woo']['purchase_percent_value'] = '';
|
1360 |
+
$options['woo']['purchase_global_value'] = '';
|
1361 |
+
|
1362 |
+
$options['woo']['purchase_additional_matching'] = 1;
|
1363 |
+
|
1364 |
+
$options['woo']['purchase_add_address'] = 1;
|
1365 |
+
$options['woo']['purchase_add_payment_method'] = 1;
|
1366 |
+
$options['woo']['purchase_add_shipping_method'] = 1;
|
1367 |
+
$options['woo']['purchase_add_coupons'] = 1;
|
1368 |
+
|
1369 |
+
$options['woo']['enable_aff_event'] = 0;
|
1370 |
+
$options['woo']['aff_event'] = 'predefined';
|
1371 |
+
$options['woo']['aff_predefined_value'] = 'Lead';
|
1372 |
+
$options['woo']['aff_custom_value'] = '';
|
1373 |
+
$options['woo']['aff_value_option'] = 'none';
|
1374 |
+
$options['woo']['aff_global_value'] = '';
|
1375 |
+
|
1376 |
+
$options['woo']['enable_paypal_event'] = 0;
|
1377 |
+
$options['woo']['pp_event'] = 'predefined';
|
1378 |
+
$options['woo']['pp_predefined_value'] = 'InitiatePayment';
|
1379 |
+
$options['woo']['pp_custom_value'] = '';
|
1380 |
+
$options['woo']['pp_value_option'] = 'none';
|
1381 |
+
$options['woo']['pp_global_value'] = '';
|
1382 |
+
|
1383 |
+
return $options;
|
1384 |
+
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
if( !function_exists( 'pys_get_custom_params' ) ) {
|
1390 |
+
|
1391 |
+
/**
|
1392 |
+
* Get custom event (std or dynamic) params => values
|
1393 |
+
* @param array $event
|
1394 |
+
*/
|
1395 |
+
function pys_get_custom_params( $event ) {
|
1396 |
+
|
1397 |
+
if( !is_array( $event ) || empty( $event ) ) {
|
1398 |
+
return array();
|
1399 |
+
}
|
1400 |
+
|
1401 |
+
$std_params = array(
|
1402 |
+
'trigger_type',
|
1403 |
+
'url',
|
1404 |
+
'css',
|
1405 |
+
'pageurl',
|
1406 |
+
'eventtype',
|
1407 |
+
'value',
|
1408 |
+
'currency',
|
1409 |
+
'content_name',
|
1410 |
+
'content_ids',
|
1411 |
+
'content_type',
|
1412 |
+
'content_category',
|
1413 |
+
'num_items',
|
1414 |
+
'order_id',
|
1415 |
+
'search_string',
|
1416 |
+
'status',
|
1417 |
+
'code',
|
1418 |
+
'custom_name'
|
1419 |
+
);
|
1420 |
+
|
1421 |
+
$custom_params = array();
|
1422 |
+
foreach( $event as $param => $value ) {
|
1423 |
+
|
1424 |
+
// skip standard params
|
1425 |
+
if( in_array( $param, $std_params ) ) {
|
1426 |
+
continue;
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
$custom_params[ $param ] = $value;
|
1430 |
+
|
1431 |
+
}
|
1432 |
+
|
1433 |
+
|
1434 |
+
return $custom_params;
|
1435 |
+
|
1436 |
+
}
|
1437 |
+
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
if( !function_exists( 'pys_is_standard_event' ) ) {
|
1441 |
+
|
1442 |
+
function pys_is_standard_event( $eventtype ) {
|
1443 |
+
|
1444 |
+
$std_events = array(
|
1445 |
+
'ViewContent',
|
1446 |
+
'Search',
|
1447 |
+
'AddToCart',
|
1448 |
+
'AddToWishlist',
|
1449 |
+
'InitiateCheckout',
|
1450 |
+
'AddPaymentInfo',
|
1451 |
+
'Purchase',
|
1452 |
+
'Lead'
|
1453 |
+
);
|
1454 |
+
|
1455 |
+
return in_array( $eventtype, $std_events );
|
1456 |
+
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
}
|
inc/core.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Free version related functions.
|
4 |
+
*/
|
5 |
+
|
6 |
+
if( !function_exists( 'pys_get_woo_ajax_addtocart_params' ) ) {
|
7 |
+
|
8 |
+
function pys_get_woo_ajax_addtocart_params( $product_id ) {
|
9 |
+
|
10 |
+
$params = array();
|
11 |
+
$params['content_type'] = 'product';
|
12 |
+
$params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
|
13 |
+
|
14 |
+
return $params;
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Build WooCommerce related events code.
|
22 |
+
*/
|
23 |
+
if( !function_exists( 'pys_get_woo_code' ) ) {
|
24 |
+
|
25 |
+
function pys_get_woo_code() {
|
26 |
+
global $post, $woocommerce;
|
27 |
+
|
28 |
+
// set defaults params
|
29 |
+
$params = array();
|
30 |
+
$params['content_type'] = 'product';
|
31 |
+
|
32 |
+
// ViewContent Event
|
33 |
+
if( pys_get_option( 'woo', 'on_view_content' ) && is_product() ) {
|
34 |
+
|
35 |
+
$params['content_ids'] = '[' . pys_get_product_content_id( $post->ID ) . ']';
|
36 |
+
|
37 |
+
return pys_build_event_pixel_code( 'WooCommerce', $params, 'ViewContent' );
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
// AddToCart Cart Page Event
|
42 |
+
if( pys_get_option( 'woo', 'on_cart_page' ) && is_cart() ) {
|
43 |
+
|
44 |
+
$ids = array(); // cart items ids or sku
|
45 |
+
|
46 |
+
foreach( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
|
47 |
+
|
48 |
+
$product_id = pys_get_product_id( $item );
|
49 |
+
$value= pys_get_product_content_id( $product_id );
|
50 |
+
$ids[] = $value;
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
$params['content_ids'] = '[' . implode( ',', $ids ) . ']';
|
55 |
+
|
56 |
+
return pys_build_event_pixel_code( 'WooCommerce', $params, 'AddToCart' );
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
// Checkout Page Event
|
61 |
+
if( pys_get_option( 'woo', 'on_checkout_page' ) && is_checkout() && !is_wc_endpoint_url() ) {
|
62 |
+
|
63 |
+
$params = pys_get_woo_checkout_params( false );
|
64 |
+
|
65 |
+
return pys_build_event_pixel_code( 'WooCommerce', $params, 'InitiateCheckout' );
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
// Purchase Event
|
70 |
+
if( pys_get_option( 'woo', 'on_thank_you_page' ) && is_wc_endpoint_url( 'order-received' ) ) {
|
71 |
+
|
72 |
+
$order_id = wc_get_order_id_by_order_key( $_REQUEST['key'] );
|
73 |
+
$order = new WC_Order( $order_id );
|
74 |
+
$items = $order->get_items( 'line_item' );
|
75 |
+
|
76 |
+
$ids = array(); // order items ids or sku
|
77 |
+
|
78 |
+
foreach( $items as $item ) {
|
79 |
+
|
80 |
+
$product_id = pys_get_product_id( $item );
|
81 |
+
$value= pys_get_product_content_id( $product_id );
|
82 |
+
$ids[] = $value;
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
$params['content_ids'] = '[' . implode( ',', $ids ) . ']';
|
87 |
+
|
88 |
+
return pys_build_event_pixel_code( 'WooCommerce', $params, 'Purchase' );
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
return false;
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Adds data-pixelcode attribute to "add to cart" buttons in the WooCommerce loop.
|
100 |
+
*/
|
101 |
+
if( !function_exists( 'pys_add_code_to_woo_cart_link' ) ) {
|
102 |
+
|
103 |
+
function pys_add_code_to_woo_cart_link( $tag, $product ) {
|
104 |
+
|
105 |
+
if ( $product->product_type == 'variable' || $product->product_type == 'grouped' ) {
|
106 |
+
return $tag;
|
107 |
+
}
|
108 |
+
|
109 |
+
// common params
|
110 |
+
$params = array();
|
111 |
+
$params['content_type'] = 'product';
|
112 |
+
$params['content_ids'] = '[' . pys_get_product_content_id( $product->post->ID ) . ']';
|
113 |
+
|
114 |
+
if ( $product->product_type == 'simple' && pys_get_option( 'woo', 'on_add_to_cart_btn' ) ) {
|
115 |
+
|
116 |
+
// do not add code it AJAX is disabled
|
117 |
+
$is_ajax = get_option( 'woocommerce_enable_ajax_add_to_cart' ) == 'yes' ? true : false;
|
118 |
+
if ( ! $is_ajax ) {
|
119 |
+
return $tag;
|
120 |
+
}
|
121 |
+
|
122 |
+
$code = pys_build_event_pixel_code( null, $params, 'AddToCart' );
|
123 |
+
|
124 |
+
return pys_insert_attribute( 'data-pixelcode', $code['js'], $tag, true );
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
return $tag;
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
if( !function_exists( 'pys_get_additional_matching_code' ) ) {
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Adds extra params to pixel init code. On Free always returns empty string.
|
138 |
+
*
|
139 |
+
* @see: https://www.facebook.com/help/ipad-app/606443329504150
|
140 |
+
* @see: https://developers.facebook.com/ads/blog/post/2016/05/31/advanced-matching-pixel/
|
141 |
+
* @see: https://github.com/woothemes/woocommerce/blob/master/includes/abstracts/abstract-wc-order.php
|
142 |
+
*
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
function pys_get_additional_matching_code() {
|
146 |
+
|
147 |
+
return '';
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
}
|
inc/html-admin.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// set active tab
|
4 |
+
$pys_active_tab = 'general';
|
5 |
+
if( isset( $_REQUEST['active_tab'] ) ) {
|
6 |
+
$pys_active_tab = $_REQUEST['active_tab'];
|
7 |
+
}
|
8 |
+
|
9 |
+
$std_events = get_option( 'pixel_your_site_std_events' );
|
10 |
+
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="wrap">
|
14 |
+
<div class="pys-logo"></div>
|
15 |
+
<h1>Manage your Facebook Pixel</h1>
|
16 |
+
|
17 |
+
<div class="pys-body">
|
18 |
+
|
19 |
+
<ul class="pys-menu">
|
20 |
+
<li id="pys-menu-general" class="nav-tab <?php echo $pys_active_tab == 'general' ? 'nav-tab-active selected' : null; ?>">Facebook Pixel</li>
|
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">
|
27 |
+
<form action="<?php echo admin_url('admin.php'); ?>?page=pixel-your-site" method="post">
|
28 |
+
<input type="hidden" name="active_tab" value="<?php echo $pys_active_tab; ?>">
|
29 |
+
|
30 |
+
<?php wp_nonce_field( 'pys-nonce-action', 'pysnonce' ); ?>
|
31 |
+
|
32 |
+
<div id="pys-panel-general" class="pys-panel" <?php echo $pys_active_tab == 'general' ? 'style="display: block;"' : null; ?> >
|
33 |
+
|
34 |
+
<?php include "html-box-top-general.php"; ?>
|
35 |
+
|
36 |
+
<?php include "html-tab-pixel-id.php"; ?>
|
37 |
+
<?php include "html-tab-pixel-general.php"; ?>
|
38 |
+
<?php include "html-box-middle.php"; ?>
|
39 |
+
<?php include "html-tab-pixel-activate.php"; ?>
|
40 |
+
|
41 |
+
</div><!-- #pys-panel-general -->
|
42 |
+
|
43 |
+
<div id="pys-panel-posts-events" class="pys-panel" <?php echo $pys_active_tab == 'posts-events' ? 'style="display: block;"' : null; ?> >
|
44 |
+
|
45 |
+
<?php include "html-box-top-post-event.php"; ?>
|
46 |
+
|
47 |
+
<?php include "html-tab-std-add-event.php"; ?>
|
48 |
+
<?php include "html-tab-std-event-general.php"; ?>
|
49 |
+
<?php include "html-tab-std-event-list.php"; ?>
|
50 |
+
|
51 |
+
<?php include "html-box-middle.php"; ?>
|
52 |
+
|
53 |
+
</div><!-- #pys-panel-posts-events -->
|
54 |
+
|
55 |
+
<div id="pys-panel-dynamic-events" class="pys-panel" <?php echo $pys_active_tab == 'dynamic-events' ? 'style="display: block;"' : null; ?> >
|
56 |
+
|
57 |
+
<?php include "html-box-top-dynamic.php"; ?>
|
58 |
+
|
59 |
+
<?php include "html-tab-dynamic-events-general.php"; ?>
|
60 |
+
<?php include "html-tab-dynamic-events-list.php"; ?>
|
61 |
+
|
62 |
+
<?php include "html-box-middle.php"; ?>
|
63 |
+
|
64 |
+
</div><!-- #pys-panel-dynamic-events -->
|
65 |
+
|
66 |
+
<div id="pys-panel-woo" class="pys-panel" <?php echo $pys_active_tab == 'woo' ? 'style="display: block;"' : null; ?> >
|
67 |
+
|
68 |
+
<?php include "html-box-top-woo.php"; ?>
|
69 |
+
|
70 |
+
<?php if( pys_is_woocommerce_active() ): ?>
|
71 |
+
|
72 |
+
<?php include "html-tab-woo-general.php"; ?>
|
73 |
+
|
74 |
+
<?php include "html-tab-woo-red.php"; ?>
|
75 |
+
|
76 |
+
<?php else: ?>
|
77 |
+
|
78 |
+
<div class="pys-box pys-box-red">
|
79 |
+
<h2 style="text-align: center; color: #fff;">Please install and activate WooCommerce to enable WooCommerce integration.</h2>
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<?php endif; ?>
|
83 |
+
|
84 |
+
</div><!-- #pys-panel-woo -->
|
85 |
+
|
86 |
+
</form>
|
87 |
+
</div><!-- .pys-content -->
|
88 |
+
|
89 |
+
<?php include "html-box-bottom.php"; ?>
|
90 |
+
|
91 |
+
<p class="pys-rating">If you find PixelYourSite helpful <a href="https://wordpress.org/support/view/plugin-reviews/pixelyoursite?rate=5#postform" target="_blank">click here to give us a 5 stars review</a>, because it will really help us. Thank You!</p>
|
92 |
+
|
93 |
+
</div><!-- .pys-body -->
|
94 |
+
</div><!-- .wrap -->
|
inc/html-box-bottom.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box pys-box-bottom">
|
2 |
+
<div class="pys-col pys-col-one-half">
|
3 |
+
<h2>Useful stuff:</h2>
|
4 |
+
<ul>
|
5 |
+
<li><a href="http://www.pixelyoursite.com/facebook-pixel-helper-errors" target="_blank">How to check your Facebook Pixel for errors with a free tool</a></li>
|
6 |
+
<li><a href="http://www.pixelyoursite.com/facebook-ads-reports-optimisation" target="_blank">How to create custom reports to better understand conversion</a></li>
|
7 |
+
<li><strong>[Pro Tip]</strong> <a href="http://www.pixelyoursite.com/custom-audiences-from-events" target="_blank">How to create Custom Audiences based on important actions on your website - Dynamic
|
8 |
+
Events</a></li>
|
9 |
+
</ul>
|
10 |
+
</div>
|
11 |
+
<div class="pys-col pys-col-one-half pys-col-border-left">
|
12 |
+
<?php include "html-offer-content.php"; ?>
|
13 |
+
</div>
|
14 |
+
</div>
|
inc/html-box-middle.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
10 |
+
<a href="http://www.pixelyoursite.com/general-event" target="_blank" class="pys-btn pys-btn-red">Download the Free Guide Now</a>
|
11 |
+
|
12 |
+
<?php else: ?>
|
13 |
+
|
14 |
+
<h2>How to create <u>Super Powerful Custom Audiences</u> using the <i>General Event</i> 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 |
+
|
17 |
+
<a href="http://www.pixelyoursite.com/general-event" target="_blank" class="pys-btn pys-btn-red">Download the Free Guide Now</a>
|
18 |
+
|
19 |
+
|
20 |
+
<?php endif; ?>
|
21 |
+
|
22 |
+
</div>
|
23 |
+
</div>
|
inc/html-box-top-dynamic.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box pys-box-top">
|
2 |
+
<div class="pys-col pys-col-one-half">
|
3 |
+
<ul>
|
4 |
+
<li><h2>First time here? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting</a></h2></li>
|
5 |
+
</ul>
|
6 |
+
<ul>
|
7 |
+
<li><h2>Click for help: <a href="http://www.pixelyoursite.com/facebook-pixel-dynamic-events" target="_blank">How to use Dynamic Events - Step by Step Guide</a></h2></li>
|
8 |
+
</ul>
|
9 |
+
</div>
|
10 |
+
<div class="pys-col pys-col-one-half pys-col-border-left">
|
11 |
+
<?php include "html-offer-content.php"; ?>
|
12 |
+
</div>
|
13 |
+
</div>
|
inc/html-box-top-general.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box pys-box-top">
|
2 |
+
<div class="pys-col pys-col-one-half">
|
3 |
+
<ul>
|
4 |
+
<li><h2>First time here? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting</a></h2></li>
|
5 |
+
</ul>
|
6 |
+
</div>
|
7 |
+
<div class="pys-col pys-col-one-half pys-col-border-left">
|
8 |
+
<?php include "html-offer-content.php"; ?>
|
9 |
+
</div>
|
10 |
+
</div>
|
inc/html-box-top-post-event.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box pys-box-top">
|
2 |
+
<div class="pys-col pys-col-one-half">
|
3 |
+
<ul>
|
4 |
+
<li><h2>First time here? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting</a></h2></li>
|
5 |
+
</ul>
|
6 |
+
<ul>
|
7 |
+
<li><h2>Click for help: <a href="http://www.pixelyoursite.com/how-to-add-facebook-pixel-events" target="_blank">How to use Events - Step by Step Guide</a></h2></li>
|
8 |
+
</ul>
|
9 |
+
</div>
|
10 |
+
<div class="pys-col pys-col-one-half pys-col-border-left">
|
11 |
+
<?php include "html-offer-content.php"; ?>
|
12 |
+
</div>
|
13 |
+
</div>
|
inc/html-box-top-woo.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box pys-box-top">
|
2 |
+
<div class="pys-col pys-col-one-half">
|
3 |
+
<ul>
|
4 |
+
<li><h2>First time here? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting</a></h2></li>
|
5 |
+
</ul>
|
6 |
+
<ul>
|
7 |
+
<li><h2>Click for help: <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-woocommerce" target="_blank">How to configure Facebook Pixel on WooCommerce - Must Read</a></h2></li>
|
8 |
+
</ul>
|
9 |
+
</div>
|
10 |
+
<div class="pys-col pys-col-one-half pys-col-border-left">
|
11 |
+
<?php include "html-offer-content.php"; ?>
|
12 |
+
</div>
|
13 |
+
</div>
|
inc/html-offer-content.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( pys_is_woocommerce_active() ) : ?>
|
2 |
+
|
3 |
+
<h2>Special Offer:</h2>
|
4 |
+
<p>Get the PRO version for <strong>a big discount</strong> and improve your ads return:</p>
|
5 |
+
<ul class="dashed">
|
6 |
+
<li>Woocommerce <strong>Conversion Value fine-tuned tracking</strong>, so you can really measure your Ads ROI</li>
|
7 |
+
<li>Superior <strong>Woocommerce Integration</strong> with key events parameters, like product name or category name, so you can create highly targeted Custom Audiences</li>
|
8 |
+
<li>Use <strong>Dynamic Events</strong> like a pro marketer and optimize your FB Ads for impoortant clicks on your site (like newsletter sign up or links in pop-ups)
|
9 |
+
|
10 |
+
</ul>
|
11 |
+
|
12 |
+
<?php else: ?>
|
13 |
+
|
14 |
+
<h2>Super Offer:</h2>
|
15 |
+
<p>Get the PRO version for <strong>a big discount</strong> and improve your ads return:</p>
|
16 |
+
<ul class="dashed">
|
17 |
+
<li>Use <strong>Dynamic Events</strong> like a pro marketer (add events on links and buttons clicks - perfect for affiliates and lead generation)</li>
|
18 |
+
</ul>
|
19 |
+
|
20 |
+
<?php endif; ?>
|
21 |
+
|
22 |
+
<a class="pys-btn pys-btn-red" href="http://www.pixelyoursite.com/facebook-pixel-plugin" target="_blank">CLICK TO UPGRADE NOW</a>
|
inc/html-tab-dynamic-events-general.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2 class="section-title">Dynamic Events</h2>
|
4 |
+
<p>Add standard or custom events that will trigger when a visitor clicks a link or a button on your website.</p>
|
5 |
+
|
6 |
+
<div class="pys-col-narrow">
|
7 |
+
<h2>Start using Dynamic Events with the PRO version of the plugin</h2>
|
8 |
+
<p>With Dynamic Events you can optimize your ads for actions on your website, like filing up forms (Contact Form 7 supported), newsletter sign ups, or any other click on links and buttons. Better ad optimization, better custom audience targeting, better conversion tracking.</p>
|
9 |
+
<p><strong>If you are not using Facebook Dynamic Events you are literally leaving money on the table.</strong></p>
|
10 |
+
|
11 |
+
<p><strong>Super Offer Ending Soon: <a href="http://www.pixelyoursite.com/facebook-pixel-plugin" target="_blank">Update now and start to benefit from Dynamic Events</a></strong></p>
|
12 |
+
|
13 |
+
<p>Or Learn more about <a href="http://www.pixelyoursite.com/facebook-pixel-dynamic-events" target="_blank">How to use Dynamic Events - Complete guide</a></p>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<div style="text-align: center; margin-top: 40px; margin-bottom: 40px;">
|
17 |
+
<a href="#" class="pys-btn pys-btn-big pys-btn-blue disabled">Add New Dynamic Event</a>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
|
21 |
+
<hr>
|
22 |
+
|
23 |
+
<table class="layout">
|
24 |
+
<tr>
|
25 |
+
<td class="alignright"><p class="label big">Activate Dynamic Events</p></td>
|
26 |
+
<td><input type="checkbox" disabled="disabled"></input></td>
|
27 |
+
</tr>
|
28 |
+
|
29 |
+
<tr>
|
30 |
+
<td class="alignright"><p class="label">Process links</p></td>
|
31 |
+
<td>
|
32 |
+
<input type="checkbox" disabled="disabled">Process links in Post Content</input>
|
33 |
+
<span class="help">The <code>the_content()</code> hook.</span>
|
34 |
+
|
35 |
+
<input type="checkbox" disabled="disabled">Process links in Widgets Text</input>
|
36 |
+
<span class="help">The <code>widget_text()</code> hook.</span>
|
37 |
+
</td>
|
38 |
+
</tr>
|
39 |
+
</table>
|
40 |
+
|
41 |
+
<button class="pys-btn pys-btn-blue pys-btn-big aligncenter disabled">Save Settings</button>
|
42 |
+
|
43 |
+
</div>
|
44 |
+
</div>
|
inc/html-tab-dynamic-events-list.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2 class="section-title">Active Dynamic Events</h2>
|
4 |
+
|
5 |
+
<div class="tablenav top">
|
6 |
+
<a href="#" class="button button-primary action thickbox disabled" title="Add new event">Add new event</a>
|
7 |
+
<a href="#" class="button button-delete action disabled">Delete selected</a>
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<table class="widefat fixed pys-list disabled">
|
11 |
+
<thead>
|
12 |
+
<tr>
|
13 |
+
<td class="check-column"><input type="checkbox"></td>
|
14 |
+
<th scope="col" class="column-type">Type</th>
|
15 |
+
<th scope="col" class="column-name">Custom name</th>
|
16 |
+
<th scope="col" class="column-url">URL</th>
|
17 |
+
<th scope="col" class="column-code">Code</th>
|
18 |
+
<th scope="col" class="column-actions">Actions</th>
|
19 |
+
</tr>
|
20 |
+
</thead>
|
21 |
+
<tbody>
|
22 |
+
</tbody>
|
23 |
+
</table>
|
24 |
+
</div>
|
25 |
+
</div>
|
inc/html-tab-pixel-activate.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2>Activate Facebook Pixel on Your Site</h2>
|
4 |
+
|
5 |
+
<table class="layout">
|
6 |
+
<tr>
|
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' ); ?> ></input>
|
11 |
+
</td>
|
12 |
+
</tr>
|
13 |
+
</table>
|
14 |
+
|
15 |
+
<button class="pys-btn pys-btn-big pys-btn-blue aligncenter">Save Settings</button>
|
16 |
+
|
17 |
+
</div>
|
18 |
+
</div>
|
inc/html-tab-pixel-general.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2>General Event (optional)</h2>
|
4 |
+
<p>This event can be very useful for building Custom Audiences based on Custom Combination.</p>
|
5 |
+
|
6 |
+
<table class="layout">
|
7 |
+
<tr class="tall">
|
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' ); ?> ></input>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
|
15 |
+
<tr>
|
16 |
+
<td class="alignright"><p class="label">General event name</p></td>
|
17 |
+
<td>
|
18 |
+
<input type="text" name="pys[general][general_event_name]"
|
19 |
+
value="<?php echo pys_get_option( 'general', 'general_event_name' ); ?>">
|
20 |
+
</td>
|
21 |
+
</tr>
|
22 |
+
|
23 |
+
<tr>
|
24 |
+
<td></td>
|
25 |
+
<td>
|
26 |
+
<input type="checkbox" name="pys[general][general_event_on_posts_enabled]" value="1"
|
27 |
+
<?php echo pys_checkbox_state( 'general', 'general_event_on_posts_enabled' ); ?> >Enable on Posts</input>
|
28 |
+
<span class="help">Will pust post title as <code>content_name</code> and post category name as <code>category_name</code></span>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
|
32 |
+
<tr>
|
33 |
+
<td></td>
|
34 |
+
<td>
|
35 |
+
<input type="checkbox" name="pys[general][general_event_on_pages_enabled]" value="1"
|
36 |
+
<?php echo pys_checkbox_state( 'general', 'general_event_on_pages_enabled' ); ?> >Enable on Pages</input>
|
37 |
+
<span class="help">Will pull page title as <code>content_name</code></span>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
|
41 |
+
<tr>
|
42 |
+
<td></td>
|
43 |
+
<td>
|
44 |
+
<input type="checkbox" name="pys[general][general_event_on_tax_enabled]" value="1"
|
45 |
+
<?php echo pys_checkbox_state( 'general', 'general_event_on_tax_enabled' ); ?> >Enable on Taxonomies</input>
|
46 |
+
<span class="help">Will pull taxonomy name as <code>content_name</code></span>
|
47 |
+
</td>
|
48 |
+
</tr>
|
49 |
+
|
50 |
+
<?php if( pys_is_edd_active() ) : ?>
|
51 |
+
<tr>
|
52 |
+
<td></td>
|
53 |
+
<td>
|
54 |
+
<input type="checkbox" name="pys[general][general_event_on_edd_enabled]" value="1"
|
55 |
+
<?php echo pys_checkbox_state( 'general', 'general_event_on_edd_enabled' ); ?> >Enable on Easy Digital Downloads Products</input>
|
56 |
+
<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>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
<?php endif; ?>
|
60 |
+
|
61 |
+
<?php
|
62 |
+
|
63 |
+
// Display settings for all custom post types
|
64 |
+
foreach( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) as $pt ) :
|
65 |
+
|
66 |
+
// skip product post type when woo is active
|
67 |
+
if( pys_is_woocommerce_active() && $pt->name == 'product' )
|
68 |
+
continue;
|
69 |
+
|
70 |
+
// skip download post type when eedd is active
|
71 |
+
if( pys_is_edd_active() && $pt->name == 'download' )
|
72 |
+
continue;
|
73 |
+
|
74 |
+
?>
|
75 |
+
|
76 |
+
<tr>
|
77 |
+
<td></td>
|
78 |
+
<td>
|
79 |
+
<input type="checkbox" name="pys[general][general_event_on_<?php echo $pt->name; ?>_enabled]" value="1"
|
80 |
+
<?php echo pys_checkbox_state( 'general', 'general_event_on_' . $pt->name . '_enabled' ); ?>
|
81 |
+
>Enable on <?php echo $pt->label; ?> Post Type</input>
|
82 |
+
<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>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
|
86 |
+
|
87 |
+
<?php endforeach; ?>
|
88 |
+
|
89 |
+
</table>
|
90 |
+
|
91 |
+
<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>
|
92 |
+
|
93 |
+
<hr>
|
94 |
+
|
95 |
+
<h2>TimeOnPage Event</h2>
|
96 |
+
<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> - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></p>
|
97 |
+
|
98 |
+
<table class="layout disabled">
|
99 |
+
|
100 |
+
<tr>
|
101 |
+
<td class="alignright"><p class="label">Enable TimeOnPage event setup</p></td>
|
102 |
+
<td>
|
103 |
+
<input type="checkbox" name="pys[general][timeonpage_enabled]" value="1"
|
104 |
+
<?php echo pys_checkbox_state( 'general', 'timeonpage_enabled' ); ?> >
|
105 |
+
</td>
|
106 |
+
</tr>
|
107 |
+
|
108 |
+
</table>
|
109 |
+
|
110 |
+
<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>
|
111 |
+
|
112 |
+
<hr>
|
113 |
+
|
114 |
+
<h2>Search Event</h2>
|
115 |
+
<p>The Search event will be active on Search page and will automatically pull search string as parameter. Useful for creating Custom Audiences.</p>
|
116 |
+
|
117 |
+
<table class="layout">
|
118 |
+
|
119 |
+
<tr>
|
120 |
+
<td class="alignright"><p class="label">Enable Search event setup</p></td>
|
121 |
+
<td>
|
122 |
+
<input type="checkbox" name="pys[general][search_event_enabled]" value="1"
|
123 |
+
<?php echo pys_checkbox_state( 'general', 'search_event_enabled' ); ?> ></input>
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
|
127 |
+
</table>
|
128 |
+
|
129 |
+
<hr>
|
130 |
+
|
131 |
+
<table class="layout">
|
132 |
+
|
133 |
+
<tr>
|
134 |
+
<td class="alignright"><p class="label">Remove Pixel for:</p></td>
|
135 |
+
<td></td>
|
136 |
+
</tr>
|
137 |
+
|
138 |
+
<?php
|
139 |
+
|
140 |
+
/**
|
141 |
+
* List all available roles
|
142 |
+
*/
|
143 |
+
|
144 |
+
global $wp_roles;
|
145 |
+
|
146 |
+
if( !isset( $wp_roles ) ) {
|
147 |
+
$wp_roles = new WP_Roles();
|
148 |
+
}
|
149 |
+
|
150 |
+
$roles = $wp_roles->get_names();
|
151 |
+
foreach( $roles as $role_value => $role_name ) : ?>
|
152 |
+
|
153 |
+
<tr>
|
154 |
+
<td class="alignright"><?php echo $role_name; ?></td>
|
155 |
+
<td>
|
156 |
+
<input type="checkbox" name="pys[general][disable_for_<?php echo $role_value; ?>]" value="1"
|
157 |
+
<?php echo pys_checkbox_state( 'general', 'disable_for_' . $role_value ); ?> ></input>
|
158 |
+
</td>
|
159 |
+
</tr>
|
160 |
+
|
161 |
+
<?php endforeach; ?>
|
162 |
+
|
163 |
+
</table>
|
164 |
+
|
165 |
+
</div>
|
166 |
+
</div>
|
inc/html-tab-pixel-id.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2 class="section-title">Add your Pixel ID:</h2>
|
4 |
+
|
5 |
+
<table class="layout">
|
6 |
+
<tr>
|
7 |
+
<td class="legend"><p class="label">Add your Facebook Pixel ID:</p></td>
|
8 |
+
<td>
|
9 |
+
<input type="text" name="pys[general][pixel_id]"
|
10 |
+
placeholder="Enter your Facebook Pixel ID"
|
11 |
+
value="<?php echo 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>
|
15 |
+
</table>
|
16 |
+
</div>
|
17 |
+
</div>
|
inc/html-tab-std-add-event.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
|
4 |
+
<div style="text-align: center; margin-top: 13px;">
|
5 |
+
<a href="<?php echo admin_url('admin-ajax.php'); ?>?action=pys_edit_std_event" class="pys-btn pys-btn-big pys-btn-blue thickbox">Add New Event</a>
|
6 |
+
<p>Add Standard or Custom Events that will trigger when an URL is visited</p>
|
7 |
+
</div>
|
8 |
+
|
9 |
+
</div>
|
10 |
+
</div>
|
inc/html-tab-std-event-general.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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' ); ?> ></input>
|
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>
|
inc/html-tab-std-event-list.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2 class="section-title">Active Events</h2>
|
4 |
+
|
5 |
+
<div class="tablenav top">
|
6 |
+
<a href="<?php echo admin_url('admin-ajax.php'); ?>?action=pys_edit_std_event" class="button button-primary action thickbox">Add new event</a>
|
7 |
+
<a href="#" class="button btn-delete-std-events action">Delete selected</a>
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<table class="widefat fixed pys-list pys-std-events-list">
|
11 |
+
<thead>
|
12 |
+
<tr>
|
13 |
+
<td class="check-column"><input type="checkbox"></td>
|
14 |
+
<th scope="col" class="column-type">Type</th>
|
15 |
+
<th scope="col" class="column-url">URL</th>
|
16 |
+
<th scope="col" class="column-code">Code</th>
|
17 |
+
<th scope="col" class="column-actions">Actions</th>
|
18 |
+
</tr>
|
19 |
+
</thead>
|
20 |
+
<tbody>
|
21 |
+
|
22 |
+
<?php if( $std_events ) : ?>
|
23 |
+
|
24 |
+
<?php foreach ($std_events as $key => $event) : ?>
|
25 |
+
|
26 |
+
<tr>
|
27 |
+
<th scope="row" class="check-column">
|
28 |
+
<input type="checkbox" class="std-event-check" data-id="<?php echo $key; ?>">
|
29 |
+
</th>
|
30 |
+
|
31 |
+
<td><?php echo $event['eventtype']; ?></td>
|
32 |
+
<td><pre><?php echo $event['pageurl']; ?></pre></td>
|
33 |
+
<td>
|
34 |
+
<?php
|
35 |
+
|
36 |
+
$code = '';
|
37 |
+
if( $event['eventtype'] == 'CustomCode' ) {
|
38 |
+
|
39 |
+
$code = $event['code'];
|
40 |
+
|
41 |
+
} else {
|
42 |
+
|
43 |
+
$code = pys_get_event_code( $event );
|
44 |
+
$code = $code['js'];
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
$code = stripcslashes( $code );
|
49 |
+
$code = trim( $code );
|
50 |
+
echo '<pre>' . $code . '</pre>';
|
51 |
+
|
52 |
+
?>
|
53 |
+
</td>
|
54 |
+
<td>
|
55 |
+
<a href="<?php echo admin_url('admin-ajax.php'); ?>?action=pys_edit_std_event&id=<?php echo $key; ?>" class="button action thickbox">Edit</a>
|
56 |
+
<a href="#" class="button btn-delete-std-event action" data-id="<?php echo $key; ?>">Delete</a>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
|
60 |
+
<?php endforeach; ?>
|
61 |
+
|
62 |
+
<?php endif; ?>
|
63 |
+
|
64 |
+
</tbody>
|
65 |
+
</table>
|
66 |
+
</div>
|
67 |
+
</div>
|
inc/html-tab-woo-general.php
ADDED
@@ -0,0 +1,507 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box">
|
2 |
+
<div class="pys-col pys-col-full">
|
3 |
+
<h2 class="section-title">WooCommerce Pixel Settings</h2>
|
4 |
+
<p>Add all necessary events on WooCommerce with just a few clicks. On this tab you will find powerful options to customize the Facebook Pixel for your store.</p>
|
5 |
+
|
6 |
+
<hr>
|
7 |
+
<h2 class="section-title">Facebook Dynamic Product Ads Pixel Settings</h2>
|
8 |
+
<table class="layout">
|
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></input>
|
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]" autocomplete="off">
|
20 |
+
<option <?php selected( 'id', pys_get_option( 'woo', 'content_id' ) ); ?> value="id">Product ID</option>
|
21 |
+
<option <?php selected( 'sku', pys_get_option( 'woo', 'content_id' ) ); ?> value="sku">Product SKU</option>
|
22 |
+
</select>
|
23 |
+
</td>
|
24 |
+
</tr>
|
25 |
+
|
26 |
+
<tr>
|
27 |
+
<td class="alignright"><p class="label">Define Variation ID:</p></td>
|
28 |
+
<td>
|
29 |
+
<select name="pys[woo][variation_id]" autocomplete="off">
|
30 |
+
<option <?php selected( 'main', pys_get_option( 'woo', 'variation_id' ) ); ?> value="main">Main product data</option>
|
31 |
+
<option <?php selected( 'variation', pys_get_option( 'woo', 'variation_id' ) ); ?> value="variation">Variation data</option>
|
32 |
+
</select>
|
33 |
+
<span class="help">Define what ID should be use for variations of variable product.</span>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
|
37 |
+
<tr>
|
38 |
+
<td></td>
|
39 |
+
<td>
|
40 |
+
<p><strong>Product Catalog Feed</strong> - use our dedicated plugin to create 100% Dynamic Ads compatible feeds with just a few clicks:</p>
|
41 |
+
<p><a href="http://www.pixelyoursite.com/product-catalog-facebook" target="_blank">Download Product Catalog Feed Plugin for a big discount</a></p>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
</table>
|
45 |
+
|
46 |
+
<hr>
|
47 |
+
<h2 class="section-title">PRO Options</h2>
|
48 |
+
<table class="layout">
|
49 |
+
<tr class="disabled" style="vertical-align: top;">
|
50 |
+
<td>
|
51 |
+
|
52 |
+
<h2>Custom Audiences Optimization</h2>
|
53 |
+
|
54 |
+
<input type="checkbox">Enable Additional Parameters</input>
|
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">The nubmer of items is <code>num_items</code> for InitiateCheckout and Purchase events.</span>
|
57 |
+
|
58 |
+
</td>
|
59 |
+
<td>
|
60 |
+
|
61 |
+
<h2>Tax Options</h2>
|
62 |
+
Value:
|
63 |
+
<select autocomplete="off">
|
64 |
+
<option selected>Includes Tax</option>
|
65 |
+
</select>
|
66 |
+
|
67 |
+
</td>
|
68 |
+
</tr>
|
69 |
+
|
70 |
+
<tr style="vertical-align: top;">
|
71 |
+
<td>
|
72 |
+
|
73 |
+
<p><strong>Important for Custom Audiences.</strong> Use this together with the General Event option.</p>
|
74 |
+
<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>
|
75 |
+
|
76 |
+
</td>
|
77 |
+
<td>
|
78 |
+
|
79 |
+
<p><strong>Unlock all the PRO features: <a href="http://www.pixelyoursite.com/facebook-pixel-plugin" target="_blank">Upgrade NOW</a></strong></p>
|
80 |
+
|
81 |
+
</td>
|
82 |
+
</tr>
|
83 |
+
|
84 |
+
|
85 |
+
</table>
|
86 |
+
|
87 |
+
<hr>
|
88 |
+
<h2 class="section-title">ViewContent Event</h2>
|
89 |
+
<p>ViewContent is added on Product Pages and it is required for Facebook Dynamic Product Ads.</p>
|
90 |
+
<table class="layout">
|
91 |
+
<tr class="tall">
|
92 |
+
<td colspan="2" class="narrow">
|
93 |
+
<input type="checkbox" name="pys[woo][on_view_content]" value="1" class="woo-option"
|
94 |
+
<?php echo pys_checkbox_state( 'woo', 'on_view_content' ); ?> >
|
95 |
+
<strong>Enable ViewContent on Product Pages</strong></input>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
|
99 |
+
<tr>
|
100 |
+
<td></td>
|
101 |
+
<td>
|
102 |
+
<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></input>
|
103 |
+
<span class="help">add value and currency - Important for ROI measurement</span>
|
104 |
+
</td>
|
105 |
+
</tr>
|
106 |
+
|
107 |
+
<tr class="disabled">
|
108 |
+
<td class="alignright"><p class="label big">Define value:</p></td>
|
109 |
+
<td></td>
|
110 |
+
</tr>
|
111 |
+
|
112 |
+
<tr class="disabled">
|
113 |
+
<td class="alignright"><p class="label">Product price</p></td>
|
114 |
+
<td>
|
115 |
+
<input type="radio" name="pricea" checked></input>
|
116 |
+
</td>
|
117 |
+
</tr>
|
118 |
+
|
119 |
+
<tr class="disabled">
|
120 |
+
<td class="alignright"><p class="label">Percent of product price</p></td>
|
121 |
+
<td>
|
122 |
+
<input type="radio" name="pricea"></input>
|
123 |
+
<input type="text">%
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
|
127 |
+
<tr class="disabled">
|
128 |
+
<td class="alignright"><p class="label">Use Global value</p></td>
|
129 |
+
<td>
|
130 |
+
<input type="radio" name="pricea"></input>
|
131 |
+
<input type="text">
|
132 |
+
</td>
|
133 |
+
</tr>
|
134 |
+
|
135 |
+
</table>
|
136 |
+
|
137 |
+
<hr>
|
138 |
+
<h2 class="section-title">AddToCart Event</h2>
|
139 |
+
<p>AddToCart event will be added on add to cart button click and on cart page. It is required for Facebook Dynamic Product Ads.</p>
|
140 |
+
<table class="layout">
|
141 |
+
<tr>
|
142 |
+
<td colspan="2" class="narrow">
|
143 |
+
|
144 |
+
<input type="checkbox" name="pys[woo][on_add_to_cart_btn]" value="1" class="woo-option"
|
145 |
+
<?php echo pys_checkbox_state( 'woo', 'on_add_to_cart_btn' ); ?> >
|
146 |
+
<strong>Enable AddToCart on add to cart button</strong></input>
|
147 |
+
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
|
151 |
+
<tr class="tall">
|
152 |
+
<td colspan="2" class="narrow">
|
153 |
+
|
154 |
+
<input type="checkbox" name="pys[woo][on_cart_page]" value="1" class="woo-option"
|
155 |
+
<?php echo pys_checkbox_state( 'woo', 'on_cart_page' ); ?> >
|
156 |
+
<strong>Enable AddToCart on cart page</strong></input>
|
157 |
+
|
158 |
+
</td>
|
159 |
+
</tr>
|
160 |
+
|
161 |
+
<tr>
|
162 |
+
<td></td>
|
163 |
+
<td>
|
164 |
+
<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></input>
|
165 |
+
<span class="help">add value and currency - Important for ROI measurement</span>
|
166 |
+
</td>
|
167 |
+
</tr>
|
168 |
+
|
169 |
+
<tr class="disabled">
|
170 |
+
<td class="alignright"><p class="label big">Define value:</p></td>
|
171 |
+
<td></td>
|
172 |
+
</tr>
|
173 |
+
|
174 |
+
<tr class="disabled">
|
175 |
+
<td class="alignright"><p class="label">Product price</p></td>
|
176 |
+
<td>
|
177 |
+
<input type="radio" name="priceb" checked>
|
178 |
+
</td>
|
179 |
+
</tr>
|
180 |
+
|
181 |
+
<tr class="disabled">
|
182 |
+
<td class="alignright"><p class="label">Percent of product price</p></td>
|
183 |
+
<td>
|
184 |
+
<input type="radio" name="priceb">
|
185 |
+
<input type="text">%
|
186 |
+
</td>
|
187 |
+
</tr>
|
188 |
+
|
189 |
+
<tr class="disabled">
|
190 |
+
<td class="alignright"><p class="label">Use Global value</p></td>
|
191 |
+
<td>
|
192 |
+
<input type="radio" name="priceb">
|
193 |
+
<input type="text">
|
194 |
+
</td>
|
195 |
+
</tr>
|
196 |
+
|
197 |
+
</table>
|
198 |
+
|
199 |
+
<hr>
|
200 |
+
<h2 class="section-title">InitiateCheckout Event</h2>
|
201 |
+
<p>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.</p>
|
202 |
+
<table class="layout">
|
203 |
+
|
204 |
+
<tr class="tall">
|
205 |
+
<td colspan="2" class="narrow">
|
206 |
+
|
207 |
+
<input type="checkbox" name="pys[woo][on_checkout_page]" value="1" class="woo-option"
|
208 |
+
<?php echo pys_checkbox_state( 'woo', 'on_checkout_page' ); ?> >
|
209 |
+
<strong>Enable InitiateCheckout on Checkout page</strong></input>
|
210 |
+
|
211 |
+
</td>
|
212 |
+
</tr>
|
213 |
+
|
214 |
+
<tr>
|
215 |
+
<td></td>
|
216 |
+
<td>
|
217 |
+
<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></input>
|
218 |
+
<span class="help">add value and currency - Important for ROI measurement</span>
|
219 |
+
</td>
|
220 |
+
</tr>
|
221 |
+
|
222 |
+
<tr class="disabled">
|
223 |
+
<td class="alignright"><p class="label big">Define value:</p></td>
|
224 |
+
<td></td>
|
225 |
+
</tr>
|
226 |
+
|
227 |
+
<tr class="disabled">
|
228 |
+
<td class="alignright"><p class="label">Products price (subtotal)</p></td>
|
229 |
+
<td>
|
230 |
+
<input type="radio" name="pricec" checked></input>
|
231 |
+
</td>
|
232 |
+
</tr>
|
233 |
+
|
234 |
+
<tr class="disabled">
|
235 |
+
<td class="alignright"><p class="label">Percent of products value (subtotal)</p></td>
|
236 |
+
<td>
|
237 |
+
<input type="radio" name="pricec"></input>
|
238 |
+
<input type="text">%
|
239 |
+
</td>
|
240 |
+
</tr>
|
241 |
+
|
242 |
+
<tr class="disabled">
|
243 |
+
<td class="alignright"><p class="label">Use Global value</p></td>
|
244 |
+
<td>
|
245 |
+
<input type="radio" name="pricec"></input>
|
246 |
+
<input type="text">
|
247 |
+
</td>
|
248 |
+
</tr>
|
249 |
+
|
250 |
+
</table>
|
251 |
+
|
252 |
+
<hr>
|
253 |
+
<h2 class="section-title">Purchase Event</h2>
|
254 |
+
<p>Purchase event will be enabled on the Thank You page. It is mandatory for Facebook Dynamic Product Ads.</p>
|
255 |
+
<table class="layout">
|
256 |
+
|
257 |
+
<tr class="tall">
|
258 |
+
<td colspan="2" class="narrow">
|
259 |
+
|
260 |
+
<input type="checkbox" name="pys[woo][on_thank_you_page]" value="1" class="woo-option"
|
261 |
+
<?php echo pys_checkbox_state( 'woo', 'on_thank_you_page' ); ?> >
|
262 |
+
<strong>Enable Purchase event on Thank You page</strong>
|
263 |
+
|
264 |
+
</td>
|
265 |
+
</tr>
|
266 |
+
|
267 |
+
<tr>
|
268 |
+
<td></td>
|
269 |
+
<td>
|
270 |
+
<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>
|
271 |
+
<span class="help">add value and currency - <strong>Very important for ROI measurement</strong></span>
|
272 |
+
</td>
|
273 |
+
</tr>
|
274 |
+
|
275 |
+
<tr class="disabled">
|
276 |
+
<td class="alignright"><p class="label big">Define value:</p></td>
|
277 |
+
<td></td>
|
278 |
+
</tr>
|
279 |
+
|
280 |
+
<tr class="disabled">
|
281 |
+
<td class="alignright"><p class="label">Transport is:</p></td>
|
282 |
+
<td>
|
283 |
+
<select autocomplete="off" disabled>
|
284 |
+
<option selected>Included</option>
|
285 |
+
</select>
|
286 |
+
</td>
|
287 |
+
</tr>
|
288 |
+
|
289 |
+
<tr class="disabled">
|
290 |
+
<td class="alignright"><p class="label">Total</p></td>
|
291 |
+
<td>
|
292 |
+
<input type="radio" name="priced" checked>
|
293 |
+
</td>
|
294 |
+
</tr>
|
295 |
+
|
296 |
+
<tr class="disabled">
|
297 |
+
<td class="alignright"><p class="label">Percent of Total</p></td>
|
298 |
+
<td>
|
299 |
+
<input type="radio" name="priced" >
|
300 |
+
<input type="text">%
|
301 |
+
</td>
|
302 |
+
</tr>
|
303 |
+
|
304 |
+
<tr class="tall disabled">
|
305 |
+
<td class="alignright"><p class="label">Use Global value</p></td>
|
306 |
+
<td>
|
307 |
+
<input type="radio" name="priced">
|
308 |
+
<input type="text">
|
309 |
+
</td>
|
310 |
+
</tr>
|
311 |
+
|
312 |
+
<tr class="tall">
|
313 |
+
<td class="alignright"><p class="label big">Advanced Matching on Purchase event:</p></td>
|
314 |
+
<td>
|
315 |
+
<input type="checkbox" name="" value="1" class="woo-option disabled">
|
316 |
+
Enable - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
|
317 |
+
<span class="help">Advance Matching can lead to 10% increase in attributed conversions and 20% increase in reach of retargeting campaigns - <a href="http://www.pixelyoursite.com/enable-advance-matching-woocommerce" target="_blank">Click to read more</a> </span>
|
318 |
+
</td>
|
319 |
+
</tr>
|
320 |
+
|
321 |
+
<tr>
|
322 |
+
<td class="alignright"><p class="label big">Custom Audience Optimization:</p></td>
|
323 |
+
<td>
|
324 |
+
<span class="help"><strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></span>
|
325 |
+
</td>
|
326 |
+
</tr>
|
327 |
+
|
328 |
+
<tr class="disabled">
|
329 |
+
<td class="alignright"></td>
|
330 |
+
<td>
|
331 |
+
<input type="checkbox" name="" value="1" class="woo-option">
|
332 |
+
<strong>Add Town, State and Country parameters</strong>
|
333 |
+
<span class="help">Will pull <code>town</code>, <code>state</code> and <code>country</code></span>
|
334 |
+
|
335 |
+
</td>
|
336 |
+
</tr>
|
337 |
+
|
338 |
+
<tr class="disabled">
|
339 |
+
<td></td>
|
340 |
+
<td>
|
341 |
+
<input type="checkbox" name="" value="1" class="woo-option">
|
342 |
+
<strong>Add Payment Method parameter</strong>
|
343 |
+
<span class="help">Will pull <code>payment</code></span>
|
344 |
+
|
345 |
+
</td>
|
346 |
+
</tr>
|
347 |
+
|
348 |
+
<tr class="disabled">
|
349 |
+
<td></td>
|
350 |
+
<td>
|
351 |
+
<input type="checkbox" name="" value="1" class="woo-option" >
|
352 |
+
<strong>Add Shipping Method parameter</strong>
|
353 |
+
<span class="help">Will pull <code>shipping</code></span>
|
354 |
+
</td>
|
355 |
+
</tr>
|
356 |
+
|
357 |
+
<tr class="disabled">
|
358 |
+
<td></td>
|
359 |
+
<td>
|
360 |
+
<input type="checkbox" name="" value="1" class="woo-option" >
|
361 |
+
<strong>Add Coupons parameter</strong>
|
362 |
+
<span class="help">Will pull <code>coupon_used</code> and <code>coupon_name</code></span>
|
363 |
+
</td>
|
364 |
+
</tr>
|
365 |
+
|
366 |
+
</table>
|
367 |
+
|
368 |
+
<p><strong>Important:</strong> For the Purchase Event to work, the client must be redirected on the default WooCommerce Thank You page after payment.</p>
|
369 |
+
|
370 |
+
<hr>
|
371 |
+
<h2 class="section-title">WooCommerce Affliliate Products Events</h2>
|
372 |
+
<p>You can add an event that will trigger each time an affiliate WooCommerce product button is clicked.</p>
|
373 |
+
<table class="layout">
|
374 |
+
|
375 |
+
<tr class="tall">
|
376 |
+
<td colspan="2" class="narrow">
|
377 |
+
<input type="checkbox" disabled><strong>Activate WooCommerce Affliliate Products Events - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></strong></input>
|
378 |
+
</td>
|
379 |
+
</tr>
|
380 |
+
|
381 |
+
<tr class="disabled">
|
382 |
+
<td class="alignright"><p class="label">Event type:</p></td>
|
383 |
+
<td>
|
384 |
+
<input type="radio" name="eta" checked></input>
|
385 |
+
<select autocomplete="off" disabled>
|
386 |
+
<option selected>Lead</option>
|
387 |
+
</select>
|
388 |
+
</td>
|
389 |
+
</tr>
|
390 |
+
|
391 |
+
<tr class="disabled tall">
|
392 |
+
<td class="alignright"><p class="label">Name of custom event:</p></td>
|
393 |
+
<td>
|
394 |
+
<input type="radio" name="eta"></input>
|
395 |
+
<input type="text">
|
396 |
+
<span class="help">* The Affiliate event will have all the parameters values specific for selected event.</span>
|
397 |
+
<span class="help">* The Custom Affiliate event will have value, currency, content_name, content_type, content_ids.</span>
|
398 |
+
</td>
|
399 |
+
</tr>
|
400 |
+
|
401 |
+
<tr class="disabled">
|
402 |
+
<td class="alignright"><p class="label">Do not pull event value</p></td>
|
403 |
+
<td>
|
404 |
+
<input type="radio" name="pricex" checked></input>
|
405 |
+
</td>
|
406 |
+
</tr>
|
407 |
+
|
408 |
+
<tr class="disabled">
|
409 |
+
<td class="alignright"><p class="label">Event Value = Prouct Price</p></td>
|
410 |
+
<td>
|
411 |
+
<input type="radio" name="pricex"></input>
|
412 |
+
</td>
|
413 |
+
</tr>
|
414 |
+
|
415 |
+
<tr class="disabled">
|
416 |
+
<td class="alignright"><p class="label">Use Global value</p></td>
|
417 |
+
<td>
|
418 |
+
<input type="radio" name="pricex"></input>
|
419 |
+
<input type="text">
|
420 |
+
<span class="help">* Set this if you want a unique global value every time affiliate product clicked.</span>
|
421 |
+
</td>
|
422 |
+
</tr>
|
423 |
+
|
424 |
+
</table>
|
425 |
+
|
426 |
+
<hr>
|
427 |
+
<h2 class="section-title">WooCommerce PayPal Standard Events</h2>
|
428 |
+
<p>You can add an event that will trigger PayPal Standard button click.</p>
|
429 |
+
<table class="layout">
|
430 |
+
|
431 |
+
<tr class="tall">
|
432 |
+
<td colspan="2" class="narrow">
|
433 |
+
<input type="checkbox" disabled><strong>Activate PayPal Standard Events - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></strong></input>
|
434 |
+
</td>
|
435 |
+
</tr>
|
436 |
+
|
437 |
+
<tr class="disabled">
|
438 |
+
<td class="alignright"><p class="label">Event type:</p></td>
|
439 |
+
<td>
|
440 |
+
<input type="radio" name="etb" checked></input>
|
441 |
+
<select autocomplete="off" disabled>
|
442 |
+
<option selected>InitiatePayment</option>
|
443 |
+
</select>
|
444 |
+
</td>
|
445 |
+
</tr>
|
446 |
+
|
447 |
+
<tr class="disabled tall">
|
448 |
+
<td class="alignright"><p class="label">Name of custom event:</p></td>
|
449 |
+
<td>
|
450 |
+
<input type="radio" name="etb"></input>
|
451 |
+
<input type="text">
|
452 |
+
<span class="help">* The PayPal Standard event will have all the parameters values specific for selected event.</span>
|
453 |
+
<span class="help">* The Custom Affiliate event will have value, currency, content_type, content_ids.</span>
|
454 |
+
</td>
|
455 |
+
</tr>
|
456 |
+
|
457 |
+
<tr class="disabled">
|
458 |
+
<td class="alignright"><p class="label">Do not pull event value</p></td>
|
459 |
+
<td>
|
460 |
+
<input type="radio" name="price" checked></input>
|
461 |
+
</td>
|
462 |
+
</tr>
|
463 |
+
|
464 |
+
<tr class="disabled">
|
465 |
+
<td class="alignright"><p class="label">Event Value = Cart Total</p></td>
|
466 |
+
<td>
|
467 |
+
<input type="radio" name="price"></input>
|
468 |
+
</td>
|
469 |
+
</tr>
|
470 |
+
|
471 |
+
<tr class="disabled">
|
472 |
+
<td class="alignright"><p class="label">Use Global value</p></td>
|
473 |
+
<td>
|
474 |
+
<input type="radio" name="price"></input>
|
475 |
+
<input type="text">
|
476 |
+
<span class="help">* Set this if you want a unique global value every time affiliate product clicked.</span>
|
477 |
+
</td>
|
478 |
+
</tr>
|
479 |
+
|
480 |
+
</table>
|
481 |
+
|
482 |
+
<hr>
|
483 |
+
|
484 |
+
<table class="layout">
|
485 |
+
|
486 |
+
<tr class="tall">
|
487 |
+
<td colspan="2" class="narrow">
|
488 |
+
<p>This plugin can do a lot of useful stuff, but if you want your ads to shine, follow the steps of other experience marketers and upgrade to the Pro version.<br><a href="http://www.pixelyoursite.com/facebook-pixel-plugin" target="_blank"><strong>Click Here for a Super Offer</strong></a></p>
|
489 |
+
</td>
|
490 |
+
</tr>
|
491 |
+
|
492 |
+
<tr>
|
493 |
+
<td class="alignright">
|
494 |
+
<p class="label big">Activate WooCommerce Pixel Settings</p>
|
495 |
+
</td>
|
496 |
+
<td>
|
497 |
+
<input type="checkbox" name="pys[woo][enabled]" value="1"
|
498 |
+
<?php echo pys_checkbox_state( 'woo', 'enabled' ); ?> ></input>
|
499 |
+
</td>
|
500 |
+
</tr>
|
501 |
+
|
502 |
+
</table>
|
503 |
+
|
504 |
+
<button class="pys-btn pys-btn-blue pys-btn-big aligncenter">Save Settings</button>
|
505 |
+
|
506 |
+
</div>
|
507 |
+
</div>
|
inc/html-tab-woo-red.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="pys-box pys-box-red">
|
2 |
+
<div class="pys-col pys-col-narrow">
|
3 |
+
|
4 |
+
<h2 style="text-align: center;">Start your first Facebook Dynamic Ads campaign in minutes</h2>
|
5 |
+
<h1 style="text-align: center;">Get PixelYourSite Pro + Product Catalog Feed Plugin</h1>
|
6 |
+
|
7 |
+
<p>With <strong>PixelYourSite Pro</strong> you can:</p>
|
8 |
+
<ul>
|
9 |
+
<li>Fine-Tune Conversion Value Tracking - this way you can measure your ads profitability with high accuracy</li>
|
10 |
+
<li>Start using Dynamic Events and optimize your ads for actions on your website - like clicks on links or buttons</li>
|
11 |
+
</ul>
|
12 |
+
|
13 |
+
<p>With <strong>Product Catalog Feed</strong> you can:</p>
|
14 |
+
<ul>
|
15 |
+
<li>Create unlimited number of feeds that are 100% compatible with Facebook Dynamic Ads Product Catalog</li>
|
16 |
+
</ul>
|
17 |
+
|
18 |
+
<p style="text-align: center;">
|
19 |
+
<a href="http://www.pixelyoursite.com/bundle-offer" target="_blank" class="pys-btn pys-btn-big pys-btn-blue">Download Your Bundle Now</a>
|
20 |
+
</p>
|
21 |
+
|
22 |
+
</div>
|
23 |
+
</div>
|
inc/migrate.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Allow to migrate old settings format without data lost.
|
4 |
+
* @since 3.0.0
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Override all options with old data and remove old option from db.
|
9 |
+
* @since 3.0.0
|
10 |
+
*/
|
11 |
+
if( !function_exists( 'pys_migrate_from_22x' ) ) {
|
12 |
+
|
13 |
+
function pys_migrate_from_22x() {
|
14 |
+
|
15 |
+
$options = get_option( 'pixel_your_site' ); // defaults
|
16 |
+
$std_events = array();
|
17 |
+
|
18 |
+
$old_free = get_option( 'woofp_admin_settings' );
|
19 |
+
|
20 |
+
// general settings
|
21 |
+
$options['general']['pixel_id'] = isset( $old_free['facebookpixel']['ID'] ) ? $old_free['facebookpixel']['ID'] : '';
|
22 |
+
$options['general']['enabled'] = isset( $old_free['facebookpixel']['activate'] ) ? $old_free['facebookpixel']['activate'] : 0;
|
23 |
+
|
24 |
+
// standard events enable/disable
|
25 |
+
$options['std']['enabled'] = isset( $old_free['standardevent']['activate'] ) ? $old_free['standardevent']['activate'] : 0;
|
26 |
+
|
27 |
+
// woo events settings
|
28 |
+
$options['woo']['enabled'] = isset( $old_free['woocommerce']['activate'] ) ? $old_free['woocommerce']['activate'] : 0;
|
29 |
+
$options['woo']['on_view_content'] = isset( $old_free['woocommerce']['events']['ViewContent'] ) ? $old_free['woocommerce']['events']['ViewContent'] : 0;
|
30 |
+
$options['woo']['on_add_to_cart_btn'] = isset( $old_free['woocommerce']['events']['ProductAddToCart'] ) ? $old_free['woocommerce']['events']['ProductAddToCart'] : 0;
|
31 |
+
$options['woo']['on_cart_page'] = isset( $old_free['woocommerce']['events']['AddToCart'] ) ? $old_free['woocommerce']['events']['AddToCart'] : 0;
|
32 |
+
$options['woo']['on_checkout_page'] = isset( $old_free['woocommerce']['events']['InitiateCheckout'] ) ? $old_free['woocommerce']['events']['InitiateCheckout'] : 0;
|
33 |
+
$options['woo']['on_thank_you_page'] = isset( $old_free['woocommerce']['events']['Purchase'] ) ? $old_free['woocommerce']['events']['Purchase'] : 0;
|
34 |
+
|
35 |
+
// copy standard events
|
36 |
+
unset( $old_free['standardevent']['activate'] );
|
37 |
+
if ( isset( $old_free['standardevent']['pageurl'] ) ) {
|
38 |
+
$events_count = count( $old_free['standardevent']['pageurl'] );
|
39 |
+
|
40 |
+
$i = 0;
|
41 |
+
while ( $i < $events_count ) {
|
42 |
+
|
43 |
+
// do not copy empty events
|
44 |
+
if( empty( $old_free['standardevent']['pageurl'][$i] ) ) {
|
45 |
+
$i++;
|
46 |
+
continue;
|
47 |
+
}
|
48 |
+
|
49 |
+
$id = uniqid() . $i; // concat used to avoid equal ids
|
50 |
+
|
51 |
+
foreach ( $old_free['standardevent'] as $key => $value ) {
|
52 |
+
$std_events[ $id ][ $key ] = $value[ $i ];
|
53 |
+
}
|
54 |
+
|
55 |
+
if ( isset( $std_events[ $id ]['code'] ) && ! empty( $std_events[ $id ]['code'] ) ) {
|
56 |
+
$std_events[ $id ]['eventtype'] = 'CustomCode';
|
57 |
+
}
|
58 |
+
|
59 |
+
$i ++;
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
update_option( 'pixel_your_site', $options );
|
65 |
+
update_option( 'pixel_your_site_std_events', $std_events );
|
66 |
+
|
67 |
+
// remove old settings
|
68 |
+
//delete_option( 'woofp_admin_settings' );
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
js/admin.js
CHANGED
@@ -1,392 +1,97 @@
|
|
1 |
jQuery(function($){
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
html += '<b class="event_param">Value: </b><input type="text" name="standardevent[value][]" value="" class=" woofp-input-value" />';
|
97 |
-
html += '<span class="woofp-input-desc"> *Mandatory for purchase event only.</span>';
|
98 |
-
html += '</p>';
|
99 |
-
|
100 |
-
html += '<p class="standarevent-currency">';
|
101 |
-
html += '<b class="event_param">Currency: </b><select name="standardevent[currency][]" class=" woofp-input-currency">';
|
102 |
-
html += currencty_options;
|
103 |
-
html += '</select>';
|
104 |
-
html += '<span class="woofp-input-desc"> *Mandatory for purchase event only.</span>';
|
105 |
-
html += '</p>';
|
106 |
-
|
107 |
-
html += '<div class="standardevent-params"></div>';
|
108 |
-
html += '<h4>OR add Event Code here (Advances users only):</h4>';
|
109 |
-
html += '<textarea style="width:35em;height:180px;" name="standardevent[code][]"></textarea>';
|
110 |
-
html += '<div class="code_important">';
|
111 |
-
html += '<p class="description"><span class="woofp-asterik">*</span>The code inside the event field will overwrite and will have priority over any other data for that event.</p>';
|
112 |
-
html += '<p class="description"><span class="woofp-asterik">*</span>The code inserted in the field MUST be complete, including fbq(\'track\', \'AddToCart\', { …… });</p>';
|
113 |
-
html += '</div>';
|
114 |
-
html += '</td>';
|
115 |
-
html += '</tr>';
|
116 |
-
|
117 |
-
var $this = $(this);
|
118 |
-
|
119 |
-
$this.closest('tr').before(html).hide().fadeIn();
|
120 |
-
woofp_removebutton();
|
121 |
-
|
122 |
-
//select newly created tr
|
123 |
-
var new_element = $('tr.woofp-pageurl-tr').last();
|
124 |
-
|
125 |
-
//reset event select
|
126 |
-
new_element.find('select option:eq(0)').prop('selected', true);
|
127 |
-
|
128 |
-
//scroll to newly created element.
|
129 |
-
var offset = new_element.offset().top;
|
130 |
-
|
131 |
-
$('body, html').animate({ scrollTop: parseInt(offset) - 100 }, 1000);
|
132 |
-
// do fading 3 times
|
133 |
-
for(i=0;i<3;i++) {
|
134 |
-
new_element.fadeTo('fast', 0.3).fadeTo('fast', 1.0);
|
135 |
-
}
|
136 |
-
|
137 |
-
});
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
function woofp_vars(){
|
142 |
-
var vars = ['content_name','content_category','content_ids','content_type','search_string','num_items','order_id','status'];
|
143 |
-
return vars;
|
144 |
-
}
|
145 |
-
|
146 |
-
/*
|
147 |
-
Save Settings
|
148 |
-
*/
|
149 |
-
$(document).on('click', '.woofp-savesettings', function(event){
|
150 |
-
|
151 |
-
event.preventDefault();
|
152 |
-
|
153 |
-
var data = $('#facebook-pixel-form').serialize();
|
154 |
-
data = 'action=woofbsavesettings&'+data;
|
155 |
-
|
156 |
-
var loader = '<img src="'+woofp.loading+'" alt="Loading..." class="woofp-loading" style="display:inline; padding:10px 10px;" />';
|
157 |
-
var $this = $(this);
|
158 |
-
|
159 |
-
$this.prop('disabled', true);
|
160 |
-
$this.after(loader);
|
161 |
-
|
162 |
-
var facebookpixel = $('#facebookpixel-activate').prop('checked');
|
163 |
-
var standardevent = $('#standardevent-activate').prop('checked');
|
164 |
-
var woocommerce = $('#woocommerce-activate').prop('checked');
|
165 |
-
|
166 |
-
$.ajax({
|
167 |
-
url: woofp.ajaxurl,
|
168 |
-
type: 'POST',
|
169 |
-
dataType: 'json',
|
170 |
-
data: data,
|
171 |
-
})
|
172 |
-
.done(function(data) {
|
173 |
-
|
174 |
-
if( data.woo == 0 ){
|
175 |
-
|
176 |
-
location.reload(true);
|
177 |
-
|
178 |
-
} else {
|
179 |
-
|
180 |
-
if( standardevent ){
|
181 |
-
$('tr.show-standardevent').removeClass('hide-standardevent');
|
182 |
-
} else {
|
183 |
-
|
184 |
-
$('tr.show-standardevent').addClass('hide-standardevent');
|
185 |
-
}
|
186 |
-
|
187 |
-
$this.next('img.woofp-loading').remove();
|
188 |
-
$this.prop('disabled', false);
|
189 |
-
|
190 |
-
}
|
191 |
-
|
192 |
-
});
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
});
|
197 |
-
|
198 |
-
|
199 |
-
$('#facebook-pixel-panel-2 .woofp-pageurl-tr td').each(function(index, el) {
|
200 |
-
|
201 |
-
|
202 |
-
var td = $(this);
|
203 |
-
var val = td.find('select.woofp-input-event option:selected').val();
|
204 |
-
|
205 |
-
|
206 |
-
if( val != '' ){
|
207 |
-
td.find('.standarevent-value').show();
|
208 |
-
td.find('.standarevent-currency').show();
|
209 |
-
} else {
|
210 |
-
|
211 |
-
td.find('.standarevent-value').hide();
|
212 |
-
td.find('.standarevent-currency').hide();
|
213 |
-
}
|
214 |
-
|
215 |
-
});
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
$(document).on('change', 'select.woofp-input-event', function(e){
|
220 |
-
|
221 |
-
|
222 |
-
var val = $(this).val();
|
223 |
-
|
224 |
-
if( val == '' )
|
225 |
-
return false;
|
226 |
-
|
227 |
-
var params = woofp_standardevent_extented(val);
|
228 |
-
var params_vars = woofp_vars();
|
229 |
-
|
230 |
-
console.log(params);
|
231 |
-
|
232 |
-
var html = '';
|
233 |
-
var i = 0;
|
234 |
-
for (var key in params) {
|
235 |
-
if (params.hasOwnProperty(key)) {
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
var param = params[key];
|
240 |
-
|
241 |
-
|
242 |
-
if( param != undefined && param != '' ){
|
243 |
-
|
244 |
-
for(var i = 0; i < params_vars.length; i++){
|
245 |
-
|
246 |
-
if (params_vars[i] === param.name) params_vars.splice(i, 1);
|
247 |
-
}
|
248 |
-
|
249 |
-
|
250 |
-
html +='<div class="event_param_wrap">';
|
251 |
-
|
252 |
-
if( param.name == 'content_type')
|
253 |
-
html +='<b class="event_param">'+param.name+': </b><select name="standardevent['+param.name+'][]" ><option value="product">product</option><option value="product_group">product_group</option></select>';
|
254 |
-
else
|
255 |
-
html +='<b class="event_param">'+param.name+': </b><input type="text" name="standardevent['+param.name+'][]" value="" />';
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
html +='<p class="description">'+param.info+' i.e '+param.example+'</p>';
|
260 |
-
html +='</div>';
|
261 |
-
}
|
262 |
-
|
263 |
-
}
|
264 |
-
|
265 |
-
|
266 |
-
}
|
267 |
-
|
268 |
-
var hidden_params = '';
|
269 |
-
|
270 |
-
for(var i= 0; i < params_vars.length; i++){
|
271 |
-
var param = params_vars[i];
|
272 |
-
hidden_params +='<input type="hidden" name="standardevent['+param+'][]" value="" style="display:none;" />';
|
273 |
-
}
|
274 |
-
|
275 |
-
var tr = $(this).closest('tr');
|
276 |
-
tr.find('.standardevent-params').html(html + hidden_params);
|
277 |
-
|
278 |
-
tr.find('.standarevent-value').show();
|
279 |
-
tr.find('.standarevent-currency').show();
|
280 |
-
|
281 |
-
});
|
282 |
-
|
283 |
-
function woofp_standardevent_extented(event){
|
284 |
-
|
285 |
-
|
286 |
-
var params = {};
|
287 |
-
params['0'] = params['1'] = params['2'] = params['3'] = '';
|
288 |
-
params['4'] = params['5'] = params['6'] = params['7'] = '';
|
289 |
-
|
290 |
-
if(
|
291 |
-
event == 'ViewContent'
|
292 |
-
|| event == 'AddToCart'
|
293 |
-
|| event == 'AddToWishlist'
|
294 |
-
|| event == 'InitiateCheckout'
|
295 |
-
|| event == 'Purchase'
|
296 |
-
|| event == 'Lead'
|
297 |
-
|| event == 'CompleteRegistration' ){
|
298 |
-
|
299 |
-
var name = 'content_name';
|
300 |
-
var example = "'Really Fast Running Shoes'";
|
301 |
-
var info = "Name of the page/product";
|
302 |
-
params[0] = { name:name, example:example, info:info}
|
303 |
-
}
|
304 |
-
|
305 |
-
|
306 |
-
if(
|
307 |
-
event == 'Search'
|
308 |
-
|| event == 'AddToWishlist'
|
309 |
-
|| event == 'InitiateCheckout'
|
310 |
-
|| event == 'AddPaymentInfo'
|
311 |
-
|| event == 'Lead' ){
|
312 |
-
|
313 |
-
var name = 'content_category';
|
314 |
-
var example = "'Apparel & Accessories > Shoes'";
|
315 |
-
var info = "Category of the page/product.";
|
316 |
-
params[1] = { name:name, example:example, info:info}
|
317 |
-
|
318 |
-
}
|
319 |
-
|
320 |
-
if(
|
321 |
-
event == 'ViewContent'
|
322 |
-
|| event == 'Search'
|
323 |
-
|| event == 'AddToCart'
|
324 |
-
|| event == 'AddToWishlist'
|
325 |
-
|| event == 'InitiateCheckout'
|
326 |
-
|| event == 'AddPaymentInfo'
|
327 |
-
|| event == 'Purchase' ){
|
328 |
-
|
329 |
-
var name = 'content_ids';
|
330 |
-
var example = "['1234']";
|
331 |
-
var info = "Product ids/SKUs associated with the event.";
|
332 |
-
params[2] = { name:name, example:example, info:info}
|
333 |
-
|
334 |
-
}
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
if(
|
339 |
-
event == 'ViewContent'
|
340 |
-
|| event == 'AddToCart'
|
341 |
-
|| event == 'InitiateCheckout'
|
342 |
-
|| event == 'Purchase' ){
|
343 |
-
|
344 |
-
var name = 'content_type';
|
345 |
-
var example = "'product' or 'product_group'";
|
346 |
-
var info = "The type of content_ids.";
|
347 |
-
params[3] = { name:name, example:example, info:info}
|
348 |
-
}
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
if( event == 'Search' ) {
|
353 |
-
|
354 |
-
var name = 'search_string';
|
355 |
-
var example = "'Shoes'";
|
356 |
-
var info = "The string entered by the user for the search.";
|
357 |
-
params[4] = { name:name, example:example, info:info}
|
358 |
-
|
359 |
-
}
|
360 |
-
|
361 |
-
if(
|
362 |
-
event == 'Purchase'
|
363 |
-
|| event == 'InitiateCheckout' ){
|
364 |
-
|
365 |
-
var name = 'num_items';
|
366 |
-
var example = "'3'";
|
367 |
-
var info = "The number of items in the cart.";
|
368 |
-
params[5] = { name:name, example:example, info:info}
|
369 |
-
}
|
370 |
-
|
371 |
-
if( event == 'Purchase' ){
|
372 |
-
|
373 |
-
var name = 'order_id';
|
374 |
-
var example = "19";
|
375 |
-
var info = "The unique order id of the successful purchase.";
|
376 |
-
params[6] = { name:name, example:example, info:info}
|
377 |
-
}
|
378 |
-
|
379 |
-
if( event == 'CompleteRegistration' ){
|
380 |
-
|
381 |
-
var name = 'status';
|
382 |
-
var example = "completed";
|
383 |
-
var info = "The status of the registration.";
|
384 |
-
params[7] = { name:name, example:example, info:info}
|
385 |
-
}
|
386 |
-
|
387 |
-
return params;
|
388 |
-
}
|
389 |
-
|
390 |
-
|
391 |
|
392 |
}); /* Dom Loaded */
|
1 |
jQuery(function($){
|
2 |
|
3 |
+
/* Tabs Management */
|
4 |
+
$('.pys-menu li').on('click', function(event) {
|
5 |
+
|
6 |
+
event.preventDefault();
|
7 |
+
var tab = $(this).attr('id').replace('pys-menu-', '');
|
8 |
+
$('.pys-menu li').removeClass('nav-tab-active selected');
|
9 |
+
$(this).addClass('nav-tab-active selected');
|
10 |
+
|
11 |
+
$('.pys-panel').hide();
|
12 |
+
$('#pys-panel-'+tab).show();
|
13 |
+
|
14 |
+
// remember active tab
|
15 |
+
$('input[name=active_tab]').val(tab);
|
16 |
+
|
17 |
+
});
|
18 |
+
|
19 |
+
/* Bulk delete Std events */
|
20 |
+
$('.btn-delete-std-events').on('click', function(e){
|
21 |
+
e.preventDefault();
|
22 |
+
$(this).addClass('disabled');
|
23 |
+
|
24 |
+
// add all selected rows to ids array
|
25 |
+
var ids = [];
|
26 |
+
$.each( $('.std-event-check'), function(index, check) {
|
27 |
+
if ( $(check).prop('checked') == true ) {
|
28 |
+
ids.push( $(check).data('id') );
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
$.ajax({
|
33 |
+
url: pys.ajax,
|
34 |
+
type: 'post',
|
35 |
+
dataType: 'json',
|
36 |
+
data: {
|
37 |
+
action: 'pys_delete_std_event',
|
38 |
+
ids: ids
|
39 |
+
}
|
40 |
+
})
|
41 |
+
.done(function(data) {
|
42 |
+
//console.log(data);
|
43 |
+
location.reload(true);
|
44 |
+
});
|
45 |
+
|
46 |
+
});
|
47 |
+
|
48 |
+
/* Delete single Std Event */
|
49 |
+
$('.btn-delete-std-event').on('click', function(e){
|
50 |
+
e.preventDefault();
|
51 |
+
$(this).addClass('disabled');
|
52 |
+
|
53 |
+
var ids = [];
|
54 |
+
ids.push( $(this).data('id') );
|
55 |
+
|
56 |
+
$.ajax({
|
57 |
+
url: pys.ajax,
|
58 |
+
type: 'post',
|
59 |
+
dataType: 'json',
|
60 |
+
data: {
|
61 |
+
action: 'pys_delete_std_event',
|
62 |
+
ids: ids
|
63 |
+
}
|
64 |
+
})
|
65 |
+
.done(function(data) {
|
66 |
+
//console.log(data);
|
67 |
+
location.reload(true);
|
68 |
+
});
|
69 |
+
|
70 |
+
});
|
71 |
+
|
72 |
+
/* Woo events toggle */
|
73 |
+
// set main switcher state on page load
|
74 |
+
if($('.woo-option').length == $('.woo-option:checked').length) {
|
75 |
+
$('.woo-events-toggle').prop('checked', 'checked');
|
76 |
+
}
|
77 |
+
|
78 |
+
/* Woo events toggle */
|
79 |
+
// add multiple select / deselect functionality
|
80 |
+
$('.woo-events-toggle').click(function(){
|
81 |
+
var options = $('.woo-option');
|
82 |
+
options.prop('checked', this.checked);
|
83 |
+
});
|
84 |
+
|
85 |
+
/* Woo events toggle */
|
86 |
+
// if all checkbox are selected, check the selectall checkbox and viceversa
|
87 |
+
$('.woo-option').click(function(){
|
88 |
+
|
89 |
+
if($('.woo-option').length == $('.woo-option:checked').length) {
|
90 |
+
$('.woo-events-toggle').prop('checked', 'checked');
|
91 |
+
} else {
|
92 |
+
$('.woo-events-toggle').removeAttr('checked');
|
93 |
+
}
|
94 |
+
|
95 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
}); /* Dom Loaded */
|
js/public.js
CHANGED
@@ -1,114 +1,15 @@
|
|
1 |
-
function
|
2 |
|
3 |
-
|
4 |
-
.
|
5 |
-
.replace(/&$/, '')
|
6 |
-
.split('&'),
|
7 |
-
sal = strArr.length,
|
8 |
-
i, j, ct, p, lastObj, obj, lastIter, undef, chr, tmp, key, value,
|
9 |
-
postLeftBracketPos, keys, keysLen,
|
10 |
-
fixStr = function(str) {
|
11 |
-
return decodeURIComponent(str.replace(/\+/g, '%20'));
|
12 |
-
};
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
}
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
key = fixStr(tmp[0]);
|
21 |
-
value = (tmp.length < 2) ? '' : fixStr(tmp[1]);
|
22 |
-
|
23 |
-
while (key.charAt(0) === ' ') {
|
24 |
-
key = key.slice(1);
|
25 |
-
}
|
26 |
-
if (key.indexOf('\x00') > -1) {
|
27 |
-
key = key.slice(0, key.indexOf('\x00'));
|
28 |
-
}
|
29 |
-
if (key && key.charAt(0) !== '[') {
|
30 |
-
keys = [];
|
31 |
-
postLeftBracketPos = 0;
|
32 |
-
for (j = 0; j < key.length; j++) {
|
33 |
-
if (key.charAt(j) === '[' && !postLeftBracketPos) {
|
34 |
-
postLeftBracketPos = j + 1;
|
35 |
-
} else if (key.charAt(j) === ']') {
|
36 |
-
if (postLeftBracketPos) {
|
37 |
-
if (!keys.length) {
|
38 |
-
keys.push(key.slice(0, postLeftBracketPos - 1));
|
39 |
-
}
|
40 |
-
keys.push(key.substr(postLeftBracketPos, j - postLeftBracketPos));
|
41 |
-
postLeftBracketPos = 0;
|
42 |
-
if (key.charAt(j + 1) !== '[') {
|
43 |
-
break;
|
44 |
-
}
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
if (!keys.length) {
|
49 |
-
keys = [key];
|
50 |
-
}
|
51 |
-
for (j = 0; j < keys[0].length; j++) {
|
52 |
-
chr = keys[0].charAt(j);
|
53 |
-
if (chr === ' ' || chr === '.' || chr === '[') {
|
54 |
-
keys[0] = keys[0].substr(0, j) + '_' + keys[0].substr(j + 1);
|
55 |
-
}
|
56 |
-
if (chr === '[') {
|
57 |
-
break;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
obj = array;
|
62 |
-
for (j = 0, keysLen = keys.length; j < keysLen; j++) {
|
63 |
-
key = keys[j].replace(/^['"]/, '')
|
64 |
-
.replace(/['"]$/, '');
|
65 |
-
lastIter = j !== keys.length - 1;
|
66 |
-
lastObj = obj;
|
67 |
-
if ((key !== '' && key !== ' ') || j === 0) {
|
68 |
-
if (obj[key] === undef) {
|
69 |
-
obj[key] = {};
|
70 |
-
}
|
71 |
-
obj = obj[key];
|
72 |
-
} else { // To insert new dimension
|
73 |
-
ct = -1;
|
74 |
-
for (p in obj) {
|
75 |
-
if (obj.hasOwnProperty(p)) {
|
76 |
-
if (+p > ct && p.match(/^\d+$/g)) {
|
77 |
-
ct = +p;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
}
|
81 |
-
key = ct + 1;
|
82 |
}
|
83 |
-
}
|
84 |
-
lastObj[key] = value;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
jQuery(function($){
|
93 |
-
|
94 |
-
|
95 |
-
/*$( document ).ajaxComplete(function( event, xhr, settings ) {
|
96 |
-
|
97 |
-
var ajaxurl = settings.url;
|
98 |
-
var ajaxdata = settings.data;
|
99 |
-
//var ajaxresponse = xhr.responseText;
|
100 |
-
|
101 |
-
if( ajaxurl == '/?wc-ajax=add_to_cart' ){
|
102 |
-
|
103 |
-
var dataObj = {};
|
104 |
-
woofp_parse_str(ajaxdata, dataObj);
|
105 |
-
console.log(dataObj);
|
106 |
-
if( dataObj.product_id != '' ){
|
107 |
-
fbq('track', 'AddToCart');
|
108 |
-
}
|
109 |
-
|
110 |
-
});*/
|
111 |
-
|
112 |
|
113 |
-
});
|
114 |
|
|
1 |
+
jQuery(document).ready(function( $ ) {
|
2 |
|
3 |
+
// AddToCart button
|
4 |
+
$(".ajax_add_to_cart").click(function(e){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
var code = jQuery(this).attr('data-pixelcode') || false;
|
7 |
+
console.log( code );
|
|
|
8 |
|
9 |
+
if( code != false && code != '' ) {
|
10 |
+
eval( code );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
});
|
14 |
|
15 |
+
});
|
readme.txt
CHANGED
@@ -1,64 +1,104 @@
|
|
1 |
===Facebook Pixel by PixelYourSite - Standard Events & WooCommerce===
|
2 |
-
Contributors: PixelYourSite, c0d3fev3r
|
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.5.2
|
6 |
-
Stable tag:
|
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 |
-
|
14 |
|
|
|
15 |
|
16 |
-
|
17 |
|
18 |
-
**
|
19 |
|
|
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
* You can **set up and track Standard or Custom Events** and add parameters for each of them
|
24 |
|
|
|
|
|
25 |
* Track **conversion value** for standard or custom events
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
* You can **insert the Facebook pixel and start tracking events on any WooCommerce** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
|
28 |
|
|
|
|
|
29 |
* **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
|
30 |
|
31 |
-
* **
|
32 |
|
33 |
-
* **
|
34 |
|
35 |
-
*
|
|
|
|
|
36 |
|
37 |
-
*
|
|
|
|
|
38 |
|
39 |
* **WooCommerce Affiliate Products Events:** you can add a dynamic event that will trigger on affiliate button clicks ([Pro Version](http://www.pixelyoursite.com))
|
40 |
|
41 |
-
* **WooCommerce PayPal Standard Events:** you can add a dynamic event that will trigger on WooCommerce PayPal button clicks ([Pro Version](http://www.pixelyoursite.com))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
|
|
|
45 |
|
46 |
-
**
|
47 |
|
48 |
-
|
49 |
|
50 |
-
**Important:**
|
51 |
|
52 |
-
|
53 |
|
54 |
-
|
55 |
-
Event ID: AddToCart
|
56 |
|
57 |
-
You can safely ignore them. It is a normal error trigger by the dynamic AddToCart event, that will disappear after you click on the add to cart button.
|
58 |
|
59 |
-
For more details on Facebook Pixel errors
|
|
|
|
|
60 |
|
61 |
-
**Instal the plugin now, because it is easy to use, and will help you with your Facebook campaigns.**
|
62 |
|
63 |
== Installation ==
|
64 |
* From the WP admin panel, click \"Plugins\" -> \"Add new\".
|
@@ -106,7 +146,7 @@ a. The pixel code will be added on every page of your site
|
|
106 |
|
107 |
b. A "Search" standard event will be added on the search page of your site
|
108 |
|
109 |
-
c. A
|
110 |
|
111 |
**What happens when I activate the WooCommerce Setup?**
|
112 |
|
@@ -120,13 +160,13 @@ Purchase event is added on the Thank You page
|
|
120 |
|
121 |
Yes, you can! There is a simple menu where you can do that. You'll need to add an URL and select the event type you want to add. If necessary, you can give each event a monetary value and its own currency.
|
122 |
|
123 |
-
**Can I have more
|
124 |
|
125 |
-
Yes, you can!
|
126 |
|
127 |
**Can I use your plugin for Facebook Dynamic Ads?**
|
128 |
|
129 |
-
Yes,
|
130 |
|
131 |
**Are there any known incompatibilities with other themes or plugins?**
|
132 |
|
@@ -139,98 +179,110 @@ If any incompatibilities will arise we will add them here and, of course, will t
|
|
139 |
|
140 |
**I have the pixel installed on my website and I am running a Facebook Campaign, but the reports are confusing me. How can I see my campaign results?**
|
141 |
|
142 |
-
We have an article about how to optimize Facebook Ads Reports:
|
143 |
<strong><a href="http://www.pixelyoursite.com/facebook-ads-reports-optimisation" target="_blank"><span style="color:#DE4D4D;">How to optimize your Facebook Ads Reports for events tracking</span></a></strong>
|
144 |
|
145 |
== Screenshots ==
|
146 |
|
147 |
-
1. Add your Facebook Pixel ID and the plugin will insert the code on every page
|
148 |
-
2. You
|
149 |
-
3.
|
150 |
-
4.
|
151 |
-
5.
|
152 |
-
6.
|
153 |
-
7.
|
154 |
-
8.
|
155 |
-
9.
|
156 |
|
157 |
== Changelog ==
|
158 |
|
159 |
-
PixelYourSite
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
|
162 |
|
|
|
163 |
|
164 |
-
|
165 |
|
166 |
-
- Adding IDR (Indonezian Ruphiah) in the currency list
|
167 |
|
|
|
168 |
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
|
175 |
-
|
176 |
|
177 |
-
|
178 |
|
179 |
-
|
180 |
|
181 |
-
|
182 |
|
183 |
-
|
184 |
|
185 |
-
|
186 |
|
187 |
-
- Fixing not closing admin notice error
|
188 |
|
|
|
189 |
|
190 |
-
|
191 |
|
192 |
-
|
193 |
|
194 |
-
|
195 |
|
196 |
-
|
197 |
|
198 |
-
|
199 |
|
200 |
-
|
201 |
|
202 |
-
|
203 |
|
204 |
-
|
205 |
|
206 |
-
|
207 |
|
208 |
-
|
209 |
|
210 |
-
|
211 |
|
212 |
-
|
213 |
|
214 |
-
|
215 |
|
216 |
-
|
217 |
|
218 |
-
|
219 |
|
220 |
-
|
221 |
|
222 |
-
|
|
|
223 |
|
224 |
-
|
225 |
-
- Added super special offer for the PRO version
|
226 |
|
227 |
-
|
|
|
|
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
|
233 |
|
234 |
== Upgrade Notice ==
|
235 |
|
236 |
-
|
|
|
|
|
|
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.5.2
|
6 |
+
Stable tag: 3.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 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 on any page or post. There is an **out of the box WooCommerce setup** that will configure all the necessary standard events for you.
|
18 |
|
19 |
+
**Facebook Dynamic Ads are fully supported on 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, content_type, content_ids on every page of your site. We also have a guide that you can download for free on how to handle this option and how to build Custom Audiences.
|
22 |
|
23 |
+
There is 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 |
+
|
27 |
+
Not ready to install yet? Read on some of the key features that make PYS a powerful tool in any Facebook marketer arsenal.
|
28 |
+
|
29 |
+
<strong>PixelYourSite Key Features:</strong></br>
|
30 |
+
|
31 |
+
* You can **insert the pixel on every page of your website with just a few clicks**. No need to edit any posts or pages
|
32 |
+
|
33 |
+
* **Search Event** on the search page with the search string pulled as parameter - super useful for creating search based Custom Audiences
|
34 |
+
|
35 |
+
* You can turn ON/OFF the pixel based on user roles (remove it for admins, editors and so on)
|
36 |
|
37 |
* You can **set up and track Standard or Custom Events** and add parameters for each of them
|
38 |
|
39 |
+
* **Dynamic Events:** optimize your Facebook Campaigns for actions on your website (CLICKS on links, buttons, forms). Works with **Contact Form 7** and any other form or pop-up plugins. ([Pro Version](http://www.pixelyoursite.com))
|
40 |
+
|
41 |
* Track **conversion value** for standard or custom events
|
42 |
|
43 |
+
* We automatically add a TimeOnPage event that measures the time each visitor spends on every page. It can be used for Custom Audiences ([Pro Version](http://www.pixelyoursite.com))
|
44 |
+
|
45 |
+
* You have a General Event option that you can customize. It is triggered on every page and automatically tracks content_type, content_id and content_name. Extremely useful for Custom Audiences
|
46 |
+
|
47 |
+
> <strong>How to create powerful Custom Audiences with PixelyourSite</strong>
|
48 |
+
|
49 |
+
> You can use the General Event option to create powerful Custom Audiences based on events (Custom Combination).
|
50 |
+
|
51 |
+
> 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)
|
52 |
+
|
53 |
+
<strong>Superb WooCommerce Integration</strong><br>
|
54 |
+
|
55 |
* You can **insert the Facebook pixel and start tracking events on any WooCommerce** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
|
56 |
|
57 |
+
* Out of the box **Facebook Dynamic Ads** setup for your Woocommerce website (we also have a dedicated feed plugin for Facebook Dynamic Ads Product Catalog)
|
58 |
+
|
59 |
* **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
|
60 |
|
61 |
+
* **Track conversion value for WooCommerce** ([Pro Version](http://www.pixelyoursite.com))
|
62 |
|
63 |
+
* **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.
|
64 |
|
65 |
+
* You can turn ON/OFF each WooCommerce event.
|
66 |
+
|
67 |
+
* You can turn ON/OFF value for each WooCommerce event.
|
68 |
|
69 |
+
* **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))
|
70 |
+
|
71 |
+
* **Advance Matching** is supported for the Purchase Event - 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 ([Pro Version](http://www.pixelyoursite.com))
|
72 |
|
73 |
* **WooCommerce Affiliate Products Events:** you can add a dynamic event that will trigger on affiliate button clicks ([Pro Version](http://www.pixelyoursite.com))
|
74 |
|
75 |
+
* **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))
|
76 |
+
|
77 |
+
* Fully tested with WooCommerce 2.6 and above
|
78 |
+
|
79 |
+
|
80 |
+
<strong>What's next<strong>
|
81 |
+
|
82 |
+
We are working on some new handy features for the plugin and we will release them soon.
|
83 |
|
84 |
+
<strong>Pixel Helper False Errors</strong>
|
85 |
|
86 |
+
If you are testing your pixel with Pixel Helper Chrome Extension, it is possible that you will see some **false** errors:
|
87 |
|
88 |
+
**Event ID: AddToCart**: Facebook Pixel did not load.
|
89 |
|
90 |
+
You can safely ignore it. It is a normal error trigger by the dynamic AddToCart event that will disappear after you click on the add to cart button.
|
91 |
|
|
|
92 |
|
93 |
+
**Event ID: GeneralEvent**: Content_type is missing, should be either 'product' or 'product_group'
|
94 |
|
95 |
+
You can safely ignore it. It’s a Dynamic Ads warning, but this event is not meant to be used for Dynamic Ads. It is completely dedicated to Custom Audiences and works perfectly. If you are using WooCommerce, there is a ViewContent event fully ready for the Dynamic Ads job.
|
|
|
96 |
|
|
|
97 |
|
98 |
+
For more details on how to use Facebook Pixel Helper and how to interpret its reported errors [read this special article](http://www.pixelyoursite.com/facebook-pixel-helper-errors)
|
99 |
+
|
100 |
+
**Let’s start now!** Join other thousands of users and instal the plugin, because it is easy to use, and will help you with your Facebook campaigns for real
|
101 |
|
|
|
102 |
|
103 |
== Installation ==
|
104 |
* From the WP admin panel, click \"Plugins\" -> \"Add new\".
|
146 |
|
147 |
b. A "Search" standard event will be added on the search page of your site
|
148 |
|
149 |
+
c. A GeneralEvent will be added on every page, pulling content_name, content_ids and content_type. It can be used for Custom Audiences.
|
150 |
|
151 |
**What happens when I activate the WooCommerce Setup?**
|
152 |
|
160 |
|
161 |
Yes, you can! There is a simple menu where you can do that. You'll need to add an URL and select the event type you want to add. If necessary, you can give each event a monetary value and its own currency.
|
162 |
|
163 |
+
**Can I have more than just one event on a page?**
|
164 |
|
165 |
+
Yes, you can! You can have any number of events you want on a page.
|
166 |
|
167 |
**Can I use your plugin for Facebook Dynamic Ads?**
|
168 |
|
169 |
+
Yes, you can! Facebook Dynamic Product Ads are fully supported for WooCommerce. We plan to add a similar integration for Easy Digital Downoads soon.
|
170 |
|
171 |
**Are there any known incompatibilities with other themes or plugins?**
|
172 |
|
179 |
|
180 |
**I have the pixel installed on my website and I am running a Facebook Campaign, but the reports are confusing me. How can I see my campaign results?**
|
181 |
|
182 |
+
We have an article about how to optimize Facebook Ads Reports:
|
183 |
<strong><a href="http://www.pixelyoursite.com/facebook-ads-reports-optimisation" target="_blank"><span style="color:#DE4D4D;">How to optimize your Facebook Ads Reports for events tracking</span></a></strong>
|
184 |
|
185 |
== Screenshots ==
|
186 |
|
187 |
+
1. Add your Facebook Pixel ID and the plugin will insert the code on every page of your website
|
188 |
+
2. You don’t have to copy/paste all the pixel code, but just the pixel ID. You can find it in your Ads Manager, under Pixels
|
189 |
+
3. The Search Event will pull each search on your site as a parameter. You can use it to create Custom Audiences
|
190 |
+
4. The GeneralEvent is triggered on every page and can be used for Custom Audiences. We have a free guide on how to use it, liked from the plugin itself
|
191 |
+
5. Adding events on any URL of any page of your website is easy: just add the URL, select event type and fill the desired parameters values
|
192 |
+
6. If you want you can insert a custom event code
|
193 |
+
7. Or you can select a standard event and use the default parameters
|
194 |
+
8. WooCommerce integration comes with out of the box Facebook Dynamic Ads setup
|
195 |
+
9. These are the normal events on a WooCommerce thank you page: the Purchase event has content_ids and content_types (required by Dynamic Ads). The reported error for the GeneralEvent can be ignored (as explained in the help pages)
|
196 |
|
197 |
== Changelog ==
|
198 |
|
199 |
+
= PixelYourSite 3.0 =
|
200 |
+
|
201 |
+
This is a major release, with new design and new features:
|
202 |
+
|
203 |
+
* Completely new design
|
204 |
+
|
205 |
+
* New GeneralEvent feature for improved Custom Audience building (with a free guide)
|
206 |
|
207 |
+
* ON/OFF option for user roles
|
208 |
|
209 |
+
* Improved Events and Dynamic Events control
|
210 |
|
211 |
+
* Facebook Dynamic Ads Pixel Setup for WooCommerce
|
212 |
|
|
|
213 |
|
214 |
+
= PixelYourSite 2.2.4 =
|
215 |
|
216 |
+
* Fixig a few back*end errors and conflicts
|
217 |
|
218 |
+
* Adding new currencies
|
219 |
|
220 |
+
= PixelYourSite 2.2.3 =
|
221 |
|
222 |
+
* Learning links updated
|
223 |
|
224 |
+
* Minor PHP warning fixed
|
225 |
|
226 |
+
= PixelYourSite 2.2.2 =
|
227 |
|
228 |
+
* Minor fix for admin notice
|
229 |
|
230 |
+
= PixelYourSite 2.2.1 =
|
231 |
|
232 |
+
* Fixing not closing admin notice error
|
233 |
|
|
|
234 |
|
235 |
+
= PixelYourSite 2.2 =
|
236 |
|
237 |
+
* Introducing Dynamic Events (pro)
|
238 |
|
239 |
+
* Introducing our new Learning Section
|
240 |
|
241 |
+
= PixelYourSite 2.1 =
|
242 |
|
243 |
+
* Introducing new WooCommerce Paypal Standard events (pro)
|
244 |
|
245 |
+
= PixelYourSite 2.0 =
|
246 |
|
247 |
+
* This update adds full control on Standard Events, with the possibility to define all the available parameters for each event
|
248 |
|
249 |
+
* You can also add the code for each event with the new event text field. This also lets you define custom events
|
250 |
|
251 |
+
* WooCommerce Affiliate Products events: you can define events that will trigger on affiliate buttons clicks
|
252 |
|
253 |
+
* Fixed a potential error for the WooCommerce Purchase Event
|
254 |
|
255 |
+
= PixelYourSite 1.05 =
|
256 |
|
257 |
+
* Updated offer for the PRO version
|
258 |
|
259 |
+
= PixelYourSite 1.04 =
|
260 |
|
261 |
+
* Fixed fresh install error (when no settings saved)
|
262 |
|
263 |
+
= PixelYourSite 1.03 =
|
264 |
|
265 |
+
* Fixed "Select options" error for variable products on categories pages
|
266 |
|
267 |
+
= PixelYourSite 1.02 =
|
268 |
|
269 |
+
* Fixed currency symbol error
|
270 |
+
* Added super special offer for the PRO version
|
271 |
|
272 |
+
= PixelYourSite 1.01 =
|
|
|
273 |
|
274 |
+
* Dynamic AddToCart event for WooCommerce (the AddToCart event will trigger when a users click on the add to cart button)
|
275 |
+
* Dynamic AddToCart works with WooCommerce shortcodes.
|
276 |
+
* Fixed a false error that was reported for the Purchase WooCommerce event by Pixel Helper extension on the Thank You page.
|
277 |
|
278 |
+
= PixelYourSite 1.0 =
|
279 |
+
|
280 |
+
* A new plugin is borne: It will let you manage the Facebook Pixel with just a few clicks
|
281 |
|
282 |
|
283 |
== Upgrade Notice ==
|
284 |
|
285 |
+
= 3.0 =
|
286 |
+
|
287 |
+
3.0 is a complete rewrite, with a new design and improve functionality. You have a new GeneralEvent that can be used to create Custom Audiences (plus a FREE guide on how to do it!) and Facebook Dynamic Ads are fully supported for WooCommerce. Update, then open the plugin menu for details
|
288 |
+
|