Version Description
Download this release
Release Info
Developer | tareq1988 |
Plugin | WooCommerce Conversion Tracking |
Version | 2.0 |
Comparing to | |
See all releases |
Version 2.0
- assets/css/style.css +328 -0
- assets/images/adwords.png +0 -0
- assets/images/custom.png +0 -0
- assets/images/facebook.png +0 -0
- assets/images/getting_started.png +0 -0
- assets/images/logo-full.png +0 -0
- assets/images/logo.png +0 -0
- assets/images/perfect_audience.png +0 -0
- assets/images/screenshot.png +0 -0
- assets/images/twitter.png +0 -0
- assets/js/admin.js +91 -0
- assets/js/sweetalert.min.js +1 -0
- conversion-tracking.php +292 -0
- includes/class-abstract-integration.php +155 -0
- includes/class-admin.php +109 -0
- includes/class-ajax.php +45 -0
- includes/class-event-dispatcher.php +194 -0
- includes/class-integration-manager.php +69 -0
- includes/class-integration-pro-features.php +145 -0
- includes/class-upgrades.php +66 -0
- includes/class-wedevs-insights.php +750 -0
- includes/class-welcome-20.php +60 -0
- includes/integration.php +354 -0
- includes/integrations/class-integration-custom.php +147 -0
- includes/integrations/class-integration-facebook.php +252 -0
- includes/integrations/class-integration-google.php +126 -0
- includes/integrations/class-integration-twitter.php +125 -0
- includes/upgrades/upgrade-2.0.php +29 -0
- includes/views/admin.php +17 -0
- includes/views/settings.php +160 -0
- includes/views/welcome-20.php +156 -0
- languages/woocommerce-conversion-tracking.pot +302 -0
- readme.txt +153 -0
assets/css/style.css
ADDED
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Woocommerce-Conversion-Tracking - v1.0.0
|
3 |
+
Generated: 2018-02-20 (1519126580166)
|
4 |
+
PLEASE DO NOT MODIFY*/
|
5 |
+
.wcct-admin {
|
6 |
+
/**
|
7 |
+
* Form Settings area
|
8 |
+
*/
|
9 |
+
/**
|
10 |
+
* Sidebar Area
|
11 |
+
*/
|
12 |
+
}
|
13 |
+
.wcct-admin .nav-tab.disabled {
|
14 |
+
color: #b1b1b1;
|
15 |
+
}
|
16 |
+
.wcct-admin .wcct-two-column {
|
17 |
+
display: flex;
|
18 |
+
}
|
19 |
+
.wcct-admin .wcct-two-column .settings-wrap {
|
20 |
+
width: 70%;
|
21 |
+
}
|
22 |
+
.wcct-admin .wcct-two-column .sidebar-wrap {
|
23 |
+
width: 33%;
|
24 |
+
}
|
25 |
+
.wcct-admin .switch input {
|
26 |
+
display: none;
|
27 |
+
}
|
28 |
+
.wcct-admin .switch input:checked + .slider {
|
29 |
+
background-color: #64b450;
|
30 |
+
}
|
31 |
+
.wcct-admin .switch input:checked + .slider:before {
|
32 |
+
-webkit-transform: translateX(22px);
|
33 |
+
-ms-transform: translateX(22px);
|
34 |
+
transform: translateX(22px);
|
35 |
+
}
|
36 |
+
.wcct-admin .switch .slider {
|
37 |
+
position: absolute;
|
38 |
+
cursor: pointer;
|
39 |
+
top: 0;
|
40 |
+
left: 0;
|
41 |
+
right: 0;
|
42 |
+
bottom: 0;
|
43 |
+
background-color: #CCC;
|
44 |
+
-webkit-transition: .4s;
|
45 |
+
transition: .4s;
|
46 |
+
}
|
47 |
+
.wcct-admin .switch .slider.round {
|
48 |
+
border-radius: 34px;
|
49 |
+
}
|
50 |
+
.wcct-admin .switch .slider.round:before {
|
51 |
+
border-radius: 50%;
|
52 |
+
}
|
53 |
+
.wcct-admin .switch .slider:before {
|
54 |
+
position: absolute;
|
55 |
+
content: "";
|
56 |
+
height: 14px;
|
57 |
+
width: 14px;
|
58 |
+
left: 2px;
|
59 |
+
bottom: 2px;
|
60 |
+
background-color: white;
|
61 |
+
-webkit-transition: .4s;
|
62 |
+
transition: .4s;
|
63 |
+
}
|
64 |
+
.wcct-admin input[type="checkbox"] {
|
65 |
+
border: 1px solid #b4b9be;
|
66 |
+
background: #fff;
|
67 |
+
color: #555;
|
68 |
+
clear: none;
|
69 |
+
cursor: pointer;
|
70 |
+
line-height: 0;
|
71 |
+
height: 16px;
|
72 |
+
margin: -4px 4px 0 0;
|
73 |
+
outline: 0;
|
74 |
+
padding: 0!important;
|
75 |
+
text-align: center;
|
76 |
+
vertical-align: middle;
|
77 |
+
width: 16px;
|
78 |
+
min-width: 16px;
|
79 |
+
-webkit-appearance: none;
|
80 |
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
81 |
+
transition: 0.05s border-color ease-in-out;
|
82 |
+
}
|
83 |
+
.wcct-admin .slider.round:before {
|
84 |
+
border-radius: 50%;
|
85 |
+
}
|
86 |
+
.wcct-admin .submit-area {
|
87 |
+
display: block;
|
88 |
+
overflow: hidden;
|
89 |
+
margin-top: 30px;
|
90 |
+
padding-bottom: 10px;
|
91 |
+
max-width: 600px;
|
92 |
+
}
|
93 |
+
.wcct-admin .submit-area #wcct-submit {
|
94 |
+
float: right;
|
95 |
+
}
|
96 |
+
.wcct-admin .custom-table {
|
97 |
+
margin-top: 0;
|
98 |
+
}
|
99 |
+
.wcct-admin .custom-table th {
|
100 |
+
width: 150px !important;
|
101 |
+
}
|
102 |
+
.wcct-admin .custom-table td {
|
103 |
+
font-weight: normal;
|
104 |
+
}
|
105 |
+
.wcct-admin .custom-table textarea {
|
106 |
+
font-family: monospace;
|
107 |
+
}
|
108 |
+
.wcct-admin .custom-table .help {
|
109 |
+
font-weight: normal;
|
110 |
+
}
|
111 |
+
.wcct-admin .settings-wrap h4 {
|
112 |
+
margin-top: 5px;
|
113 |
+
}
|
114 |
+
.wcct-admin .settings-wrap .integration-wrap {
|
115 |
+
max-width: 600px;
|
116 |
+
border: 1px solid #e5e5e5;
|
117 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
118 |
+
margin-top: 20px;
|
119 |
+
background: #fff;
|
120 |
+
}
|
121 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-name {
|
122 |
+
background: #ffffff;
|
123 |
+
padding: 15px 15px;
|
124 |
+
border-bottom: 1px solid #f1f1f1;
|
125 |
+
}
|
126 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-settings {
|
127 |
+
background: #fff;
|
128 |
+
padding-left: 25px;
|
129 |
+
display: none;
|
130 |
+
}
|
131 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-settings .wc-ct-option {
|
132 |
+
margin-left: 0px;
|
133 |
+
margin-top: 15px;
|
134 |
+
}
|
135 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-settings textarea {
|
136 |
+
width: 100%;
|
137 |
+
}
|
138 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-settings input[type="text"] {
|
139 |
+
min-width: 300px;
|
140 |
+
}
|
141 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-settings .wc-ct-form-group {
|
142 |
+
padding: 10px;
|
143 |
+
margin-right: 25px;
|
144 |
+
margin-bottom: 15px;
|
145 |
+
margin-top: 20px;
|
146 |
+
}
|
147 |
+
.wcct-admin .settings-wrap .integration-wrap .integration-settings .wcct-border {
|
148 |
+
border: 1px solid #e5e5e5;
|
149 |
+
}
|
150 |
+
.wcct-admin .settings-wrap .integration-wrap .gateway {
|
151 |
+
display: flex;
|
152 |
+
flex-flow: 1 1 auto;
|
153 |
+
}
|
154 |
+
.wcct-admin .settings-wrap .integration-wrap .gateway img {
|
155 |
+
height: 26px;
|
156 |
+
width: auto;
|
157 |
+
margin-right: 15px;
|
158 |
+
}
|
159 |
+
.wcct-admin .settings-wrap .integration-wrap .gateway label,
|
160 |
+
.wcct-admin .settings-wrap .integration-wrap .gateway .gateway-text {
|
161 |
+
flex: 1 1 auto;
|
162 |
+
max-width: 15%;
|
163 |
+
}
|
164 |
+
.wcct-admin .settings-wrap .integration-wrap .gateway .gateway-text {
|
165 |
+
margin: 0 30px 0 0;
|
166 |
+
max-width: 90%;
|
167 |
+
font-size: 1.2em;
|
168 |
+
line-height: 26px;
|
169 |
+
}
|
170 |
+
.wcct-admin .settings-wrap .integration-wrap .gateway label.switch {
|
171 |
+
position: relative;
|
172 |
+
display: inline-block;
|
173 |
+
max-width: 40px;
|
174 |
+
height: 18px;
|
175 |
+
margin-top: 5px;
|
176 |
+
}
|
177 |
+
.wcct-admin .settings-wrap .integration-wrap .single-integration {
|
178 |
+
padding-bottom: 15px !important;
|
179 |
+
}
|
180 |
+
.wcct-admin .settings-wrap .integration-wrap .event-label-box {
|
181 |
+
display: none;
|
182 |
+
}
|
183 |
+
.wcct-admin .settings-wrap .integration-wrap .event-label-space {
|
184 |
+
margin-top: 8px;
|
185 |
+
margin-bottom: 8px;
|
186 |
+
}
|
187 |
+
.wcct-admin .settings-wrap .integration-wrap .disabled-class {
|
188 |
+
color: #ccc;
|
189 |
+
}
|
190 |
+
@media (max-width: 1024px) {
|
191 |
+
.wcct-admin .settings-wrap {
|
192 |
+
margin-right: 40px;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
.wcct-admin .sidebar-wrap {
|
196 |
+
margin-top: 50px;
|
197 |
+
}
|
198 |
+
.wcct-admin .sidebar-wrap .premium-box {
|
199 |
+
width: 100%;
|
200 |
+
min-height: 100px;
|
201 |
+
margin-bottom: 25px;
|
202 |
+
box-sizing: border-box;
|
203 |
+
padding: 10px 20px;
|
204 |
+
border: 1px solid #dfdfdf;
|
205 |
+
}
|
206 |
+
.wcct-admin .sidebar-wrap .premium-box.box-green {
|
207 |
+
background: #ffffff;
|
208 |
+
}
|
209 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue {
|
210 |
+
color: #444;
|
211 |
+
background: #fff;
|
212 |
+
padding-bottom: 27px;
|
213 |
+
}
|
214 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue p {
|
215 |
+
font-size: 15px;
|
216 |
+
font-weight: normal;
|
217 |
+
}
|
218 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue h3 {
|
219 |
+
color: #444;
|
220 |
+
}
|
221 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue .pro-button {
|
222 |
+
text-decoration: none;
|
223 |
+
padding: 5px 20px;
|
224 |
+
background: #fff;
|
225 |
+
border-radius: 50px;
|
226 |
+
color: #F37599;
|
227 |
+
}
|
228 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue .dashicons-yes {
|
229 |
+
color: green;
|
230 |
+
font-size: 1.5em;
|
231 |
+
}
|
232 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue ul.premium-feature-list {
|
233 |
+
margin-bottom: 15px;
|
234 |
+
}
|
235 |
+
.wcct-admin .sidebar-wrap .premium-box.box-blue .premium-feature-list li:before {
|
236 |
+
content: "\f147";
|
237 |
+
font-family: dashicons;
|
238 |
+
display: inline-block;
|
239 |
+
background: #64b450;
|
240 |
+
color: #fff;
|
241 |
+
padding: 0 3px;
|
242 |
+
margin-right: 10px;
|
243 |
+
border-radius: 50%;
|
244 |
+
}
|
245 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-title {
|
246 |
+
color: #444;
|
247 |
+
}
|
248 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list {
|
249 |
+
display: flex;
|
250 |
+
flex-flow: row wrap;
|
251 |
+
}
|
252 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list li {
|
253 |
+
list-style: none;
|
254 |
+
text-align: center;
|
255 |
+
margin: 5px;
|
256 |
+
flex: 0 1 100%;
|
257 |
+
display: list-item;
|
258 |
+
box-sizing: border-box;
|
259 |
+
border: 1px solid #ddd;
|
260 |
+
border-radius: 3px;
|
261 |
+
padding: 0 0 15px 0;
|
262 |
+
}
|
263 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list li a {
|
264 |
+
text-decoration: none;
|
265 |
+
font-size: 13px;
|
266 |
+
color: #444;
|
267 |
+
display: block;
|
268 |
+
}
|
269 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list li img.doc-list-icon {
|
270 |
+
display: block;
|
271 |
+
width: 24px;
|
272 |
+
height: auto;
|
273 |
+
margin: 10px auto;
|
274 |
+
}
|
275 |
+
@media (min-width: 768px) {
|
276 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list li {
|
277 |
+
flex: 0 1 100%;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
@media (min-width: 992px) {
|
281 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list li {
|
282 |
+
flex: 0 1 calc(45%);
|
283 |
+
}
|
284 |
+
}
|
285 |
+
@media (min-width: 1367px) {
|
286 |
+
.wcct-admin .sidebar-wrap .premium-box .wcct-doc-list li {
|
287 |
+
flex: 0 1 calc(28%);
|
288 |
+
}
|
289 |
+
}
|
290 |
+
.wcct-admin .wcct-tooltip {
|
291 |
+
position: relative;
|
292 |
+
display: inline-block;
|
293 |
+
}
|
294 |
+
.wcct-admin .wcct-tooltip .wcct-tooltiptext {
|
295 |
+
visibility: hidden;
|
296 |
+
background-color: #24292E;
|
297 |
+
font-size: 10px;
|
298 |
+
color: #fff;
|
299 |
+
text-align: center;
|
300 |
+
border-radius: 6px;
|
301 |
+
padding: 3px 0;
|
302 |
+
position: absolute;
|
303 |
+
z-index: 1;
|
304 |
+
bottom: 125%;
|
305 |
+
left: 50%;
|
306 |
+
opacity: 0;
|
307 |
+
transition: opacity 0.3s;
|
308 |
+
}
|
309 |
+
.wcct-admin .wcct-tooltip .integration-tooltip {
|
310 |
+
margin-left: -40px;
|
311 |
+
padding: 7px 0px;
|
312 |
+
font-size: 13px;
|
313 |
+
width: 75px;
|
314 |
+
}
|
315 |
+
.wcct-admin .wcct-tooltip .wcct-tooltiptext::after {
|
316 |
+
content: "";
|
317 |
+
position: absolute;
|
318 |
+
top: 100%;
|
319 |
+
left: 50%;
|
320 |
+
margin-left: -5px;
|
321 |
+
border-width: 5px;
|
322 |
+
border-style: solid;
|
323 |
+
border-color: #24292E transparent transparent transparent;
|
324 |
+
}
|
325 |
+
.wcct-admin .wcct-tooltip:hover .wcct-tooltiptext {
|
326 |
+
visibility: visible;
|
327 |
+
opacity: 1;
|
328 |
+
}
|
assets/images/adwords.png
ADDED
Binary file
|
assets/images/custom.png
ADDED
Binary file
|
assets/images/facebook.png
ADDED
Binary file
|
assets/images/getting_started.png
ADDED
Binary file
|
assets/images/logo-full.png
ADDED
Binary file
|
assets/images/logo.png
ADDED
Binary file
|
assets/images/perfect_audience.png
ADDED
Binary file
|
assets/images/screenshot.png
ADDED
Binary file
|
assets/images/twitter.png
ADDED
Binary file
|
assets/js/admin.js
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
// Data Save
|
3 |
+
$( '#wcct-submit' ).on( 'click', function( e ) {
|
4 |
+
e.preventDefault();
|
5 |
+
|
6 |
+
$( '#wcct-submit' ).addClass( 'updating-message' );
|
7 |
+
|
8 |
+
wp.ajax.send( 'wcct_save_settings', {
|
9 |
+
data: $( '#integration-form' ).serialize(),
|
10 |
+
success: function( response ) {
|
11 |
+
|
12 |
+
$("#ajax-message")
|
13 |
+
.html('<p><strong>' + response.message + '</strong></p>')
|
14 |
+
.show()
|
15 |
+
.delay(3000)
|
16 |
+
.slideUp('fast');
|
17 |
+
|
18 |
+
$('html, body').animate({
|
19 |
+
scrollTop: 0
|
20 |
+
}, 'fast');
|
21 |
+
|
22 |
+
$( '#wcct-submit' ).removeClass( 'updating-message' );
|
23 |
+
},
|
24 |
+
error: function(error) {
|
25 |
+
alert('something wrong happend');
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
+
return false;
|
30 |
+
});
|
31 |
+
|
32 |
+
// Toggoling the settings
|
33 |
+
$( '.slider' ).on( 'click', function() {
|
34 |
+
var id = $( this ).attr( 'data-id' );
|
35 |
+
var target = $( '#setting-'+id );
|
36 |
+
target.stop().toggle('fast');
|
37 |
+
});
|
38 |
+
|
39 |
+
// Default Settings
|
40 |
+
$( '.toogle-seller:checked' ).each( function( index, value ) {
|
41 |
+
var id = $( value ).attr( 'data-id' );
|
42 |
+
var target = $( '#setting-'+id );
|
43 |
+
|
44 |
+
$( target ).css( 'display', 'block' );
|
45 |
+
} );
|
46 |
+
|
47 |
+
$('.event').on( 'change', function() {
|
48 |
+
var target = $( this ).next('.event-label-box');
|
49 |
+
target.addClass( 'event-label-space' );
|
50 |
+
target.stop().toggle();
|
51 |
+
|
52 |
+
} );
|
53 |
+
|
54 |
+
$( '.event:checked' ).each( function( index, value ) {
|
55 |
+
$( value ).next( '.event-label-box' ).addClass( 'event-label-space' );
|
56 |
+
$( value ).next( '.event-label-box' ).css( 'display', 'block' );
|
57 |
+
} );
|
58 |
+
|
59 |
+
// Pro-Feature Message
|
60 |
+
$( '.disabled-class' ).on( 'click', function() {
|
61 |
+
var title = $( this ).text();
|
62 |
+
swal({
|
63 |
+
title: title + ' is available in Pro version',
|
64 |
+
text: 'Please upgrade to the Pro version to get all the awesome feature',
|
65 |
+
buttons: {
|
66 |
+
confirm: 'Get the Pro Version',
|
67 |
+
cancel: 'Close',
|
68 |
+
},
|
69 |
+
}).then( function( is_confirm ){
|
70 |
+
if ( is_confirm ) {
|
71 |
+
window.open('https://wedevs.com/woocommerce-conversion-tracking/upgrade-to-pro/?utm_source=wp-admin&utm_medium=pro-upgrade&utm_campaign=wcct_upgrade&utm_content=Pro_Alert', '_blank');
|
72 |
+
}
|
73 |
+
}, function() {});
|
74 |
+
} );
|
75 |
+
|
76 |
+
// Change Tooltip Text
|
77 |
+
$( '.toogle-seller' ).on( 'change', function() {
|
78 |
+
var tooltipText = $( this ).parents( '.switch' ).find( '.integration-tooltip' );
|
79 |
+
var text = $( tooltipText ).text().trim();
|
80 |
+
var newText = '';
|
81 |
+
|
82 |
+
if ( text == 'Activate' ) {
|
83 |
+
newText = 'Deactivate'
|
84 |
+
} else if( text == 'Deactivate' ) {
|
85 |
+
newText = 'Activate';
|
86 |
+
}
|
87 |
+
|
88 |
+
$( tooltipText ).text( newText );
|
89 |
+
} );
|
90 |
+
|
91 |
+
})( jQuery );
|
assets/js/sweetalert.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.swal=e():t.swal=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o="swal-button";e.CLASS_NAMES={MODAL:"swal-modal",OVERLAY:"swal-overlay",SHOW_MODAL:"swal-overlay--show-modal",MODAL_TITLE:"swal-title",MODAL_TEXT:"swal-text",ICON:"swal-icon",ICON_CUSTOM:"swal-icon--custom",CONTENT:"swal-content",FOOTER:"swal-footer",BUTTON_CONTAINER:"swal-button-container",BUTTON:o,CONFIRM_BUTTON:o+"--confirm",CANCEL_BUTTON:o+"--cancel",DANGER_BUTTON:o+"--danger",BUTTON_LOADING:o+"--loading",BUTTON_LOADER:o+"__loader"},e.default=e.CLASS_NAMES},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNode=function(t){var e="."+t;return document.querySelector(e)},e.stringToNode=function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild},e.insertAfter=function(t,e){var n=e.nextSibling;e.parentNode.insertBefore(t,n)},e.removeNode=function(t){t.parentElement.removeChild(t)},e.throwErr=function(t){throw t=t.replace(/ +(?= )/g,""),"SweetAlert: "+(t=t.trim())},e.isPlainObject=function(t){if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},e.ordinalSuffixOf=function(t){var e=t%10,n=t%100;return 1===e&&11!==n?t+"st":2===e&&12!==n?t+"nd":3===e&&13!==n?t+"rd":t+"th"}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(25));var r=n(26);e.overlayMarkup=r.default,o(n(27)),o(n(28)),o(n(29));var i=n(0),a=i.default.MODAL_TITLE,s=i.default.MODAL_TEXT,c=i.default.ICON,l=i.default.FOOTER;e.iconMarkup='\n <div class="'+c+'"></div>',e.titleMarkup='\n <div class="'+a+'"></div>\n',e.textMarkup='\n <div class="'+s+'"></div>',e.footerMarkup='\n <div class="'+l+'"></div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.CONFIRM_KEY="confirm",e.CANCEL_KEY="cancel";var r={visible:!0,text:null,value:null,className:"",closeModal:!0},i=Object.assign({},r,{visible:!1,text:"Cancel",value:null}),a=Object.assign({},r,{text:"OK",value:!0});e.defaultButtonList={cancel:i,confirm:a};var s=function(t){switch(t){case e.CONFIRM_KEY:return a;case e.CANCEL_KEY:return i;default:var n=t.charAt(0).toUpperCase()+t.slice(1);return Object.assign({},r,{text:n,value:t})}},c=function(t,e){var n=s(t);return!0===e?Object.assign({},n,{visible:!0}):"string"==typeof e?Object.assign({},n,{visible:!0,text:e}):o.isPlainObject(e)?Object.assign({visible:!0},n,e):Object.assign({},n,{visible:!1})},l=function(t){for(var e={},n=0,o=Object.keys(t);n<o.length;n++){var r=o[n],a=t[r],s=c(r,a);e[r]=s}return e.cancel||(e.cancel=i),e},u=function(t){var n={};switch(t.length){case 1:n[e.CANCEL_KEY]=Object.assign({},i,{visible:!1});break;case 2:n[e.CANCEL_KEY]=c(e.CANCEL_KEY,t[0]),n[e.CONFIRM_KEY]=c(e.CONFIRM_KEY,t[1]);break;default:o.throwErr("Invalid number of 'buttons' in array ("+t.length+").\n If you want more than 2 buttons, you need to use an object!")}return n};e.getButtonListOpts=function(t){var n=e.defaultButtonList;return"string"==typeof t?n[e.CONFIRM_KEY]=c(e.CONFIRM_KEY,t):Array.isArray(t)?n=u(t):o.isPlainObject(t)?n=l(t):!0===t?n=u([!0,!0]):!1===t?n=u([!1,!1]):void 0===t&&(n=e.defaultButtonList),n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=n(0),a=i.default.MODAL,s=i.default.OVERLAY,c=n(30),l=n(31),u=n(32),f=n(33);e.injectElIntoModal=function(t){var e=o.getNode(a),n=o.stringToNode(t);return e.appendChild(n),n};var d=function(t){t.className=a,t.textContent=""},p=function(t,e){d(t);var n=e.className;n&&t.classList.add(n)};e.initModalContent=function(t){var e=o.getNode(a);p(e,t),c.default(t.icon),l.initTitle(t.title),l.initText(t.text),f.default(t.content),u.default(t.buttons,t.dangerMode)};var m=function(){var t=o.getNode(s),e=o.stringToNode(r.modalMarkup);t.appendChild(e)};e.default=m},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),r={isOpen:!1,promise:null,actions:{},timer:null},i=Object.assign({},r);e.resetState=function(){i=Object.assign({},r)},e.setActionValue=function(t){if("string"==typeof t)return a(o.CONFIRM_KEY,t);for(var e in t)a(e,t[e])};var a=function(t,e){i.actions[t]||(i.actions[t]={}),Object.assign(i.actions[t],{value:e})};e.setActionOptionsFor=function(t,e){var n=(void 0===e?{}:e).closeModal,o=void 0===n||n;Object.assign(i.actions[t],{closeModal:o})},e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(3),i=n(0),a=i.default.OVERLAY,s=i.default.SHOW_MODAL,c=i.default.BUTTON,l=i.default.BUTTON_LOADING,u=n(5);e.openModal=function(){o.getNode(a).classList.add(s),u.default.isOpen=!0};var f=function(){o.getNode(a).classList.remove(s),u.default.isOpen=!1};e.onAction=function(t){void 0===t&&(t=r.CANCEL_KEY);var e=u.default.actions[t],n=e.value;if(!1===e.closeModal){var i=c+"--"+t;o.getNode(i).classList.add(l)}else f();u.default.promise.resolve(n)},e.getState=function(){var t=Object.assign({},u.default);return delete t.promise,delete t.timer,t},e.stopLoading=function(){for(var t=document.querySelectorAll("."+c),e=0;e<t.length;e++){t[e].classList.remove(l)}}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){t.exports=e.sweetAlert=n(9)}).call(e,n(7))},function(t,e,n){(function(e){t.exports=e.swal=n(10)}).call(e,n(7))},function(t,e,n){"undefined"!=typeof window&&n(11),n(16);var o=n(23).default;t.exports=o},function(t,e,n){var o=n(12);"string"==typeof o&&(o=[[t.i,o,""]]);var r={insertAt:"top"};r.transform=void 0;n(14)(o,r);o.locals&&(t.exports=o.locals)},function(t,e,n){e=t.exports=n(13)(void 0),e.push([t.i,'.swal-icon--error{border-color:#f27474;-webkit-animation:animateErrorIcon .5s;animation:animateErrorIcon .5s}.swal-icon--error__x-mark{position:relative;display:block;-webkit-animation:animateXMark .5s;animation:animateXMark .5s}.swal-icon--error__line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal-icon--error__line--left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal-icon--error__line--right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}@-webkit-keyframes animateErrorIcon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}to{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@keyframes animateErrorIcon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}to{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@-webkit-keyframes animateXMark{0%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}to{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animateXMark{0%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}to{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.swal-icon--warning{border-color:#f8bb86;-webkit-animation:pulseWarning .75s infinite alternate;animation:pulseWarning .75s infinite alternate}.swal-icon--warning__body{width:5px;height:47px;top:10px;border-radius:2px;margin-left:-2px}.swal-icon--warning__body,.swal-icon--warning__dot{position:absolute;left:50%;background-color:#f8bb86}.swal-icon--warning__dot{width:7px;height:7px;border-radius:50%;margin-left:-4px;bottom:-11px}@-webkit-keyframes pulseWarning{0%{border-color:#f8d486}to{border-color:#f8bb86}}@keyframes pulseWarning{0%{border-color:#f8d486}to{border-color:#f8bb86}}.swal-icon--success{border-color:#a5dc86}.swal-icon--success:after,.swal-icon--success:before{content:"";border-radius:50%;position:absolute;width:60px;height:120px;background:#fff;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal-icon--success:before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.swal-icon--success:after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px;-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}.swal-icon--success__ring{width:80px;height:80px;border:4px solid hsla(98,55%,69%,.2);border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal-icon--success__hide-corners{width:5px;height:90px;background-color:#fff;padding:1px;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal-icon--success__line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal-icon--success__line--tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:animateSuccessTip .75s;animation:animateSuccessTip .75s}.swal-icon--success__line--long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-animation:animateSuccessLong .75s;animation:animateSuccessLong .75s}@-webkit-keyframes rotatePlaceholder{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}to{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}to{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@-webkit-keyframes animateSuccessTip{0%{width:0;left:1px;top:19px}54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}to{width:25px;left:14px;top:45px}}@keyframes animateSuccessTip{0%{width:0;left:1px;top:19px}54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}to{width:25px;left:14px;top:45px}}@-webkit-keyframes animateSuccessLong{0%{width:0;right:46px;top:54px}65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}to{width:47px;right:8px;top:38px}}@keyframes animateSuccessLong{0%{width:0;right:46px;top:54px}65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}to{width:47px;right:8px;top:38px}}.swal-icon--info{border-color:#c9dae1}.swal-icon--info:before{width:5px;height:29px;bottom:17px;border-radius:2px;margin-left:-2px}.swal-icon--info:after,.swal-icon--info:before{content:"";position:absolute;left:50%;background-color:#c9dae1}.swal-icon--info:after{width:7px;height:7px;border-radius:50%;margin-left:-3px;top:19px}.swal-icon{width:80px;height:80px;border-width:4px;border-style:solid;border-radius:50%;padding:0;position:relative;box-sizing:content-box;margin:20px auto}.swal-icon:first-child{margin-top:32px}.swal-icon--custom{width:auto;height:auto;max-width:100%;border:none;border-radius:0}.swal-icon img{max-width:100%;max-height:100%}.swal-title{color:rgba(0,0,0,.65);font-weight:600;text-transform:none;position:relative;display:block;padding:13px 16px;font-size:27px;line-height:normal;text-align:center;margin-bottom:0}.swal-title:first-child{margin-top:26px}.swal-title:not(:first-child){padding-bottom:0}.swal-title:not(:last-child){margin-bottom:13px}.swal-text{font-size:16px;position:relative;float:none;line-height:normal;vertical-align:top;text-align:left;display:inline-block;margin:0;padding:0 10px;font-weight:400;color:rgba(0,0,0,.64);max-width:calc(100% - 20px);overflow-wrap:break-word;box-sizing:border-box}.swal-text:first-child{margin-top:45px}.swal-text:last-child{margin-bottom:45px}.swal-footer{text-align:right;padding-top:13px;margin-top:13px;padding:13px 16px;border-radius:inherit;border-top-left-radius:0;border-top-right-radius:0}.swal-button-container{margin:5px;display:inline-block;position:relative}.swal-button{background-color:#7cd1f9;color:#fff;border:none;box-shadow:none;border-radius:5px;font-weight:600;font-size:14px;padding:10px 24px;margin:0;cursor:pointer}.swal-button[not:disabled]:hover{background-color:#78cbf2}.swal-button:active{background-color:#70bce0}.swal-button:focus{outline:none;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(43,114,165,.29)}.swal-button[disabled]{opacity:.5;cursor:default}.swal-button::-moz-focus-inner{border:0}.swal-button--cancel{color:#555;background-color:#efefef}.swal-button--cancel[not:disabled]:hover{background-color:#e8e8e8}.swal-button--cancel:active{background-color:#d7d7d7}.swal-button--cancel:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(116,136,150,.29)}.swal-button--danger{background-color:#e64942}.swal-button--danger[not:disabled]:hover{background-color:#df4740}.swal-button--danger:active{background-color:#cf423b}.swal-button--danger:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(165,43,43,.29)}.swal-content{padding:0 20px;margin-top:20px;font-size:medium}.swal-content:last-child{margin-bottom:20px}.swal-content__input,.swal-content__textarea{-webkit-appearance:none;background-color:#fff;border:none;font-size:14px;display:block;box-sizing:border-box;width:100%;border:1px solid rgba(0,0,0,.14);padding:10px 13px;border-radius:2px;transition:border-color .2s}.swal-content__input:focus,.swal-content__textarea:focus{outline:none;border-color:#6db8ff}.swal-content__textarea{resize:vertical}.swal-button--loading{color:transparent}.swal-button--loading~.swal-button__loader{opacity:1}.swal-button__loader{position:absolute;height:auto;width:43px;z-index:2;left:50%;top:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);text-align:center;pointer-events:none;opacity:0}.swal-button__loader div{display:inline-block;float:none;vertical-align:baseline;width:9px;height:9px;padding:0;border:none;margin:2px;opacity:.4;border-radius:7px;background-color:hsla(0,0%,100%,.9);transition:background .2s;-webkit-animation:swal-loading-anim 1s infinite;animation:swal-loading-anim 1s infinite}.swal-button__loader div:nth-child(3n+2){-webkit-animation-delay:.15s;animation-delay:.15s}.swal-button__loader div:nth-child(3n+3){-webkit-animation-delay:.3s;animation-delay:.3s}@-webkit-keyframes swal-loading-anim{0%{opacity:.4}20%{opacity:.4}50%{opacity:1}to{opacity:.4}}@keyframes swal-loading-anim{0%{opacity:.4}20%{opacity:.4}50%{opacity:1}to{opacity:.4}}.swal-overlay{position:fixed;top:0;bottom:0;left:0;right:0;text-align:center;font-size:0;overflow-y:auto;background-color:rgba(0,0,0,.4);z-index:10000;pointer-events:none;opacity:0;transition:opacity .3s}.swal-overlay:before{content:" ";display:inline-block;vertical-align:middle;height:100%}.swal-overlay--show-modal{opacity:1;pointer-events:auto}.swal-overlay--show-modal .swal-modal{opacity:1;pointer-events:auto;box-sizing:border-box;-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s;will-change:transform}.swal-modal{width:478px;opacity:0;pointer-events:none;background-color:#fff;text-align:center;border-radius:5px;position:static;margin:20px auto;display:inline-block;vertical-align:middle;-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 50%;transform-origin:50% 50%;z-index:10001;transition:opacity .2s,-webkit-transform .3s;transition:transform .3s,opacity .2s;transition:transform .3s,opacity .2s,-webkit-transform .3s}@media (max-width:500px){.swal-modal{width:calc(100% - 20px)}}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1)}1%{-webkit-transform:scale(.5);transform:scale(.5)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1)}1%{-webkit-transform:scale(.5);transform:scale(.5)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}to{-webkit-transform:scale(1);transform:scale(1)}}',""])},function(t,e){function n(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=o(r);return[n].concat(r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"})).concat([i]).join("\n")}return[n].join("\n")}function o(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var o=n(e,t);return e[2]?"@media "+e[2]+"{"+o+"}":o}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){function o(t,e){for(var n=0;n<t.length;n++){var o=t[n],r=m[o.id];if(r){r.refs++;for(var i=0;i<r.parts.length;i++)r.parts[i](o.parts[i]);for(;i<o.parts.length;i++)r.parts.push(u(o.parts[i],e))}else{for(var a=[],i=0;i<o.parts.length;i++)a.push(u(o.parts[i],e));m[o.id]={id:o.id,refs:1,parts:a}}}}function r(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],a=e.base?i[0]+e.base:i[0],s=i[1],c=i[2],l=i[3],u={css:s,media:c,sourceMap:l};o[a]?o[a].parts.push(u):n.push(o[a]={id:a,parts:[u]})}return n}function i(t,e){var n=v(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=w[w.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),w.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function a(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=w.indexOf(t);e>=0&&w.splice(e,1)}function s(t){var e=document.createElement("style");return t.attrs.type="text/css",l(e,t.attrs),i(t,e),e}function c(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",l(e,t.attrs),i(t,e),e}function l(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function u(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var l=h++;n=g||(g=s(e)),o=f.bind(null,n,l,!1),r=f.bind(null,n,l,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=c(e),o=p.bind(null,n,e),r=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),o=d.bind(null,n),r=function(){a(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}function f(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=x(e,r);else{var i=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function d(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function p(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=y(o)),r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var m={},b=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),v=function(t){var e={};return function(n){return void 0===e[n]&&(e[n]=t.call(this,n)),e[n]}}(function(t){return document.querySelector(t)}),g=null,h=0,w=[],y=n(15);t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");e=e||{},e.attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||(e.singleton=b()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=r(t,e);return o(n,e),function(t){for(var i=[],a=0;a<n.length;a++){var s=n[a],c=m[s.id];c.refs--,i.push(c)}if(t){o(r(t,e),e)}for(var a=0;a<i.length;a++){var c=i[a];if(0===c.refs){for(var l=0;l<c.parts.length;l++)c.parts[l]();delete m[c.id]}}}};var x=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(r))return t;var i;return i=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")"})}},function(t,e,n){var o=n(17);"undefined"==typeof window||window.Promise||(window.Promise=o),n(21),String.prototype.includes||(String.prototype.includes=function(t,e){"use strict";return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return!1;for(var r=0|e,i=Math.max(r>=0?r:o-Math.abs(r),0);i<o;){if(function(t,e){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)}(n[i],t))return!0;i++}return!1}}),"undefined"!=typeof window&&function(t){t.forEach(function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})})}([Element.prototype,CharacterData.prototype,DocumentType.prototype])},function(t,e,n){(function(e){!function(n){function o(){}function r(t,e){return function(){t.apply(e,arguments)}}function i(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(t,this)}function a(t,e){for(;3===t._state;)t=t._value;if(0===t._state)return void t._deferreds.push(e);t._handled=!0,i._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?s:c)(e.promise,t._value);var o;try{o=n(t._value)}catch(t){return void c(e.promise,t)}s(e.promise,o)})}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void l(t);if("function"==typeof n)return void f(r(n,e),t)}t._state=1,t._value=e,l(t)}catch(e){c(t,e)}}function c(t,e){t._state=2,t._value=e,l(t)}function l(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function u(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function f(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,c(e,t))})}catch(t){if(n)return;n=!0,c(e,t)}}var d=setTimeout;i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var n=new this.constructor(o);return a(this,new u(t,e,n)),n},i.all=function(t){var e=Array.prototype.slice.call(t);return new i(function(t,n){function o(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){o(i,t)},n)}e[i]=a,0==--r&&t(e)}catch(t){n(t)}}if(0===e.length)return t([]);for(var r=e.length,i=0;i<e.length;i++)o(i,e[i])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){for(var o=0,r=t.length;o<r;o++)t[o].then(e,n)})},i._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){d(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},i._setImmediateFn=function(t){i._immediateFn=t},i._setUnhandledRejectionFn=function(t){i._unhandledRejectionFn=t},void 0!==t&&t.exports?t.exports=i:n.Promise||(n.Promise=i)}(this)}).call(e,n(18).setImmediate)},function(t,e,n){function o(t,e){this._id=t,this._clearFn=e}var r=Function.prototype.apply;e.setTimeout=function(){return new o(r.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(19),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function o(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var o={callback:t,args:e};return l[c]=o,s(c),c++}function r(t){delete l[t]}function i(t){var e=t.callback,o=t.args;switch(o.length){case 0:e();break;case 1:e(o[0]);break;case 2:e(o[0],o[1]);break;case 3:e(o[0],o[1],o[2]);break;default:e.apply(n,o)}}function a(t){if(u)setTimeout(a,0,t);else{var e=l[t];if(e){u=!0;try{i(e)}finally{r(t),u=!1}}}}if(!t.setImmediate){var s,c=1,l={},u=!1,f=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?function(){s=function(t){e.nextTick(function(){a(t)})}}():function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&a(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),s=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){a(t.data)},s=function(e){t.port2.postMessage(e)}}():f&&"onreadystatechange"in f.createElement("script")?function(){var t=f.documentElement;s=function(e){var n=f.createElement("script");n.onreadystatechange=function(){a(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():function(){s=function(t){setTimeout(a,0,t)}}(),d.setImmediate=o,d.clearImmediate=r}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,n(7),n(20))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function r(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function i(t){if(f===clearTimeout)return clearTimeout(t);if((f===o||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function a(){b&&p&&(b=!1,p.length?m=p.concat(m):v=-1,m.length&&s())}function s(){if(!b){var t=r(a);b=!0;for(var e=m.length;e;){for(p=m,m=[];++v<e;)p&&p[v].run();v=-1,e=m.length}p=null,b=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var u,f,d=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{f="function"==typeof clearTimeout?clearTimeout:o}catch(t){f=o}}();var p,m=[],b=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];m.push(new c(t,e)),1!==m.length||b||r(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.prependListener=l,d.prependOnceListener=l,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){"use strict";n(22).polyfill()},function(t,e,n){"use strict";function o(t,e){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var n=Object(t),o=1;o<arguments.length;o++){var r=arguments[o];if(void 0!==r&&null!==r)for(var i=Object.keys(Object(r)),a=0,s=i.length;a<s;a++){var c=i[a],l=Object.getOwnPropertyDescriptor(r,c);void 0!==l&&l.enumerable&&(n[c]=r[c])}}return n}function r(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:o})}t.exports={assign:o,polyfill:r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(24),r=n(6),i=n(5),a=n(36),s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if("undefined"!=typeof window){var n=a.getOpts.apply(void 0,t);return new Promise(function(t,e){i.default.promise={resolve:t,reject:e},o.default(n),setTimeout(function(){r.openModal()})})}};s.close=r.onAction,s.getState=r.getState,s.setActionValue=i.setActionValue,s.stopLoading=r.stopLoading,s.setDefaults=a.setDefaults,e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(0),i=r.default.MODAL,a=n(4),s=n(34),c=n(35),l=n(1);e.init=function(t){o.getNode(i)||(document.body||l.throwErr("You can only use SweetAlert AFTER the DOM has loaded!"),s.default(),a.default()),a.initModalContent(t),c.default(t)},e.default=e.init},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.MODAL;e.modalMarkup='\n <div class="'+r+'" role="dialog" aria-modal="true"></div>',e.default=e.modalMarkup},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.OVERLAY,i='<div \n class="'+r+'"\n tabIndex="-1">\n </div>';e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.ICON;e.errorIconMarkup=function(){var t=r+"--error",e=t+"__line";return'\n <div class="'+t+'__x-mark">\n <span class="'+e+" "+e+'--left"></span>\n <span class="'+e+" "+e+'--right"></span>\n </div>\n '},e.warningIconMarkup=function(){var t=r+"--warning";return'\n <span class="'+t+'__body">\n <span class="'+t+'__dot"></span>\n </span>\n '},e.successIconMarkup=function(){var t=r+"--success";return'\n <span class="'+t+"__line "+t+'__line--long"></span>\n <span class="'+t+"__line "+t+'__line--tip"></span>\n\n <div class="'+t+'__ring"></div>\n <div class="'+t+'__hide-corners"></div>\n '}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.CONTENT;e.contentMarkup='\n <div class="'+r+'">\n\n </div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.BUTTON_CONTAINER,i=o.default.BUTTON,a=o.default.BUTTON_LOADER;e.buttonMarkup='\n <div class="'+r+'">\n\n <button\n class="'+i+'"\n ></button>\n\n <div class="'+a+'">\n <div></div>\n <div></div>\n <div></div>\n </div>\n\n </div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=n(2),i=n(0),a=i.default.ICON,s=i.default.ICON_CUSTOM,c=["error","warning","success","info"],l={error:r.errorIconMarkup(),warning:r.warningIconMarkup(),success:r.successIconMarkup()},u=function(t,e){var n=a+"--"+t;e.classList.add(n);var o=l[t];o&&(e.innerHTML=o)},f=function(t,e){e.classList.add(s);var n=document.createElement("img");n.src=t,e.appendChild(n)},d=function(t){if(t){var e=o.injectElIntoModal(r.iconMarkup);c.includes(t)?u(t,e):f(t,e)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=n(4),i=function(t){navigator.userAgent.includes("AppleWebKit")&&(t.style.display="none",t.offsetHeight,t.style.display="")};e.initTitle=function(t){if(t){var e=r.injectElIntoModal(o.titleMarkup);e.textContent=t,i(e)}},e.initText=function(t){if(t){var e=document.createDocumentFragment();t.split("\n").forEach(function(t,n,o){e.appendChild(document.createTextNode(t)),n<o.length-1&&e.appendChild(document.createElement("br"))});var n=r.injectElIntoModal(o.textMarkup);n.appendChild(e),i(n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(4),i=n(0),a=i.default.BUTTON,s=i.default.DANGER_BUTTON,c=n(3),l=n(2),u=n(6),f=n(5),d=function(t,e,n){var r=e.text,i=e.value,d=e.className,p=e.closeModal,m=o.stringToNode(l.buttonMarkup),b=m.querySelector("."+a),v=a+"--"+t;if(b.classList.add(v),d){(Array.isArray(d)?d:d.split(" ")).filter(function(t){return t.length>0}).forEach(function(t){b.classList.add(t)})}n&&t===c.CONFIRM_KEY&&b.classList.add(s),b.textContent=r;var g={};return g[t]=i,f.setActionValue(g),f.setActionOptionsFor(t,{closeModal:p}),b.addEventListener("click",function(){return u.onAction(t)}),m},p=function(t,e){var n=r.injectElIntoModal(l.footerMarkup);for(var o in t){var i=t[o],a=d(o,i,e);i.visible&&n.appendChild(a)}0===n.children.length&&n.remove()};e.default=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),r=n(4),i=n(2),a=n(5),s=n(6),c=n(0),l=c.default.CONTENT,u=function(t){t.addEventListener("input",function(t){var e=t.target,n=e.value;a.setActionValue(n)}),t.addEventListener("keyup",function(t){if("Enter"===t.key)return s.onAction(o.CONFIRM_KEY)}),setTimeout(function(){t.focus(),a.setActionValue("")},0)},f=function(t,e,n){var o=document.createElement(e),r=l+"__"+e;o.classList.add(r);for(var i in n){var a=n[i];o[i]=a}"input"===e&&u(o),t.appendChild(o)},d=function(t){if(t){var e=r.injectElIntoModal(i.contentMarkup),n=t.element,o=t.attributes;"string"==typeof n?f(e,n,o):e.appendChild(n)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=function(){var t=o.stringToNode(r.overlayMarkup);document.body.appendChild(t)};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=n(6),i=n(1),a=n(3),s=n(0),c=s.default.MODAL,l=s.default.BUTTON,u=s.default.OVERLAY,f=function(t){t.preventDefault(),v()},d=function(t){t.preventDefault(),g()},p=function(t){if(o.default.isOpen)switch(t.key){case"Escape":return r.onAction(a.CANCEL_KEY)}},m=function(t){if(o.default.isOpen)switch(t.key){case"Tab":return f(t)}},b=function(t){if(o.default.isOpen)return"Tab"===t.key&&t.shiftKey?d(t):void 0},v=function(){var t=i.getNode(l);t&&(t.tabIndex=0,t.focus())},g=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l),n=e.length-1,o=e[n];o&&o.focus()},h=function(t){t[t.length-1].addEventListener("keydown",m)},w=function(t){t[0].addEventListener("keydown",b)},y=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l);e.length&&(h(e),w(e))},x=function(t){if(i.getNode(u)===t.target)return r.onAction(a.CANCEL_KEY)},_=function(t){var e=i.getNode(u);e.removeEventListener("click",x),t&&e.addEventListener("click",x)},k=function(t){o.default.timer&&clearTimeout(o.default.timer),t&&(o.default.timer=window.setTimeout(function(){return r.onAction(a.CANCEL_KEY)},t))},O=function(t){t.closeOnEsc?document.addEventListener("keyup",p):document.removeEventListener("keyup",p),t.dangerMode?v():g(),y(),_(t.closeOnClickOutside),k(t.timer)};e.default=O},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(3),i=n(37),a=n(38),s={title:null,text:null,icon:null,buttons:r.defaultButtonList,content:null,className:null,closeOnClickOutside:!0,closeOnEsc:!0,dangerMode:!1,timer:null},c=Object.assign({},s);e.setDefaults=function(t){c=Object.assign({},s,t)};var l=function(t){var e=t&&t.button,n=t&&t.buttons;return void 0!==e&&void 0!==n&&o.throwErr("Cannot set both 'button' and 'buttons' options!"),void 0!==e?{confirm:e}:n},u=function(t){return o.ordinalSuffixOf(t+1)},f=function(t,e){o.throwErr(u(e)+" argument ('"+t+"') is invalid")},d=function(t,e){var n=t+1,r=e[n];o.isPlainObject(r)||void 0===r||o.throwErr("Expected "+u(n)+" argument ('"+r+"') to be a plain object")},p=function(t,e){var n=t+1,r=e[n];void 0!==r&&o.throwErr("Unexpected "+u(n)+" argument ("+r+")")},m=function(t,e,n,r){var i=typeof e,a="string"===i,s=e instanceof Element;if(a){if(0===n)return{text:e};if(1===n)return{text:e,title:r[0]};if(2===n)return d(n,r),{icon:e};f(e,n)}else{if(s&&0===n)return d(n,r),{content:e};if(o.isPlainObject(e))return p(n,r),e;f(e,n)}};e.getOpts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n={};t.forEach(function(e,o){var r=m(0,e,o,t);Object.assign(n,r)});var o=l(n);n.buttons=r.getButtonListOpts(o),delete n.button,n.content=i.getContentOpts(n.content);var u=Object.assign({},s,c,n);return Object.keys(u).forEach(function(t){a.DEPRECATED_OPTS[t]&&a.logDeprecation(t)}),u}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r={element:"input",attributes:{placeholder:""}};e.getContentOpts=function(t){var e={};return o.isPlainObject(t)?Object.assign(e,t):t instanceof Element?{element:t}:"input"===t?r:null}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.logDeprecation=function(t){var n=e.DEPRECATED_OPTS[t],o=n.onlyRename,r=n.replacement,i=n.subOption,a=n.link,s=o?"renamed":"deprecated",c='SweetAlert warning: "'+t+'" option has been '+s+".";if(r){c+=" Please use"+(i?' "'+i+'" in ':" ")+'"'+r+'" instead.'}var l="https://sweetalert.js.org";c+=a?" More details: "+l+a:" More details: "+l+"/guides/#upgrading-from-1x",console.warn(c)},e.DEPRECATED_OPTS={type:{replacement:"icon",link:"/docs/#icon"},imageUrl:{replacement:"icon",link:"/docs/#icon"},customClass:{replacement:"className",onlyRename:!0,link:"/docs/#classname"},imageSize:{},showCancelButton:{replacement:"buttons",link:"/docs/#buttons"},showConfirmButton:{replacement:"button",link:"/docs/#button"},confirmButtonText:{replacement:"button",link:"/docs/#button"},confirmButtonColor:{},cancelButtonText:{replacement:"buttons",link:"/docs/#buttons"},closeOnConfirm:{replacement:"button",subOption:"closeModal",link:"/docs/#button"},closeOnCancel:{replacement:"buttons",subOption:"closeModal",link:"/docs/#buttons"},showLoaderOnConfirm:{replacement:"buttons"},animation:{},inputType:{replacement:"content",link:"/docs/#content"},inputValue:{replacement:"content",link:"/docs/#content"},inputPlaceholder:{replacement:"content",link:"/docs/#content"},html:{replacement:"content",link:"/docs/#content"},allowEscapeKey:{replacement:"closeOnEsc",onlyRename:!0,link:"/docs/#closeonesc"},allowClickOutside:{replacement:"closeOnClickOutside",onlyRename:!0,link:"/docs/#closeonclickoutside"}}}])});
|
conversion-tracking.php
ADDED
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WooCommerce Conversion Tracking
|
4 |
+
Plugin URI: https://wedevs.com/products/plugins/woocommerce-conversion-tracking/
|
5 |
+
Description: Adds various conversion tracking codes to cart, checkout, registration success and product page on WooCommerce
|
6 |
+
Version: 2.0
|
7 |
+
Author: Tareq Hasan
|
8 |
+
Author URI: https://tareq.co/
|
9 |
+
License: GPL2
|
10 |
+
WC requires at least: 2.3
|
11 |
+
WC tested up to: 3.2.6
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Copyright (c) 2017 Tareq Hasan (email: tareq@wedevs.com). All rights reserved.
|
16 |
+
*
|
17 |
+
* Released under the GPL license
|
18 |
+
* http://www.opensource.org/licenses/gpl-license.php
|
19 |
+
*
|
20 |
+
* This is an add-on for WordPress
|
21 |
+
* http://wordpress.org/
|
22 |
+
*
|
23 |
+
* **********************************************************************
|
24 |
+
* This program is free software; you can redistribute it and/or modify
|
25 |
+
* it under the terms of the GNU General Public License as published by
|
26 |
+
* the Free Software Foundation; either version 2 of the License, or
|
27 |
+
* (at your option) any later version.
|
28 |
+
*
|
29 |
+
* This program is distributed in the hope that it will be useful,
|
30 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
+
* GNU General Public License for more details.
|
33 |
+
*
|
34 |
+
* You should have received a copy of the GNU General Public License
|
35 |
+
* along with this program; if not, write to the Free Software
|
36 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
37 |
+
* **********************************************************************
|
38 |
+
*/
|
39 |
+
|
40 |
+
// don't call the file directly
|
41 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
42 |
+
exit;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* WeDevs_WC_Facebook_Tracking_Pixel class
|
47 |
+
*
|
48 |
+
* @class WeDevs_WC_Facebook_Tracking_Pixel The class that holds the entire WeDevs_WC_Facebook_Tracking_Pixel plugin
|
49 |
+
*/
|
50 |
+
class WeDevs_WC_Conversion_Tracking {
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Plugin version
|
54 |
+
*
|
55 |
+
* @var string
|
56 |
+
*/
|
57 |
+
public $version = '2.0';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Holds various class instances
|
61 |
+
*
|
62 |
+
* @var array
|
63 |
+
*/
|
64 |
+
private $container = array();
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Constructor for the WeDevs_WC_Conversion_Tracking class
|
68 |
+
*
|
69 |
+
* Sets up all the appropriate hooks and actions
|
70 |
+
* within our plugin.
|
71 |
+
*/
|
72 |
+
public function __construct() {
|
73 |
+
$this->define_constants();
|
74 |
+
$this->init_hooks();
|
75 |
+
$this->includes();
|
76 |
+
$this->init_classes();
|
77 |
+
|
78 |
+
register_activation_hook( __FILE__, array( $this, 'activate' ) );
|
79 |
+
|
80 |
+
do_action( 'wcct_loaded' );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Magic getter to bypass referencing plugin.
|
85 |
+
*
|
86 |
+
* @param $prop
|
87 |
+
*
|
88 |
+
* @return mixed
|
89 |
+
*/
|
90 |
+
public function __get( $prop ) {
|
91 |
+
if ( array_key_exists( $prop, $this->container ) ) {
|
92 |
+
return $this->container[ $prop ];
|
93 |
+
}
|
94 |
+
|
95 |
+
return $this->{$prop};
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Magic isset to bypass referencing plugin.
|
100 |
+
*
|
101 |
+
* @param $prop
|
102 |
+
*
|
103 |
+
* @return mixed
|
104 |
+
*/
|
105 |
+
public function __isset( $prop ) {
|
106 |
+
return isset( $this->{$prop} ) || isset( $this->container[ $prop ] );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Initializes the WeDevs_WC_Conversion_Tracking() class
|
111 |
+
*
|
112 |
+
* Checks for an existing WeDevs_WC_Conversion_Tracking() instance
|
113 |
+
* and if it doesn't find one, creates it.
|
114 |
+
*/
|
115 |
+
public static function init() {
|
116 |
+
static $instance = false;
|
117 |
+
|
118 |
+
if ( ! $instance ) {
|
119 |
+
$instance = new WeDevs_WC_Conversion_Tracking();
|
120 |
+
}
|
121 |
+
|
122 |
+
return $instance;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Include required files
|
127 |
+
*
|
128 |
+
* @return void
|
129 |
+
*/
|
130 |
+
public function includes() {
|
131 |
+
require_once WCCT_INCLUDES . '/class-abstract-integration.php';
|
132 |
+
require_once WCCT_INCLUDES . '/class-integration-manager.php';
|
133 |
+
require_once WCCT_INCLUDES . '/class-event-dispatcher.php';
|
134 |
+
require_once WCCT_INCLUDES . '/class-integration-pro-features.php';
|
135 |
+
require_once WCCT_INCLUDES . '/class-ajax.php';
|
136 |
+
require_once WCCT_INCLUDES . '/class-admin.php';
|
137 |
+
require_once WCCT_INCLUDES . '/class-welcome-20.php';
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Define the constants
|
142 |
+
*
|
143 |
+
* @since 1.2.5
|
144 |
+
*
|
145 |
+
* @return void
|
146 |
+
*/
|
147 |
+
public function define_constants() {
|
148 |
+
define( 'WCCT_VERSION', $this->version );
|
149 |
+
define( 'WCCT_FILE', __FILE__ );
|
150 |
+
define( 'WCCT_PATH', dirname( WCCT_FILE ) );
|
151 |
+
define( 'WCCT_INCLUDES', WCCT_PATH . '/includes' );
|
152 |
+
define( 'WCCT_URL', plugins_url( '', WCCT_FILE ) );
|
153 |
+
define( 'WCCT_ASSETS', WCCT_URL . '/assets' );
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Plugin activation routeis
|
158 |
+
*
|
159 |
+
* @since 1.2.5
|
160 |
+
*
|
161 |
+
* @return void
|
162 |
+
*/
|
163 |
+
public function activate() {
|
164 |
+
$installed = get_option( 'wcct_installed' );
|
165 |
+
|
166 |
+
if ( ! $installed ) {
|
167 |
+
update_option( 'wcct_installed', time() );
|
168 |
+
}
|
169 |
+
|
170 |
+
update_option( 'wcct_version', WCCT_VERSION );
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Initialize the hooks
|
175 |
+
*
|
176 |
+
* @return void
|
177 |
+
*/
|
178 |
+
public function init_hooks() {
|
179 |
+
|
180 |
+
add_action( 'plugins_loaded', array( $this, 'plugin_upgrades' ) );
|
181 |
+
add_action( 'init', array( $this, 'localization_setup' ) );
|
182 |
+
add_action( 'init', array( $this, 'init_tracker' ) );
|
183 |
+
|
184 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Instantiate the required classes
|
189 |
+
*
|
190 |
+
* @return void
|
191 |
+
*/
|
192 |
+
public function init_classes() {
|
193 |
+
$this->container['ajax'] = new WCCT_Ajax();
|
194 |
+
$this->container['event_dispatcher'] = new WCCT_Event_Dispatcher();
|
195 |
+
$this->container['admin'] = new WCCT_Admin();
|
196 |
+
$this->container['manager'] = new WCCT_Integration_Manager();
|
197 |
+
|
198 |
+
new WCCT_Welcome_20();
|
199 |
+
|
200 |
+
if ( ! class_exists( 'WeDevs_WC_Conversion_Tracking_Pro') ) {
|
201 |
+
$this->container['pro_feature'] = new WCCT_Pro_Features();
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Initialize plugin for localization
|
207 |
+
*
|
208 |
+
* @uses load_plugin_textdomain()
|
209 |
+
*/
|
210 |
+
public function localization_setup() {
|
211 |
+
load_plugin_textdomain( 'woocommerce-conversion-tracking', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Do plugin upgrade
|
216 |
+
*
|
217 |
+
* @since 2.0
|
218 |
+
* @return void
|
219 |
+
*/
|
220 |
+
public function plugin_upgrades() {
|
221 |
+
if ( ! is_admin() && ! current_user_can( 'manage_options' ) ) {
|
222 |
+
return;
|
223 |
+
}
|
224 |
+
|
225 |
+
require_once WCCT_INCLUDES . '/class-upgrades.php';
|
226 |
+
|
227 |
+
$upgrader = new WCCT_Upgrades();
|
228 |
+
|
229 |
+
if ( $upgrader->needs_update() ) {
|
230 |
+
$upgrader->perform_updates();
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Initialize the weDevs insights tracker
|
236 |
+
*
|
237 |
+
* @since 1.2.3
|
238 |
+
*
|
239 |
+
* @return void
|
240 |
+
*/
|
241 |
+
public function init_tracker() {
|
242 |
+
require_once dirname( __FILE__ ) . '/includes/class-wedevs-insights.php';
|
243 |
+
|
244 |
+
new WeDevs_Insights( 'woocommerce-conversion-tracking', 'WooCommerce Conversion Tracking', __FILE__ );
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Check the pro version
|
249 |
+
*
|
250 |
+
* @return boolean
|
251 |
+
*/
|
252 |
+
public function is_pro() {
|
253 |
+
if ( class_exists( 'WeDevs_WC_Conversion_Tracking_Pro' ) ) {
|
254 |
+
return true;
|
255 |
+
}
|
256 |
+
return false;
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Plugin action links
|
261 |
+
*
|
262 |
+
* @param array $links
|
263 |
+
*
|
264 |
+
* @return array
|
265 |
+
*/
|
266 |
+
function plugin_action_links( $links ) {
|
267 |
+
if ( ! $this->is_pro() ) {
|
268 |
+
$links[] = '<a href="https://wedevs.com/woocommerce-conversion-tracking/upgrade-to-pro/?utm_source=wp-admin&utm_medium=pro-upgrade&utm_campaign=wcct_upgrade&utm_content=Get_Premium" target="_blank" style="color: #389e38;font-weight: bold;">' . __( 'Get PRO', 'woocommerce-conversion-tracking' ) . '</a>';
|
269 |
+
}
|
270 |
+
|
271 |
+
$links[] = '<a href="https://wedevs.com/docs/woocommerce-conversion-tracking/get-started/?utm_source=wp-admin&utm_medium=action-link&utm_campaign=wcct_docs&utm_content=Docs" target="_blank">' . __( 'Docs', 'woocommerce-conversion-tracking' ) . '</a>';
|
272 |
+
$links[] = '<a href="' . admin_url( 'admin.php?page=conversion-tracking' ) . '">' . __( 'Settings', 'woocommerce-conversion-tracking' ) . '</a>';
|
273 |
+
|
274 |
+
return $links;
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
function wcct_init() {
|
279 |
+
return WeDevs_WC_Conversion_Tracking::init();
|
280 |
+
}
|
281 |
+
|
282 |
+
// WeDevs_WC_Conversion_Tracking
|
283 |
+
wcct_init();
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Manage Capability
|
287 |
+
*
|
288 |
+
* @return void
|
289 |
+
*/
|
290 |
+
function wcct_manage_cap() {
|
291 |
+
return apply_filters( 'wcct_capability', 'manage_options' );
|
292 |
+
}
|
includes/class-abstract-integration.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract Class
|
5 |
+
*/
|
6 |
+
abstract class WCCT_Integration {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Store integration's id
|
10 |
+
*
|
11 |
+
* @var [type]
|
12 |
+
*/
|
13 |
+
protected $id;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Store integration's name
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
protected $name;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Check enable
|
24 |
+
*
|
25 |
+
* @var boolean
|
26 |
+
*/
|
27 |
+
protected $enabled;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Store integration's settings
|
31 |
+
*
|
32 |
+
* @var array
|
33 |
+
*/
|
34 |
+
protected $settings = array();
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Store all supported features
|
38 |
+
*
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
protected $supports = array();
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Get settings for all integration
|
45 |
+
*
|
46 |
+
* @return array
|
47 |
+
*/
|
48 |
+
abstract public function get_settings();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Enqueue integration script
|
52 |
+
*
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
abstract public function enqueue_script();
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get the integration id
|
59 |
+
*
|
60 |
+
* @return [type] [description]
|
61 |
+
*/
|
62 |
+
public function get_id() {
|
63 |
+
return $this->id;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Get the integration name
|
68 |
+
*
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
public function get_name() {
|
72 |
+
return $this->name;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Check the integration enable or not
|
77 |
+
*
|
78 |
+
* @return boolean
|
79 |
+
*/
|
80 |
+
public function is_enabled() {
|
81 |
+
$settings = $this->get_integration_settings();
|
82 |
+
|
83 |
+
if ( $settings && $settings[ 'enabled' ] == true ) {
|
84 |
+
return true;
|
85 |
+
}
|
86 |
+
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Check if an event is enabled
|
92 |
+
*
|
93 |
+
* @param string $event
|
94 |
+
*
|
95 |
+
* @return boolean
|
96 |
+
*/
|
97 |
+
public function event_enabled( $event ) {
|
98 |
+
$settings = $this->get_integration_settings();
|
99 |
+
|
100 |
+
if ( isset( $settings[0]['events'] ) && array_key_exists( $event, $settings[0]['events'] ) && $settings[0]['events'][ $event ] == 'on' ) {
|
101 |
+
return true;
|
102 |
+
}
|
103 |
+
|
104 |
+
return false;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Integration settings get options
|
109 |
+
*
|
110 |
+
* @param string $integration_id
|
111 |
+
*
|
112 |
+
* @return array|false
|
113 |
+
*/
|
114 |
+
public function get_integration_settings() {
|
115 |
+
$integration_settings = get_option( 'wcct_settings', array() );
|
116 |
+
|
117 |
+
if ( isset( $integration_settings[ $this->id ] ) ) {
|
118 |
+
return $integration_settings[ $this->id ];
|
119 |
+
}
|
120 |
+
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Check feattures
|
126 |
+
*
|
127 |
+
* @param array $feature
|
128 |
+
*
|
129 |
+
* @return boolean
|
130 |
+
*/
|
131 |
+
public function supports( $feature ) {
|
132 |
+
if ( in_array( $feature, $this->supports ) ) {
|
133 |
+
return true;
|
134 |
+
}
|
135 |
+
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Helper function to iterate through a cart and gather all content ids
|
141 |
+
*
|
142 |
+
* @param array $cart
|
143 |
+
*
|
144 |
+
* @return array
|
145 |
+
*/
|
146 |
+
protected function get_content_ids_from_cart( $cart ) {
|
147 |
+
$product_ids = array();
|
148 |
+
|
149 |
+
foreach ($cart as $item) {
|
150 |
+
$product_ids[] = $item['data']->get_id();
|
151 |
+
}
|
152 |
+
|
153 |
+
return $product_ids;
|
154 |
+
}
|
155 |
+
}
|
includes/class-admin.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The admin page handler class
|
5 |
+
*/
|
6 |
+
class WCCT_Admin {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor for WCCT_Admin class
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
13 |
+
add_action( 'admin_menu', array( $this, 'admin_menu_page' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Enqueue Script
|
18 |
+
*
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
public function enqueue_scripts() {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* All style goes here
|
25 |
+
*/
|
26 |
+
wp_enqueue_style( 'style', plugins_url( 'assets/css/style.css', WCCT_FILE ), false, filemtime( WCCT_PATH . '/assets/css/style.css' ) );
|
27 |
+
|
28 |
+
/**
|
29 |
+
* All script goes here
|
30 |
+
*/
|
31 |
+
wp_enqueue_script( 'wcct-admin', plugins_url( 'assets/js/admin.js', WCCT_FILE ), array( 'jquery', 'wp-util' ), filemtime( WCCT_PATH . '/assets/js/admin.js' ), true );
|
32 |
+
|
33 |
+
wp_localize_script(
|
34 |
+
'wcct-admin', 'wc_tracking', array(
|
35 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
36 |
+
)
|
37 |
+
);
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Add menu page
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function admin_menu_page() {
|
46 |
+
$menu_page = apply_filters( 'wcct_menu_page', 'woocommerce' );
|
47 |
+
$capability = wcct_manage_cap();
|
48 |
+
|
49 |
+
add_submenu_page( $menu_page, __( 'Conversion Tracking', 'woocommerce-conversion-tracking' ), __( 'Conversion Tracking', 'woocommerce-conversion-tracking' ), $capability, 'conversion-tracking', array( $this, 'conversion_tracking_template' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Conversion Tracking View Page
|
54 |
+
*
|
55 |
+
* @return void
|
56 |
+
*/
|
57 |
+
public function conversion_tracking_template() {
|
58 |
+
$integrations = wcct_init()->manager->get_integrations();
|
59 |
+
|
60 |
+
include dirname( __FILE__ ) . '/views/admin.php';
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Get navigation tab
|
65 |
+
*
|
66 |
+
* @return array
|
67 |
+
*/
|
68 |
+
public function wcct_get_tab() {
|
69 |
+
|
70 |
+
$sections = array(
|
71 |
+
array(
|
72 |
+
'id' => 'integrations',
|
73 |
+
'title' => __( 'Integrations', 'woocommerce-conversion-tracking' ),
|
74 |
+
),
|
75 |
+
);
|
76 |
+
|
77 |
+
return apply_filters( 'wcct_nav_tab', $sections );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Show navigation
|
82 |
+
*
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
public function show_navigation() {
|
86 |
+
$count = count( $this->wcct_get_tab() );
|
87 |
+
$tabs = $this->wcct_get_tab();
|
88 |
+
$active = isset( $_GET['tab'] ) ? $_GET['tab'] : 'integrations';
|
89 |
+
|
90 |
+
if ( $count == 0 ) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
$html = '<h2 class="nav-tab-wrapper">';
|
95 |
+
foreach ( $tabs as $tab ) {
|
96 |
+
$active_class = ( $tab['id'] == $active ) ? 'nav-tab-active' : '';
|
97 |
+
|
98 |
+
if ( !empty( $tab['id'] ) ) {
|
99 |
+
$html .= sprintf( '<a href="admin.php?page=conversion-tracking&tab=%s" class="nav-tab %s">%s</a>', $tab['id'], $active_class, $tab['title'] );
|
100 |
+
} else {
|
101 |
+
$html .= sprintf( '<a href="#" class="nav-tab disabled">%s</a>', $tab['title'] );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
$html .= '</h2>';
|
106 |
+
|
107 |
+
echo $html;
|
108 |
+
}
|
109 |
+
}
|
includes/class-ajax.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Ajax handler class
|
5 |
+
*/
|
6 |
+
class WCCT_Ajax {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* WC Conversion Tracking Ajax Class Constructor
|
10 |
+
*/
|
11 |
+
public function __construct() {
|
12 |
+
add_action( 'wp_ajax_wcct_save_settings', array( $this, 'wcct_save_settings' ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Save integration settings
|
17 |
+
*
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
public function wcct_save_settings() {
|
21 |
+
if ( ! current_user_can( wcct_manage_cap() ) ) {
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! isset( $_POST['settings'] ) ) {
|
26 |
+
wp_send_json_error();
|
27 |
+
}
|
28 |
+
|
29 |
+
$integration_settings = array();
|
30 |
+
|
31 |
+
foreach ( $_POST['settings'] as $field_id => $settings ) {
|
32 |
+
$is_enabled = isset( $settings['enabled'] ) ? true : false;
|
33 |
+
|
34 |
+
$settings = array_merge( $settings, array( 'enabled' => $is_enabled ) );
|
35 |
+
$integration_settings[ $field_id ] = $settings;
|
36 |
+
}
|
37 |
+
|
38 |
+
$integration_settings = apply_filters( 'wcct_save_integrations_settings', $integration_settings );
|
39 |
+
update_option( 'wcct_settings', stripslashes_deep( $integration_settings ) );
|
40 |
+
wp_send_json_success( array(
|
41 |
+
'message' => __( 'Settings has been saved successfully!', 'woocommerce-conversion-tracking' )
|
42 |
+
) );
|
43 |
+
|
44 |
+
}
|
45 |
+
}
|
includes/class-event-dispatcher.php
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Event Manager
|
5 |
+
*/
|
6 |
+
class WCCT_Event_Dispatcher {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Store integration object
|
10 |
+
*
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
private $integrations;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor for WCCT_Event_Dispatcher class
|
17 |
+
*/
|
18 |
+
function __construct() {
|
19 |
+
add_action( 'plugins_loaded', array( $this, 'init_integrations' ) );
|
20 |
+
add_action( 'wp_head', array( $this, 'enqueue_scripts' ) );
|
21 |
+
|
22 |
+
// purchase events
|
23 |
+
add_action( 'woocommerce_add_to_cart', array( $this, 'added_to_cart' ), 10, 4 );
|
24 |
+
add_action( 'woocommerce_after_checkout_form', array( $this, 'initiate_checkout' ) );
|
25 |
+
add_action( 'woocommerce_thankyou', array( $this, 'checkout_complete' ) );
|
26 |
+
|
27 |
+
// view events
|
28 |
+
add_action( 'woocommerce_after_single_product', array( $this, 'product_view' ) );
|
29 |
+
add_action( 'woocommerce_after_shop_loop', array( $this, 'category_view' ) );
|
30 |
+
|
31 |
+
// registration events
|
32 |
+
add_action( 'woocommerce_registration_redirect', array( $this, 'wc_redirect_url' ) );
|
33 |
+
add_action( 'template_redirect', array( $this, 'track_registration' ) );
|
34 |
+
|
35 |
+
// Search Event
|
36 |
+
add_action( 'pre_get_posts', array( $this, 'product_search' ) );
|
37 |
+
|
38 |
+
// Wishlist Event
|
39 |
+
|
40 |
+
add_filter( 'yith_wcwl_added_to_wishlist', array( $this, 'product_wishlist' ) );
|
41 |
+
|
42 |
+
add_action( 'woocommerce_wishlist_add_item', array( $this, 'product_wishlist' ) );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Intantiate integrations
|
47 |
+
*
|
48 |
+
* @return object
|
49 |
+
*/
|
50 |
+
public function init_integrations() {
|
51 |
+
$manager = wcct_init()->manager;
|
52 |
+
$this->integrations = $manager->get_active_integrations();
|
53 |
+
|
54 |
+
return $this->integrations;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Do add to cart event
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function added_to_cart() {
|
63 |
+
$this->dispatch_event( 'add_to_cart' );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Initiate checkout events
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
public function initiate_checkout() {
|
72 |
+
$this->dispatch_event( 'initiate_checkout' );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Check out events
|
77 |
+
*
|
78 |
+
* @param int $order_id
|
79 |
+
*
|
80 |
+
* @return void
|
81 |
+
*/
|
82 |
+
public function checkout_complete( $order_id ) {
|
83 |
+
$this->dispatch_event( 'checkout', $order_id );
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Single product view event
|
88 |
+
*
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
public function product_view() {
|
92 |
+
$this->dispatch_event( 'product_view' );
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Product category view event
|
97 |
+
*
|
98 |
+
* @return void
|
99 |
+
*/
|
100 |
+
public function category_view() {
|
101 |
+
$this->dispatch_event( 'category_view' );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Customer registration
|
106 |
+
*
|
107 |
+
* @return void
|
108 |
+
*/
|
109 |
+
public function complete_registration() {
|
110 |
+
$this->dispatch_event( 'registration' );
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Product search event
|
115 |
+
*
|
116 |
+
* @return void
|
117 |
+
*/
|
118 |
+
public function product_search( $query ) {
|
119 |
+
if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
|
120 |
+
$this->dispatch_event( 'search' );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Product wishlist event
|
126 |
+
*
|
127 |
+
* @return void
|
128 |
+
*/
|
129 |
+
public function product_wishlist() {
|
130 |
+
$this->dispatch_event( 'add_to_wishlist' );
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Adds a url query arg to determine newly registered user
|
135 |
+
*
|
136 |
+
* @uses woocommerce_registration_redirect action
|
137 |
+
*
|
138 |
+
* @param string $redirect
|
139 |
+
*
|
140 |
+
* @return string
|
141 |
+
*/
|
142 |
+
function wc_redirect_url( $redirect ) {
|
143 |
+
|
144 |
+
$redirect = add_query_arg( array(
|
145 |
+
'_wc_user_reg' => 'true'
|
146 |
+
), $redirect );
|
147 |
+
|
148 |
+
return $redirect;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Print registration code when particular GET tag exists
|
153 |
+
*
|
154 |
+
* @uses add_action()
|
155 |
+
* @return void
|
156 |
+
*/
|
157 |
+
function track_registration() {
|
158 |
+
if ( isset( $_GET['_wc_user_reg'] ) && $_GET['_wc_user_reg'] == 'true' ) {
|
159 |
+
add_action( 'wp_footer', array( $this, 'complete_registration' ) );
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Dispatch an event
|
165 |
+
*
|
166 |
+
* @param string $event
|
167 |
+
* @param mixed $value
|
168 |
+
*
|
169 |
+
* @return void
|
170 |
+
*/
|
171 |
+
private function dispatch_event( $event, $value = '' ) {
|
172 |
+
foreach ( $this->integrations as $integration ) {
|
173 |
+
if ( $integration->supports( $event ) ) {
|
174 |
+
if ( method_exists( $integration, $event ) ) {
|
175 |
+
$integration->$event( $value );
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Integration enqueue script
|
183 |
+
*
|
184 |
+
* @return void
|
185 |
+
*/
|
186 |
+
public function enqueue_scripts() {
|
187 |
+
|
188 |
+
echo '<!------ Starting: WooCommerce Conversion Tracking (https://wordpress.org/plugins/woocommerce-conversion-tracking/) ----->' . PHP_EOL;
|
189 |
+
foreach ( $this->integrations as $integration ) {
|
190 |
+
$integration->enqueue_script();
|
191 |
+
}
|
192 |
+
echo '<!------ End: WooCommerce Conversion Tracking Codes ----->' . PHP_EOL;
|
193 |
+
}
|
194 |
+
}
|
includes/class-integration-manager.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Manager Class
|
5 |
+
*/
|
6 |
+
class WCCT_Integration_Manager {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* All integrations
|
10 |
+
*
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
private $integrations = array();
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor for WC_Conversion_Tracking_Integration_Manager Class
|
17 |
+
*/
|
18 |
+
public function __construct() {
|
19 |
+
$this->includes_integration();
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Required all integration class
|
24 |
+
*
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
public function includes_integration() {
|
28 |
+
$this->integrations['facebook'] = require_once WCCT_INCLUDES . '/integrations/class-integration-facebook.php';
|
29 |
+
$this->integrations['google'] = require_once WCCT_INCLUDES . '/integrations/class-integration-google.php';
|
30 |
+
$this->integrations['twitter'] = require_once WCCT_INCLUDES . '/integrations/class-integration-twitter.php';
|
31 |
+
|
32 |
+
|
33 |
+
$this->integrations = apply_filters( 'wcct_integrations', $this->integrations );
|
34 |
+
|
35 |
+
$this->integrations['custom'] = require_once WCCT_INCLUDES . '/integrations/class-integration-custom.php';
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get all active integrations
|
40 |
+
*
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function get_active_integrations() {
|
44 |
+
$integrations = $this->integrations;
|
45 |
+
$active = array();
|
46 |
+
|
47 |
+
foreach ( $integrations as $integration ) {
|
48 |
+
if ( $integration->is_enabled() ) {
|
49 |
+
$active[] = $integration;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
return $active;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get all integration
|
58 |
+
*
|
59 |
+
* @return array
|
60 |
+
*/
|
61 |
+
public function get_integrations() {
|
62 |
+
if ( empty( $this->integrations ) ) {
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
return $this->integrations;
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
includes/class-integration-pro-features.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WCCT_Pro_Features Class
|
5 |
+
*/
|
6 |
+
class WCCT_Pro_Features {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor for the profeatures class
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
add_filter( 'wcct_settings_fb', array( $this, 'facebook_pro_features' ), 10, 1 );
|
13 |
+
add_filter( 'wcct_settings_twitter', array( $this, 'twitter_pro_features' ), 10, 1 );
|
14 |
+
add_filter( 'wcct_settings_adwords', array( $this, 'adwords_pro_features' ), 10, 1 );
|
15 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) );
|
16 |
+
|
17 |
+
add_filter( 'wcct_nav_tab', array( $this, 'pro_tabs' ) );
|
18 |
+
|
19 |
+
add_action( 'wcct_sidebar', array( $this, 'profeature_ad' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
public function enqueue_script() {
|
23 |
+
|
24 |
+
wp_enqueue_script( 'sweetalert', plugins_url( 'assets/js/sweetalert.min.js', WCCT_FILE ), array(), false, false );
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Add facebook product catalog tab
|
30 |
+
*
|
31 |
+
* @param array $sections
|
32 |
+
*
|
33 |
+
* @return array
|
34 |
+
*/
|
35 |
+
public function pro_tabs( $sections ) {
|
36 |
+
|
37 |
+
$sections[] = array(
|
38 |
+
'id' => '',
|
39 |
+
'title' => __( 'Facebook Product Catalog (Pro)', 'woocommerce-conversion-tracking' ),
|
40 |
+
);
|
41 |
+
|
42 |
+
$sections[] = array(
|
43 |
+
'id' => '',
|
44 |
+
'title' => __( 'Settings (Pro)', 'woocommerce-conversion-tracking' ),
|
45 |
+
);
|
46 |
+
|
47 |
+
return $sections;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Displaying facebook pro-features
|
52 |
+
*
|
53 |
+
* @param array $settings
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
public function facebook_pro_features( $settings ) {
|
57 |
+
|
58 |
+
$settings['events']['options']['ViewContent-pro'] = array(
|
59 |
+
'label' => __( 'View Product', 'woocommerce-conversion-tracking' ),
|
60 |
+
'profeature' => true,
|
61 |
+
);
|
62 |
+
|
63 |
+
$settings['events']['options']['ViewCategory-pro'] = array(
|
64 |
+
'label' => __( 'View Product Category', 'woocommerce-conversion-tracking' ),
|
65 |
+
'profeature' => true,
|
66 |
+
);
|
67 |
+
|
68 |
+
$settings['events']['options']['Search-pro'] = array(
|
69 |
+
'label' => __( 'Search', 'woocommerce-conversion-tracking' ),
|
70 |
+
'profeature' => true,
|
71 |
+
);
|
72 |
+
|
73 |
+
$settings['events']['options']['AddToWishlist-pro'] = array(
|
74 |
+
'label' => __( 'Add To Wishlist', 'woocommerce-conversion-tracking' ),
|
75 |
+
'profeature' => true,
|
76 |
+
);
|
77 |
+
|
78 |
+
return $settings;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Displaying twitter pro-features
|
83 |
+
*
|
84 |
+
* @param array $settings
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
public function twitter_pro_features( $settings ) {
|
88 |
+
|
89 |
+
$settings['events']['options']['AddToCart-pro'] = array(
|
90 |
+
'label' => __( 'Add to Cart ', 'woocommerce-conversion-tracking' ),
|
91 |
+
'profeature' => true,
|
92 |
+
);
|
93 |
+
|
94 |
+
$settings['events']['options']['CompleteRegistration-pro'] = array(
|
95 |
+
'label' => __( 'Complete Registration', 'woocommerce-conversion-tracking' ),
|
96 |
+
'profeature' => true,
|
97 |
+
);
|
98 |
+
|
99 |
+
return $settings;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Displaying adwords pro-features
|
104 |
+
*
|
105 |
+
* @param array $settings
|
106 |
+
* @return array
|
107 |
+
*/
|
108 |
+
public function adwords_pro_features( $settings ) {
|
109 |
+
|
110 |
+
$settings['events']['options']['CompleteRegistration-pro'] = array(
|
111 |
+
'label' => __( 'Complete Registration', 'woocommerce-conversion-tracking' ),
|
112 |
+
'profeature' => true,
|
113 |
+
);
|
114 |
+
|
115 |
+
return $settings;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Show profeature
|
120 |
+
*
|
121 |
+
* @return void
|
122 |
+
*/
|
123 |
+
public function profeature_ad() {
|
124 |
+
?>
|
125 |
+
<div class="premium-box box-blue">
|
126 |
+
<h3><?php _e( 'Premium Features', 'woocommerce-conversion-tracking' ) ?></h3>
|
127 |
+
|
128 |
+
<ul class="premium-feature-list">
|
129 |
+
<li>Advanced Facebook Events and Tracking</li>
|
130 |
+
<li>Facebook <strong>Product Catalog</strong></li>
|
131 |
+
<li><mark><strong>Multiple</strong> Facebook Pixels</mark></li>
|
132 |
+
<li>Advanced Google Adwords Events</li>
|
133 |
+
<li>Advanced Twitter Events</li>
|
134 |
+
<li>Perfect Audience Integration</li>
|
135 |
+
</ul>
|
136 |
+
|
137 |
+
<a href="https://wedevs.com/woocommerce-conversion-tracking/upgrade-to-pro/?utm_source=wp-admin&utm_medium=pro-upgrade&utm_campaign=wcct_upgrade&utm_content=Get_Premium" target="_blank" class="button button-primary"><?php _e( 'Get Premium', 'woocommerce-conversion-tracking' ) ?></a>
|
138 |
+
|
139 |
+
<p style="margin-bottom: 0" class="help">
|
140 |
+
Get <strong>50% Discount</strong> on pro upgrade for a limited time.
|
141 |
+
</p>
|
142 |
+
</div>
|
143 |
+
<?php
|
144 |
+
}
|
145 |
+
}
|
includes/class-upgrades.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Upgrade Routine
|
5 |
+
*
|
6 |
+
* @since 2.0
|
7 |
+
*/
|
8 |
+
class WCCT_Upgrades {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* The upgrades
|
12 |
+
*
|
13 |
+
* @var array
|
14 |
+
*/
|
15 |
+
private static $upgrades = array(
|
16 |
+
'2.0' => 'upgrades/upgrade-2.0.php',
|
17 |
+
);
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get the plugin version
|
21 |
+
*
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function get_version() {
|
25 |
+
return get_option( 'wcct_version', false );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Check if the plugin needs any update
|
30 |
+
*
|
31 |
+
* @return boolean
|
32 |
+
*/
|
33 |
+
public function needs_update() {
|
34 |
+
$version = $this->get_version();
|
35 |
+
|
36 |
+
// may be it's the first install
|
37 |
+
if ( ! $version ) {
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
|
41 |
+
if ( version_compare( $version, WCCT_VERSION, '<' ) && array_key_exists( WCCT_VERSION, self::$upgrades ) ) {
|
42 |
+
return true;
|
43 |
+
}
|
44 |
+
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Perform all the necessary upgrade routines
|
50 |
+
*
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
function perform_updates() {
|
54 |
+
$installed_version = $this->get_version();
|
55 |
+
$path = trailingslashit( dirname( __FILE__ ) );
|
56 |
+
|
57 |
+
foreach ( self::$upgrades as $version => $file ) {
|
58 |
+
if ( version_compare( $installed_version, $version, '<' ) ) {
|
59 |
+
include $path . $file;
|
60 |
+
update_option( 'wcct_version', $version );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
update_option( 'wcct_version', WCCT_VERSION );
|
65 |
+
}
|
66 |
+
}
|
includes/class-wedevs-insights.php
ADDED
@@ -0,0 +1,750 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'WeDevs_Insights' ) ) :
|
4 |
+
|
5 |
+
/**
|
6 |
+
* weDevs Tracker
|
7 |
+
*
|
8 |
+
* This is a tracker class to track plugin usage based on if the customer has opted in.
|
9 |
+
* No personal information is being tracked by this class, only general settings, active plugins, environment details
|
10 |
+
* and admin email.
|
11 |
+
*
|
12 |
+
* @version 1.0
|
13 |
+
*
|
14 |
+
* @author Tareq Hasan <tareq@wedevs.com>
|
15 |
+
*/
|
16 |
+
class WeDevs_Insights {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Slug of the plugin
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
public $slug;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Name of the plugin
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $name;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Main plugin file
|
34 |
+
*
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
public $basename;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* The notice text
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
public $notice;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* URL to the API endpoint
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
private static $api_url = 'http://tracking.wedevs.com/';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Initialize the class
|
55 |
+
*
|
56 |
+
* @param string $slug slug of the plugin
|
57 |
+
* @param string $name readable name of the plugin
|
58 |
+
* @param string $file main plugin file path
|
59 |
+
* @param string $notice the notice texts if needs customizing
|
60 |
+
*/
|
61 |
+
public function __construct( $slug, $name, $file, $notice = '' ) {
|
62 |
+
$this->slug = $slug;
|
63 |
+
$this->name = $name;
|
64 |
+
$this->basename = plugin_basename( $file );
|
65 |
+
$this->notice = $notice;
|
66 |
+
|
67 |
+
// tracking notice
|
68 |
+
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
69 |
+
add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
|
70 |
+
|
71 |
+
// plugin deactivate actions
|
72 |
+
add_action( 'plugin_action_links_' . $this->basename, array( $this, 'plugin_action_links' ) );
|
73 |
+
add_action( 'admin_footer', array( $this, 'deactivate_scripts' ) );
|
74 |
+
|
75 |
+
// clean events and options on deactivation
|
76 |
+
register_deactivation_hook( $file, array( $this, 'deactivate_plugin' ) );
|
77 |
+
|
78 |
+
// uninstall reason
|
79 |
+
add_action( 'wp_ajax_' . $this->slug . '_submit-uninstall-reason', array( $this, 'uninstall_reason_submission' ) );
|
80 |
+
|
81 |
+
// cron events
|
82 |
+
add_action( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );
|
83 |
+
add_action( $this->slug . '_tracker_send_event', array( $this, 'send_tracking_data' ) );
|
84 |
+
// add_action( 'admin_init', array( $this, 'send_tracking_data' ) ); // test
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Send tracking data to weDevs server
|
89 |
+
*
|
90 |
+
* @param boolean $override
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function send_tracking_data( $override = false ) {
|
95 |
+
// skip on AJAX Requests
|
96 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
if ( ! $this->tracking_allowed() && ! $override ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
// Send a maximum of once per week
|
105 |
+
$last_send = $this->get_last_send();
|
106 |
+
if ( $last_send && $last_send > strtotime( '-1 week' ) ) {
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
$this->send_request( $this->get_tracking_data(), 'track' );
|
111 |
+
|
112 |
+
update_option( $this->slug . '_tracking_last_send', time() );
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Send request to remote endpoint
|
117 |
+
*
|
118 |
+
* @param array $params
|
119 |
+
* @param string $route
|
120 |
+
*
|
121 |
+
* @return void
|
122 |
+
*/
|
123 |
+
private function send_request( $params, $route ) {
|
124 |
+
$resp = wp_remote_post( self::$api_url . $route, array(
|
125 |
+
'method' => 'POST',
|
126 |
+
'timeout' => 45,
|
127 |
+
'redirection' => 5,
|
128 |
+
'httpversion' => '1.0',
|
129 |
+
'blocking' => false,
|
130 |
+
'headers' => array( 'user-agent' => 'WeDevsTracker/' . md5( esc_url( home_url() ) ) . ';' ),
|
131 |
+
'body' => $params,
|
132 |
+
'cookies' => array()
|
133 |
+
)
|
134 |
+
);
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Get the tracking data points
|
139 |
+
*
|
140 |
+
* @return array
|
141 |
+
*/
|
142 |
+
protected function get_tracking_data() {
|
143 |
+
$all_plugins = $this->get_all_plugins();
|
144 |
+
$admin_user = get_user_by( 'id', 1 );
|
145 |
+
|
146 |
+
$data = array(
|
147 |
+
'url' => home_url(),
|
148 |
+
'site' => get_bloginfo( 'name' ),
|
149 |
+
'admin_email' => get_option( 'admin_email' ),
|
150 |
+
'user_name' => $admin_user->display_name,
|
151 |
+
'user_email' => $admin_user->user_email,
|
152 |
+
'plugin' => $this->slug,
|
153 |
+
'server' => $this->get_server_info(),
|
154 |
+
'wp' => $this->get_wp_info(),
|
155 |
+
'users' => $this->get_user_counts(),
|
156 |
+
'active_plugins' => count( $all_plugins['active_plugins'] ),
|
157 |
+
'inactive_plugins' => count( $all_plugins['inactive_plugins'] ),
|
158 |
+
);
|
159 |
+
|
160 |
+
// for child classes
|
161 |
+
if ( $extra = $this->get_extra_data() ) {
|
162 |
+
$data['extra'] = $extra;
|
163 |
+
}
|
164 |
+
|
165 |
+
return apply_filters( $this->slug . '_tracker_data', $data );
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* If a child class wants to send extra data
|
170 |
+
*
|
171 |
+
* @return mixed
|
172 |
+
*/
|
173 |
+
protected function get_extra_data() {
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Explain the user which data we collect
|
179 |
+
*
|
180 |
+
* @return string
|
181 |
+
*/
|
182 |
+
protected function data_we_collect() {
|
183 |
+
$data = array(
|
184 |
+
'Server environment details (php, mysql, server, WordPress versions)',
|
185 |
+
'Number of users in your site',
|
186 |
+
'Site language',
|
187 |
+
'Number of active and inactive plugins',
|
188 |
+
'Site name and url',
|
189 |
+
'Your name and email address',
|
190 |
+
);
|
191 |
+
|
192 |
+
return $data;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Check if the user has opted into tracking
|
197 |
+
*
|
198 |
+
* @return bool
|
199 |
+
*/
|
200 |
+
private function tracking_allowed() {
|
201 |
+
$allow_tracking = get_option( $this->slug . '_allow_tracking', 'no' );
|
202 |
+
|
203 |
+
return $allow_tracking == 'yes';
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Get the last time a tracking was sent
|
208 |
+
*
|
209 |
+
* @return false|string
|
210 |
+
*/
|
211 |
+
private function get_last_send() {
|
212 |
+
return get_option( $this->slug . '_tracking_last_send', false );
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Check if the notice has been dismissed or enabled
|
217 |
+
*
|
218 |
+
* @return boolean
|
219 |
+
*/
|
220 |
+
private function notice_dismissed() {
|
221 |
+
$hide_notice = get_option( $this->slug . '_tracking_notice', 'no' );
|
222 |
+
|
223 |
+
if ( 'hide' == $hide_notice ) {
|
224 |
+
return true;
|
225 |
+
}
|
226 |
+
|
227 |
+
return false;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Check if the current server is localhost
|
232 |
+
*
|
233 |
+
* @return boolean
|
234 |
+
*/
|
235 |
+
private function is_local_server() {
|
236 |
+
return in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) );
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Schedule the event weekly
|
241 |
+
*
|
242 |
+
* @return void
|
243 |
+
*/
|
244 |
+
private function schedule_event() {
|
245 |
+
wp_schedule_event( time(), 'weekly', $this->slug . '_tracker_send_event' );
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Clear any scheduled hook
|
250 |
+
*
|
251 |
+
* @return void
|
252 |
+
*/
|
253 |
+
private function clear_schedule_event() {
|
254 |
+
wp_clear_scheduled_hook( $this->slug . '_tracker_send_event' );
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Display the admin notice to users that have not opted-in or out
|
259 |
+
*
|
260 |
+
* @return void
|
261 |
+
*/
|
262 |
+
public function admin_notice() {
|
263 |
+
|
264 |
+
if ( $this->notice_dismissed() ) {
|
265 |
+
return;
|
266 |
+
}
|
267 |
+
|
268 |
+
if ( $this->tracking_allowed() ) {
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
273 |
+
return;
|
274 |
+
}
|
275 |
+
|
276 |
+
// don't show tracking if a local server
|
277 |
+
if ( ! $this->is_local_server() ) {
|
278 |
+
$optin_url = add_query_arg( $this->slug . '_tracker_optin', 'true' );
|
279 |
+
$optout_url = add_query_arg( $this->slug . '_tracker_optout', 'true' );
|
280 |
+
|
281 |
+
if ( empty( $this->notice ) ) {
|
282 |
+
$notice = sprintf( __( 'Want to help make <strong>%s</strong> even more awesome? Allow weDevs to collect non-sensitive diagnostic data and usage information.', 'textdomain' ), $this->name );
|
283 |
+
} else {
|
284 |
+
$notice = $this->notice;
|
285 |
+
}
|
286 |
+
|
287 |
+
$notice .= ' (<a class="insights-data-we-collect" href="#">' . __( 'what we collect', 'textdomain' ) . '</a>)';
|
288 |
+
$notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked.</p>';
|
289 |
+
|
290 |
+
echo '<div class="updated"><p>';
|
291 |
+
echo $notice;
|
292 |
+
echo '</p><p class="submit">';
|
293 |
+
echo ' <a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . __( 'Allow', 'textdomain' ) . '</a>';
|
294 |
+
echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . __( 'No thanks', 'textdomain' ) . '</a>';
|
295 |
+
echo '</p></div>';
|
296 |
+
|
297 |
+
echo "<script type='text/javascript'>jQuery('.insights-data-we-collect').on('click', function(e) {
|
298 |
+
e.preventDefault();
|
299 |
+
jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
|
300 |
+
});
|
301 |
+
</script>
|
302 |
+
";
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* handle the optin/optout
|
308 |
+
*
|
309 |
+
* @return void
|
310 |
+
*/
|
311 |
+
public function handle_optin_optout() {
|
312 |
+
if ( isset( $_GET[ $this->slug . '_tracker_optin' ] ) && $_GET[ $this->slug . '_tracker_optin' ] == 'true' ) {
|
313 |
+
update_option( $this->slug . '_allow_tracking', 'yes' );
|
314 |
+
update_option( $this->slug . '_tracking_notice', 'hide' );
|
315 |
+
|
316 |
+
$this->clear_schedule_event();
|
317 |
+
$this->schedule_event();
|
318 |
+
$this->send_tracking_data();
|
319 |
+
|
320 |
+
wp_redirect( remove_query_arg( $this->slug . '_tracker_optin' ) );
|
321 |
+
exit;
|
322 |
+
}
|
323 |
+
|
324 |
+
if ( isset( $_GET[ $this->slug . '_tracker_optout' ] ) && $_GET[ $this->slug . '_tracker_optout' ] == 'true' ) {
|
325 |
+
update_option( $this->slug . '_allow_tracking', 'no' );
|
326 |
+
update_option( $this->slug . '_tracking_notice', 'hide' );
|
327 |
+
|
328 |
+
$this->clear_schedule_event();
|
329 |
+
|
330 |
+
wp_redirect( remove_query_arg( $this->slug . '_tracker_optout' ) );
|
331 |
+
exit;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Get the number of post counts
|
337 |
+
*
|
338 |
+
* @param string $post_type
|
339 |
+
*
|
340 |
+
* @return integer
|
341 |
+
*/
|
342 |
+
protected function get_post_count( $post_type ) {
|
343 |
+
global $wpdb;
|
344 |
+
|
345 |
+
return (int) $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '$post_type' and post_status = 'publish'");
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* Get server related info.
|
350 |
+
*
|
351 |
+
* @return array
|
352 |
+
*/
|
353 |
+
private static function get_server_info() {
|
354 |
+
global $wpdb;
|
355 |
+
|
356 |
+
$server_data = array();
|
357 |
+
|
358 |
+
if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
|
359 |
+
$server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
|
360 |
+
}
|
361 |
+
|
362 |
+
if ( function_exists( 'phpversion' ) ) {
|
363 |
+
$server_data['php_version'] = phpversion();
|
364 |
+
}
|
365 |
+
|
366 |
+
$server_data['mysql_version'] = $wpdb->db_version();
|
367 |
+
|
368 |
+
$server_data['php_max_upload_size'] = size_format( wp_max_upload_size() );
|
369 |
+
$server_data['php_default_timezone'] = date_default_timezone_get();
|
370 |
+
$server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
|
371 |
+
$server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
|
372 |
+
$server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
|
373 |
+
|
374 |
+
return $server_data;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Get WordPress related data.
|
379 |
+
*
|
380 |
+
* @return array
|
381 |
+
*/
|
382 |
+
private function get_wp_info() {
|
383 |
+
$wp_data = array();
|
384 |
+
|
385 |
+
$wp_data['memory_limit'] = WP_MEMORY_LIMIT;
|
386 |
+
$wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
|
387 |
+
$wp_data['locale'] = get_locale();
|
388 |
+
$wp_data['version'] = get_bloginfo( 'version' );
|
389 |
+
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
|
390 |
+
|
391 |
+
return $wp_data;
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Get the list of active and inactive plugins
|
396 |
+
*
|
397 |
+
* @return array
|
398 |
+
*/
|
399 |
+
private function get_all_plugins() {
|
400 |
+
// Ensure get_plugins function is loaded
|
401 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
402 |
+
include ABSPATH . '/wp-admin/includes/plugin.php';
|
403 |
+
}
|
404 |
+
|
405 |
+
$plugins = get_plugins();
|
406 |
+
$active_plugins_keys = get_option( 'active_plugins', array() );
|
407 |
+
$active_plugins = array();
|
408 |
+
|
409 |
+
foreach ( $plugins as $k => $v ) {
|
410 |
+
// Take care of formatting the data how we want it.
|
411 |
+
$formatted = array();
|
412 |
+
$formatted['name'] = strip_tags( $v['Name'] );
|
413 |
+
|
414 |
+
if ( isset( $v['Version'] ) ) {
|
415 |
+
$formatted['version'] = strip_tags( $v['Version'] );
|
416 |
+
}
|
417 |
+
|
418 |
+
if ( isset( $v['Author'] ) ) {
|
419 |
+
$formatted['author'] = strip_tags( $v['Author'] );
|
420 |
+
}
|
421 |
+
|
422 |
+
if ( isset( $v['Network'] ) ) {
|
423 |
+
$formatted['network'] = strip_tags( $v['Network'] );
|
424 |
+
}
|
425 |
+
|
426 |
+
if ( isset( $v['PluginURI'] ) ) {
|
427 |
+
$formatted['plugin_uri'] = strip_tags( $v['PluginURI'] );
|
428 |
+
}
|
429 |
+
|
430 |
+
if ( in_array( $k, $active_plugins_keys ) ) {
|
431 |
+
// Remove active plugins from list so we can show active and inactive separately
|
432 |
+
unset( $plugins[$k] );
|
433 |
+
$active_plugins[$k] = $formatted;
|
434 |
+
} else {
|
435 |
+
$plugins[$k] = $formatted;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Get user totals based on user role.
|
444 |
+
*
|
445 |
+
* @return array
|
446 |
+
*/
|
447 |
+
private function get_user_counts() {
|
448 |
+
$user_count = array();
|
449 |
+
$user_count_data = count_users();
|
450 |
+
$user_count['total'] = $user_count_data['total_users'];
|
451 |
+
|
452 |
+
// Get user count based on user role
|
453 |
+
foreach ( $user_count_data['avail_roles'] as $role => $count ) {
|
454 |
+
$user_count[ $role ] = $count;
|
455 |
+
}
|
456 |
+
|
457 |
+
return $user_count;
|
458 |
+
}
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Add weekly cron schedule
|
462 |
+
*
|
463 |
+
* @param array $schedules
|
464 |
+
*
|
465 |
+
* @return array
|
466 |
+
*/
|
467 |
+
public function add_weekly_schedule( $schedules ) {
|
468 |
+
|
469 |
+
$schedules['weekly'] = array(
|
470 |
+
'interval' => DAY_IN_SECONDS * 7,
|
471 |
+
'display' => __( 'Once Weekly', 'textdomain' )
|
472 |
+
);
|
473 |
+
|
474 |
+
return $schedules;
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Clear our options upon deactivation
|
479 |
+
*
|
480 |
+
* @return void
|
481 |
+
*/
|
482 |
+
public function deactivate_plugin() {
|
483 |
+
$this->clear_schedule_event();
|
484 |
+
|
485 |
+
delete_option( $this->slug . '_allow_tracking' );
|
486 |
+
delete_option( $this->slug . '_tracking_notice' );
|
487 |
+
delete_option( $this->slug . '_tracking_last_send' );
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Hook into action links and modify the deactivate link
|
492 |
+
*
|
493 |
+
* @param array $links
|
494 |
+
*
|
495 |
+
* @return array
|
496 |
+
*/
|
497 |
+
public function plugin_action_links( $links ) {
|
498 |
+
|
499 |
+
if ( array_key_exists( 'deactivate', $links ) ) {
|
500 |
+
$links['deactivate'] = str_replace( '<a', '<a class="' . $this->slug . '-deactivate-link"', $links['deactivate'] );
|
501 |
+
}
|
502 |
+
|
503 |
+
return $links;
|
504 |
+
}
|
505 |
+
|
506 |
+
private function get_uninstall_reasons() {
|
507 |
+
$reasons = array(
|
508 |
+
array(
|
509 |
+
'id' => 'could-not-understand',
|
510 |
+
'text' => 'I couldn\'t understand how to make it work',
|
511 |
+
'type' => 'textarea',
|
512 |
+
'placeholder' => 'Would you like us to assist you?'
|
513 |
+
),
|
514 |
+
array(
|
515 |
+
'id' => 'found-better-plugin',
|
516 |
+
'text' => 'I found a better plugin',
|
517 |
+
'type' => 'text',
|
518 |
+
'placeholder' => 'Which plugin?'
|
519 |
+
),
|
520 |
+
array(
|
521 |
+
'id' => 'not-have-that-feature',
|
522 |
+
'text' => 'The plugin is great, but I need specific feature that you don\'t support',
|
523 |
+
'type' => 'textarea',
|
524 |
+
'placeholder' => 'Could you tell us more about that feature?'
|
525 |
+
),
|
526 |
+
array(
|
527 |
+
'id' => 'is-not-working',
|
528 |
+
'text' => 'The plugin is not working',
|
529 |
+
'type' => 'textarea',
|
530 |
+
'placeholder' => 'Could you tell us a bit more whats not working?'
|
531 |
+
),
|
532 |
+
array(
|
533 |
+
'id' => 'looking-for-other',
|
534 |
+
'text' => 'It\'s not what I was looking for',
|
535 |
+
'type' => '',
|
536 |
+
'placeholder' => ''
|
537 |
+
),
|
538 |
+
array(
|
539 |
+
'id' => 'did-not-work-as-expected',
|
540 |
+
'text' => 'The plugin didn\'t work as expected',
|
541 |
+
'type' => 'textarea',
|
542 |
+
'placeholder' => 'What did you expect?'
|
543 |
+
),
|
544 |
+
array(
|
545 |
+
'id' => 'other',
|
546 |
+
'text' => 'Other',
|
547 |
+
'type' => 'textarea',
|
548 |
+
'placeholder' => 'Could you tell us a bit more?'
|
549 |
+
),
|
550 |
+
);
|
551 |
+
|
552 |
+
return $reasons;
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Plugin deactivation uninstall reason submission
|
557 |
+
*
|
558 |
+
* @return void
|
559 |
+
*/
|
560 |
+
public function uninstall_reason_submission() {
|
561 |
+
global $wpdb;
|
562 |
+
|
563 |
+
if ( ! isset( $_POST['reason_id'] ) ) {
|
564 |
+
wp_send_json_error();
|
565 |
+
}
|
566 |
+
|
567 |
+
$current_user = wp_get_current_user();
|
568 |
+
|
569 |
+
$data = array(
|
570 |
+
'reason_id' => sanitize_text_field( $_POST['reason_id'] ),
|
571 |
+
'plugin' => $this->slug,
|
572 |
+
'url' => home_url(),
|
573 |
+
'user_email' => $current_user->user_email,
|
574 |
+
'user_name' => $current_user->display_name,
|
575 |
+
'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
|
576 |
+
'software' => $_SERVER['SERVER_SOFTWARE'],
|
577 |
+
'php_version' => phpversion(),
|
578 |
+
'mysql_version' => $wpdb->db_version(),
|
579 |
+
'wp_version' => get_bloginfo( 'version' ),
|
580 |
+
'locale' => get_locale(),
|
581 |
+
'multisite' => is_multisite() ? 'Yes' : 'No'
|
582 |
+
);
|
583 |
+
|
584 |
+
$this->send_request( $data, 'uninstall_reason' );
|
585 |
+
|
586 |
+
wp_send_json_success();
|
587 |
+
}
|
588 |
+
|
589 |
+
/**
|
590 |
+
* Handle the plugin deactivation feedback
|
591 |
+
*
|
592 |
+
* @return void
|
593 |
+
*/
|
594 |
+
public function deactivate_scripts() {
|
595 |
+
global $pagenow;
|
596 |
+
|
597 |
+
if ( 'plugins.php' != $pagenow ) {
|
598 |
+
return;
|
599 |
+
}
|
600 |
+
|
601 |
+
$reasons = $this->get_uninstall_reasons();
|
602 |
+
?>
|
603 |
+
|
604 |
+
<div class="wd-dr-modal" id="<?php echo $this->slug; ?>-wd-dr-modal">
|
605 |
+
<div class="wd-dr-modal-wrap">
|
606 |
+
<div class="wd-dr-modal-header">
|
607 |
+
<h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'domain' ); ?></h3>
|
608 |
+
</div>
|
609 |
+
|
610 |
+
<div class="wd-dr-modal-body">
|
611 |
+
<ul class="reasons">
|
612 |
+
<?php foreach ($reasons as $reason) { ?>
|
613 |
+
<li data-type="<?php echo esc_attr( $reason['type'] ); ?>" data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
|
614 |
+
<label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
|
615 |
+
</li>
|
616 |
+
<?php } ?>
|
617 |
+
</ul>
|
618 |
+
</div>
|
619 |
+
|
620 |
+
<div class="wd-dr-modal-footer">
|
621 |
+
<a href="#" class="dont-bother-me"><?php _e( 'I rather wouldn\'t say', 'domain' ); ?></a>
|
622 |
+
<button class="button-secondary"><?php _e( 'Submit & Deactivate', 'domain' ); ?></button>
|
623 |
+
<button class="button-primary"><?php _e( 'Cancel', 'domain' ); ?></button>
|
624 |
+
</div>
|
625 |
+
</div>
|
626 |
+
</div>
|
627 |
+
|
628 |
+
<style type="text/css">
|
629 |
+
.wd-dr-modal {
|
630 |
+
position: fixed;
|
631 |
+
z-index: 99999;
|
632 |
+
top: 0;
|
633 |
+
right: 0;
|
634 |
+
bottom: 0;
|
635 |
+
left: 0;
|
636 |
+
background: rgba(0,0,0,0.5);
|
637 |
+
display: none;
|
638 |
+
}
|
639 |
+
|
640 |
+
.wd-dr-modal.modal-active {
|
641 |
+
display: block;
|
642 |
+
}
|
643 |
+
|
644 |
+
.wd-dr-modal-wrap {
|
645 |
+
width: 475px;
|
646 |
+
position: relative;
|
647 |
+
margin: 10% auto;
|
648 |
+
background: #fff;
|
649 |
+
}
|
650 |
+
|
651 |
+
.wd-dr-modal-header {
|
652 |
+
border-bottom: 1px solid #eee;
|
653 |
+
padding: 8px 20px;
|
654 |
+
}
|
655 |
+
|
656 |
+
.wd-dr-modal-header h3 {
|
657 |
+
line-height: 150%;
|
658 |
+
margin: 0;
|
659 |
+
}
|
660 |
+
|
661 |
+
.wd-dr-modal-body {
|
662 |
+
padding: 5px 20px 20px 20px;
|
663 |
+
}
|
664 |
+
|
665 |
+
.wd-dr-modal-body .reason-input {
|
666 |
+
margin-top: 5px;
|
667 |
+
margin-left: 20px;
|
668 |
+
}
|
669 |
+
.wd-dr-modal-footer {
|
670 |
+
border-top: 1px solid #eee;
|
671 |
+
padding: 12px 20px;
|
672 |
+
text-align: right;
|
673 |
+
}
|
674 |
+
</style>
|
675 |
+
|
676 |
+
<script type="text/javascript">
|
677 |
+
(function($) {
|
678 |
+
$(function() {
|
679 |
+
var modal = $( '#<?php echo $this->slug; ?>-wd-dr-modal' );
|
680 |
+
var deactivateLink = '';
|
681 |
+
|
682 |
+
$( '#the-list' ).on('click', 'a.<?php echo $this->slug; ?>-deactivate-link', function(e) {
|
683 |
+
e.preventDefault();
|
684 |
+
|
685 |
+
modal.addClass('modal-active');
|
686 |
+
deactivateLink = $(this).attr('href');
|
687 |
+
modal.find('a.dont-bother-me').attr('href', deactivateLink).css('float', 'left');
|
688 |
+
});
|
689 |
+
|
690 |
+
modal.on('click', 'button.button-primary', function(e) {
|
691 |
+
e.preventDefault();
|
692 |
+
|
693 |
+
modal.removeClass('modal-active');
|
694 |
+
});
|
695 |
+
|
696 |
+
modal.on('click', 'input[type="radio"]', function () {
|
697 |
+
var parent = $(this).parents('li:first');
|
698 |
+
|
699 |
+
modal.find('.reason-input').remove();
|
700 |
+
|
701 |
+
var inputType = parent.data('type'),
|
702 |
+
inputPlaceholder = parent.data('placeholder'),
|
703 |
+
reasonInputHtml = '<div class="reason-input">' + ( ( 'text' === inputType ) ? '<input type="text" size="40" />' : '<textarea rows="5" cols="45"></textarea>' ) + '</div>';
|
704 |
+
|
705 |
+
if ( inputType !== '' ) {
|
706 |
+
parent.append( $(reasonInputHtml) );
|
707 |
+
parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
708 |
+
}
|
709 |
+
});
|
710 |
+
|
711 |
+
modal.on('click', 'button.button-secondary', function(e) {
|
712 |
+
e.preventDefault();
|
713 |
+
|
714 |
+
var button = $(this);
|
715 |
+
|
716 |
+
if ( button.hasClass('disabled') ) {
|
717 |
+
return;
|
718 |
+
}
|
719 |
+
|
720 |
+
var $radio = $( 'input[type="radio"]:checked', modal );
|
721 |
+
|
722 |
+
var $selected_reason = $radio.parents('li:first'),
|
723 |
+
$input = $selected_reason.find('textarea, input[type="text"]');
|
724 |
+
|
725 |
+
$.ajax({
|
726 |
+
url: ajaxurl,
|
727 |
+
type: 'POST',
|
728 |
+
data: {
|
729 |
+
action: '<?php echo $this->slug; ?>_submit-uninstall-reason',
|
730 |
+
reason_id: ( 0 === $radio.length ) ? 'none' : $radio.val(),
|
731 |
+
reason_info: ( 0 !== $input.length ) ? $input.val().trim() : ''
|
732 |
+
},
|
733 |
+
beforeSend: function() {
|
734 |
+
button.addClass('disabled');
|
735 |
+
button.text('Processing...');
|
736 |
+
},
|
737 |
+
complete: function() {
|
738 |
+
window.location.href = deactivateLink;
|
739 |
+
}
|
740 |
+
});
|
741 |
+
});
|
742 |
+
});
|
743 |
+
}(jQuery));
|
744 |
+
</script>
|
745 |
+
|
746 |
+
<?php
|
747 |
+
}
|
748 |
+
}
|
749 |
+
|
750 |
+
endif;
|
includes/class-welcome-20.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The welcome class after install
|
5 |
+
*
|
6 |
+
* @since 1.1.0
|
7 |
+
*/
|
8 |
+
class WCCT_Welcome_20 {
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
add_action( 'admin_init', array( $this, 'redirect_to_page' ), 9999 );
|
12 |
+
add_action( 'wcct_before_nav', array( $this, 'show_notice' ) );
|
13 |
+
|
14 |
+
add_action( 'wp_ajax_wcct_dismiss_notice', array( $this, 'dismiss_notice' ) );
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Redirect to the welcome page once the plugin is installed
|
19 |
+
*
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
public function redirect_to_page() {
|
23 |
+
if ( ! get_transient( 'wcct_upgrade_to_20' ) ) {
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
+
delete_transient( 'wcct_upgrade_to_20' );
|
28 |
+
|
29 |
+
// Only do this for single site installs.
|
30 |
+
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
wp_safe_redirect( admin_url( 'admin.php?page=conversion-tracking¬ice=welcome' ) );
|
35 |
+
exit;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Dismiss notice
|
40 |
+
*
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function dismiss_notice() {
|
44 |
+
update_option( '_wcct_20_notice_dismiss', true );
|
45 |
+
wp_send_json_success();
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Show welcome notice to 2.0
|
50 |
+
*
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
public function show_notice() {
|
54 |
+
$dismissed = get_option( '_wcct_20_notice_dismiss', false );
|
55 |
+
|
56 |
+
if ( ! $dismissed ) {
|
57 |
+
include WCCT_INCLUDES . '/views/welcome-20.php';
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
includes/integration.php
ADDED
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Conversion tracking integration class
|
5 |
+
*
|
6 |
+
* @author Tareq Hasan
|
7 |
+
*/
|
8 |
+
class WeDevs_WC_Tracking_Integration extends WC_Integration {
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
|
12 |
+
$this->id = 'wc_conv_tracking';
|
13 |
+
$this->method_title = __( 'Conversion Tracking Pixel', 'woocommerce-conversion-tracking' );
|
14 |
+
$this->method_description = __( 'Various conversion tracking pixel integration like Facebook Ad, Google AdWords, etc. Insert your scripts codes here:', 'woocommerce-conversion-tracking' );
|
15 |
+
|
16 |
+
// Load the settings.
|
17 |
+
$this->init_form_fields();
|
18 |
+
$this->init_settings();
|
19 |
+
|
20 |
+
// Save settings if the we are in the right section
|
21 |
+
if ( isset( $_POST['section'] ) && $this->id === $_POST['section'] ) {
|
22 |
+
add_action( 'woocommerce_update_options_integration', array( $this, 'process_admin_options' ) );
|
23 |
+
}
|
24 |
+
|
25 |
+
add_action( 'woocommerce_product_options_reviews', array( $this, 'product_options' ) );
|
26 |
+
add_action( 'woocommerce_process_product_meta', array( $this, 'product_options_save' ), 10, 2 );
|
27 |
+
|
28 |
+
add_action( 'woocommerce_registration_redirect', array( $this, 'wc_redirect_url' ) );
|
29 |
+
add_action( 'template_redirect', array( $this, 'track_registration' ) );
|
30 |
+
add_action( 'wp_head', array( $this, 'code_handler' ) );
|
31 |
+
add_action( 'wp_footer', array( $this, 'code_handler' ) );
|
32 |
+
add_action( 'woocommerce_thankyou', array( $this, 'thankyou_page' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* WooCommerce settings API fields for storing our codes
|
37 |
+
*
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
+
function init_form_fields() {
|
41 |
+
$this->form_fields = array(
|
42 |
+
'position' => array(
|
43 |
+
'title' => __( 'Tags Position', 'woocommerce-conversion-tracking' ),
|
44 |
+
'description' => __( 'Select which position in your page you want to insert the tag', 'woocommerce-conversion-tracking' ),
|
45 |
+
'desc_tip' => true,
|
46 |
+
'id' => 'position',
|
47 |
+
'type' => 'select',
|
48 |
+
'options' => array(
|
49 |
+
'head' => /* translators: %s: tag name */
|
50 |
+
sprintf( __( 'Inside %s tag', 'woocommerce-conversion-tracking' ), 'head' ),
|
51 |
+
'footer' => /* translators: %s: tag name */
|
52 |
+
sprintf( __( 'Inside %s tag', 'woocommerce-conversion-tracking' ), 'body' )
|
53 |
+
)
|
54 |
+
),
|
55 |
+
'cart' => array(
|
56 |
+
'title' => sprintf( /* translators: %s: page name */
|
57 |
+
__( 'Tags for %s', 'woocommerce-conversion-tracking' ),
|
58 |
+
__( 'View Cart', 'woocommerce-conversion-tracking' )
|
59 |
+
),
|
60 |
+
'description' => __( 'Adds script on the cart page', 'woocommerce-conversion-tracking' ),
|
61 |
+
'desc_tip' => true,
|
62 |
+
'id' => 'cart',
|
63 |
+
'type' => 'textarea',
|
64 |
+
),
|
65 |
+
'checkout' => array(
|
66 |
+
'title' => sprintf( /* translators: %s: page name */
|
67 |
+
__( 'Tags for %s', 'woocommerce-conversion-tracking' ),
|
68 |
+
__( 'Successful Order', 'woocommerce-conversion-tracking' )
|
69 |
+
),
|
70 |
+
'desc_tip' => __( 'Adds script on the purchase success page', 'woocommerce-conversion-tracking' ),
|
71 |
+
'description' => sprintf( /* translators: %s: dynamic values */
|
72 |
+
__( 'You can use dynamic values: %s', 'woocommerce-conversion-tracking' ),
|
73 |
+
'<code>{customer_id}</code>, <code>{customer_email}</code>, <code>{customer_first_name}</code>, <code>{customer_last_name}</code>, <code>{order_number}</code>, <code>{order_total}</code>, <code>{order_subtotal}</code>, <code>{currency}</code>, <code>{payment_method}</code>'
|
74 |
+
),
|
75 |
+
'id' => 'checkout',
|
76 |
+
'type' => 'textarea',
|
77 |
+
),
|
78 |
+
'reg' => array(
|
79 |
+
'title' => sprintf( /* translators: %s: page name */
|
80 |
+
__( 'Tags for %s', 'woocommerce-conversion-tracking' ),
|
81 |
+
__( 'User Registration', 'woocommerce-conversion-tracking' )
|
82 |
+
),
|
83 |
+
'description' => __( 'Adds script on the successful registraion page', 'woocommerce-conversion-tracking' ),
|
84 |
+
'desc_tip' => true,
|
85 |
+
'id' => 'registration',
|
86 |
+
'type' => 'textarea',
|
87 |
+
),
|
88 |
+
);
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Save callback of Woo integration code settings API
|
93 |
+
*
|
94 |
+
* @param string $key
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
function validate_textarea_field( $key, $value ) {
|
98 |
+
$text = trim( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
99 |
+
|
100 |
+
return $text;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Saves tracking code of single product
|
105 |
+
*
|
106 |
+
* @uses woocommerce_process_product_meta
|
107 |
+
* @param int $post_id
|
108 |
+
*/
|
109 |
+
function product_options_save( $post_id ) {
|
110 |
+
|
111 |
+
if ( isset( $_POST['_wc_conv_track'] ) ) {
|
112 |
+
$value = trim( $_POST['_wc_conv_track'] );
|
113 |
+
update_post_meta( $post_id, '_wc_conv_track', $value );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Textarea input box on product page
|
119 |
+
*
|
120 |
+
* Creates new textarea on WooCommerce product advanced tab for storing
|
121 |
+
* conversion tracking pixel for single product
|
122 |
+
*
|
123 |
+
* @uses woocommerce_product_options_reviews
|
124 |
+
*/
|
125 |
+
function product_options() {
|
126 |
+
|
127 |
+
echo '<div class="options_group">';
|
128 |
+
|
129 |
+
woocommerce_wp_textarea_input(
|
130 |
+
array(
|
131 |
+
'id' => '_wc_conv_track',
|
132 |
+
'label' => __( 'Conversion Tracking Code', 'woocommerce-conversion-tracking' ),
|
133 |
+
'desc_tip' => true,
|
134 |
+
'description' => __( 'Insert conversion tracking code for this product.', 'woocommerce-conversion-tracking' )
|
135 |
+
. sprintf(
|
136 |
+
/* translators: %s: dynamic values */
|
137 |
+
__( 'You can use dynamic values: %s', 'woocommerce-conversion-tracking' ),
|
138 |
+
'<code>{customer_id}</code>, <code>{customer_email}</code>, <code>{customer_first_name}</code>, <code>{customer_last_name}</code>, <code>{order_number}</code>, <code>{order_total}</code>, <code>{order_subtotal}</code>, <code>{currency}</code>, <code>{payment_method}</code>'
|
139 |
+
)
|
140 |
+
)
|
141 |
+
);
|
142 |
+
|
143 |
+
echo '</div>';
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Print registration code when particular GET tag exists
|
148 |
+
*
|
149 |
+
* @uses add_action()
|
150 |
+
* @return void
|
151 |
+
*/
|
152 |
+
function track_registration() {
|
153 |
+
if ( isset( $_GET['_wc_user_reg'] ) && $_GET['_wc_user_reg'] == 'true' ) {
|
154 |
+
add_action( 'wp_head', array( $this, 'print_reg_code' ) );
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Adds a url query arg to determine newly registered user
|
160 |
+
*
|
161 |
+
* @uses woocommerce_registration_redirect action
|
162 |
+
* @param string $redirect
|
163 |
+
* @return string
|
164 |
+
*/
|
165 |
+
function wc_redirect_url( $redirect ) {
|
166 |
+
if ( wp_get_referer() ) {
|
167 |
+
$redirect = add_query_arg(
|
168 |
+
array(
|
169 |
+
'_wc_user_reg' => 'true'
|
170 |
+
), esc_url( wp_get_referer() )
|
171 |
+
);
|
172 |
+
} else {
|
173 |
+
$redirect = add_query_arg(
|
174 |
+
array(
|
175 |
+
'_wc_user_reg' => 'true'
|
176 |
+
), esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) )
|
177 |
+
);
|
178 |
+
}
|
179 |
+
|
180 |
+
return $redirect;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Code print handler on HEAD tag
|
185 |
+
*
|
186 |
+
* It prints conversion tracking pixels on cart page, order received page
|
187 |
+
* and single product page
|
188 |
+
*
|
189 |
+
* @uses wp_head
|
190 |
+
* @return void
|
191 |
+
*/
|
192 |
+
function code_handler() {
|
193 |
+
|
194 |
+
$position = $this->get_option( 'position', 'head' );
|
195 |
+
|
196 |
+
if ( 'wp_head' == current_filter() && $position != 'head' ) {
|
197 |
+
return;
|
198 |
+
} elseif ( 'wp_footer' == current_filter() && $position != 'footer' ) {
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( is_cart() ) {
|
203 |
+
|
204 |
+
echo $this->print_conversion_code( $this->get_option( 'cart' ) );
|
205 |
+
|
206 |
+
} elseif ( is_order_received_page() ) {
|
207 |
+
|
208 |
+
echo $this->print_conversion_code( $this->process_order_markdown( $this->get_option( 'checkout' ) ) );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Put product specific conversion tracking pixel in thank you page
|
214 |
+
*
|
215 |
+
* @param int $order_id
|
216 |
+
*
|
217 |
+
* @since 0.3
|
218 |
+
*
|
219 |
+
* @return void
|
220 |
+
*/
|
221 |
+
public function thankyou_page( $order_id ) {
|
222 |
+
$order = wc_get_order( $order_id );
|
223 |
+
|
224 |
+
if ( $items = $order->get_items() ) {
|
225 |
+
foreach ( $items as $item ) {
|
226 |
+
$product = $order->get_product_from_item( $item );
|
227 |
+
|
228 |
+
if ( ! $product ) {
|
229 |
+
continue;
|
230 |
+
}
|
231 |
+
|
232 |
+
$code = get_post_meta( $product->get_id(), '_wc_conv_track', true );
|
233 |
+
|
234 |
+
if ( empty( $code ) ) {
|
235 |
+
continue;
|
236 |
+
}
|
237 |
+
|
238 |
+
echo $this->print_conversion_code( $this->process_product_markdown( $code, $product ) );
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Registration code print handler
|
245 |
+
*
|
246 |
+
* @return void
|
247 |
+
*/
|
248 |
+
function print_reg_code() {
|
249 |
+
echo $this->print_conversion_code( $this->get_option( 'reg' ) );
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Prints the code
|
254 |
+
*
|
255 |
+
* @param string $code
|
256 |
+
*
|
257 |
+
* @return void
|
258 |
+
*/
|
259 |
+
function print_conversion_code( $code ) {
|
260 |
+
if ( $code == '' ) {
|
261 |
+
return;
|
262 |
+
}
|
263 |
+
|
264 |
+
echo "<!-- Tracking pixel by WooCommerce Conversion Tracking plugin by Tareq Hasan -->\n";
|
265 |
+
echo $code;
|
266 |
+
echo "\n<!-- Tracking pixel by WooCommerce Conversion Tracking plugin -->\n";
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Filter the code for dynamic data for order received page
|
271 |
+
*
|
272 |
+
* @since 1.1
|
273 |
+
*
|
274 |
+
* @param string $code
|
275 |
+
*
|
276 |
+
* @return string
|
277 |
+
*/
|
278 |
+
function process_order_markdown( $code ) {
|
279 |
+
global $wp;
|
280 |
+
|
281 |
+
if ( ! is_order_received_page() ) {
|
282 |
+
return $code;
|
283 |
+
}
|
284 |
+
|
285 |
+
$order = wc_get_order( $wp->query_vars['order-received'] );
|
286 |
+
|
287 |
+
// bail out if not a valid instance
|
288 |
+
if ( ! is_a( $order, 'WC_Order' ) ) {
|
289 |
+
return $code;
|
290 |
+
}
|
291 |
+
|
292 |
+
if ( version_compare( WC()->version, '3.0', '<' ) ) {
|
293 |
+
// older version
|
294 |
+
$order_currency = $order->get_order_currency();
|
295 |
+
$payment_method = $order->payment_method;
|
296 |
+
|
297 |
+
} else {
|
298 |
+
$order_currency = $order->get_currency();
|
299 |
+
$payment_method = $order->get_payment_method();
|
300 |
+
}
|
301 |
+
|
302 |
+
$customer = $order->get_user();
|
303 |
+
$used_coupons = $order->get_used_coupons() ? implode( ',', $order->get_used_coupons() ) : '';
|
304 |
+
$order_currency = $order_currency;
|
305 |
+
$order_total = $order->get_total();
|
306 |
+
$order_number = $order->get_order_number();
|
307 |
+
$order_subtotal = $order->get_subtotal();
|
308 |
+
|
309 |
+
// customer details
|
310 |
+
if ( $customer ) {
|
311 |
+
$code = str_replace( '{customer_id}', $customer->ID, $code );
|
312 |
+
$code = str_replace( '{customer_email}', $customer->user_email, $code );
|
313 |
+
$code = str_replace( '{customer_first_name}', $customer->first_name, $code );
|
314 |
+
$code = str_replace( '{customer_last_name}', $customer->last_name, $code );
|
315 |
+
}
|
316 |
+
|
317 |
+
// order details
|
318 |
+
$code = str_replace( '{used_coupons}', $used_coupons, $code );
|
319 |
+
$code = str_replace( '{payment_method}', $payment_method, $code );
|
320 |
+
$code = str_replace( '{currency}', $order_currency, $code );
|
321 |
+
$code = str_replace( '{order_total}', $order_total, $code );
|
322 |
+
$code = str_replace( '{order_number}', $order_number, $code );
|
323 |
+
$code = str_replace( '{order_subtotal}', $order_subtotal, $code );
|
324 |
+
|
325 |
+
return $code;
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Filter the code for dynamic data for products
|
330 |
+
*
|
331 |
+
* @since 1.1
|
332 |
+
*
|
333 |
+
* @param string $code
|
334 |
+
*
|
335 |
+
* @return string
|
336 |
+
*/
|
337 |
+
function process_product_markdown( $code, $product ) {
|
338 |
+
$price = $product->get_price();
|
339 |
+
$sale_price = $product->get_sale_price();
|
340 |
+
$regular_price = $product->get_regular_price();
|
341 |
+
$price_excluding_tax = $product->get_price_excluding_tax();
|
342 |
+
$price_including_tax = $product->get_price_including_tax();
|
343 |
+
|
344 |
+
$code = str_replace( '{product_name}', $product->get_title(), $code );
|
345 |
+
$code = str_replace( '{price}', $price, $code );
|
346 |
+
$code = str_replace( '{sale_price}', $sale_price, $code );
|
347 |
+
$code = str_replace( '{regular_price}', $regular_price, $code );
|
348 |
+
$code = str_replace( '{price_including_tax}', $price_including_tax, $code );
|
349 |
+
$code = str_replace( '{price_excluding_tax}', $price_excluding_tax, $code );
|
350 |
+
|
351 |
+
return $code;
|
352 |
+
}
|
353 |
+
|
354 |
+
}
|
includes/integrations/class-integration-custom.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WCCT gate way custom
|
5 |
+
*/
|
6 |
+
class WCCT_Integration_Custom extends WCCT_Integration {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor for WC_Conversion_Tracking_Gateway_Custom class
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
$this->id = 'custom';
|
13 |
+
$this->name = __( 'Custom', 'woocommerce-conversion-tracking' );
|
14 |
+
$this->enabled = true;
|
15 |
+
$this->supports = array(
|
16 |
+
'checkout',
|
17 |
+
'registration'
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get settings integration
|
23 |
+
*
|
24 |
+
* @return array
|
25 |
+
*/
|
26 |
+
public function get_settings() {
|
27 |
+
$settings = array(
|
28 |
+
array(
|
29 |
+
'type' => 'textarea',
|
30 |
+
'name' => 'checkout',
|
31 |
+
'label' => __( 'Successful Order', 'woocommerce-conversion-tracking' ),
|
32 |
+
'value' => '',
|
33 |
+
'help' => sprintf( /* translators: %s: dynamic values */
|
34 |
+
__( 'Put your JavaScript tracking scripts here. You can use dynamic values: %s', 'woocommerce-conversion-tracking' ),
|
35 |
+
'<code>{customer_id}</code>, <code>{customer_email}</code>, <code>{customer_first_name}</code>, <code>{customer_last_name}</code>, <code>{order_number}</code>, <code>{order_total}</code>, <code>{order_subtotal}</code>, <code>{currency}</code>, <code>{payment_method}</code>'
|
36 |
+
),
|
37 |
+
),
|
38 |
+
array(
|
39 |
+
'type' => 'textarea',
|
40 |
+
'name' => 'registration',
|
41 |
+
'label' => __( 'Registration Scripts', 'woocommerce-conversion-tracking' ),
|
42 |
+
'value' => '',
|
43 |
+
'help' => sprintf( __( '<a href="%s" target="_blank">Learn more</a> about setting up custom scripts.' ), 'https://wedevs.com/docs/woocommerce-conversion-tracking/custom/?utm_source=wp-admin&utm_medium=inline-helpk&utm_campaign=wcct_docs&utm_content=Custom' )
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
return $settings;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Enqueue script
|
52 |
+
*
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
public function enqueue_script() {
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Check Out
|
61 |
+
*
|
62 |
+
* @return void
|
63 |
+
*/
|
64 |
+
public function checkout( $order_id ) {
|
65 |
+
if ( ! $this->is_enabled() ) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
$code = $this->get_integration_settings();
|
70 |
+
|
71 |
+
if ( isset( $code['checkout'] ) && ! empty( $code['checkout'] ) ) {
|
72 |
+
echo $this->process_order_markdown( $code['checkout'], $order_id );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Registration
|
78 |
+
*
|
79 |
+
* @return void
|
80 |
+
*/
|
81 |
+
public function registration() {
|
82 |
+
if ( $this->is_enabled() ) {
|
83 |
+
|
84 |
+
$code = $this->get_integration_settings();
|
85 |
+
|
86 |
+
if ( isset( $code['registration'] ) && ! empty( $code['registration'] ) ) {
|
87 |
+
echo $code['registration'] ;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Filter the code for dynamic data for order received page
|
94 |
+
*
|
95 |
+
* @since 1.1
|
96 |
+
*
|
97 |
+
* @param string $code
|
98 |
+
*
|
99 |
+
* @return string
|
100 |
+
*/
|
101 |
+
function process_order_markdown( $code, $order_id ) {
|
102 |
+
|
103 |
+
$order = wc_get_order( $order_id );
|
104 |
+
|
105 |
+
// bail out if not a valid instance
|
106 |
+
if ( ! is_a( $order, 'WC_Order' ) ) {
|
107 |
+
return $code;
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( version_compare( WC()->version, '3.0', '<' ) ) {
|
111 |
+
// older version
|
112 |
+
$order_currency = $order->get_order_currency();
|
113 |
+
$payment_method = $order->payment_method;
|
114 |
+
|
115 |
+
} else {
|
116 |
+
$order_currency = $order->get_currency();
|
117 |
+
$payment_method = $order->get_payment_method();
|
118 |
+
}
|
119 |
+
|
120 |
+
$customer = $order->get_user();
|
121 |
+
$used_coupons = $order->get_used_coupons() ? implode( ',', $order->get_used_coupons() ) : '';
|
122 |
+
$order_currency = $order_currency;
|
123 |
+
$order_total = $order->get_total();
|
124 |
+
$order_number = $order->get_order_number();
|
125 |
+
$order_subtotal = $order->get_subtotal();
|
126 |
+
|
127 |
+
// customer details
|
128 |
+
if ( $customer ) {
|
129 |
+
$code = str_replace( '{customer_id}', $customer->ID, $code );
|
130 |
+
$code = str_replace( '{customer_email}', $customer->user_email, $code );
|
131 |
+
$code = str_replace( '{customer_first_name}', $customer->first_name, $code );
|
132 |
+
$code = str_replace( '{customer_last_name}', $customer->last_name, $code );
|
133 |
+
}
|
134 |
+
|
135 |
+
// order details
|
136 |
+
$code = str_replace( '{used_coupons}', $used_coupons, $code );
|
137 |
+
$code = str_replace( '{payment_method}', $payment_method, $code );
|
138 |
+
$code = str_replace( '{currency}', $order_currency, $code );
|
139 |
+
$code = str_replace( '{order_total}', $order_total, $code );
|
140 |
+
$code = str_replace( '{order_number}', $order_number, $code );
|
141 |
+
$code = str_replace( '{order_subtotal}', $order_subtotal, $code );
|
142 |
+
|
143 |
+
return $code;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
return new WCCT_Integration_Custom();
|
includes/integrations/class-integration-facebook.php
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WCCT gate way facebook
|
5 |
+
*/
|
6 |
+
class WCCT_Integration_Facebook extends WCCT_Integration {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor for WC_Conversion_Tracking_Gateway_Facebook
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
$this->id = 'facebook';
|
13 |
+
$this->name = __( 'Facebook', 'woocommerce-conversion-tracking' );
|
14 |
+
$this->enabled = true;
|
15 |
+
$this->supports = array(
|
16 |
+
'add_to_cart',
|
17 |
+
'checkout',
|
18 |
+
'initiate_checkout',
|
19 |
+
'registration',
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get Settings
|
25 |
+
*
|
26 |
+
* @return array
|
27 |
+
*/
|
28 |
+
public function get_settings() {
|
29 |
+
$settings = array(
|
30 |
+
'id' => array(
|
31 |
+
'type' => 'text',
|
32 |
+
'name' => 'pixel_id',
|
33 |
+
'label' => __( 'Pixel ID', 'woocommerce-conversion-tracking' ),
|
34 |
+
'required' => true,
|
35 |
+
'value' => '',
|
36 |
+
'help' => sprintf( __( 'Find the Pixel ID from <a href="%s" target="_blank">here</a>.', 'woocommerce-conversion-tracking' ), 'https://www.facebook.com/ads/manager/pixel/facebook_pixel' )
|
37 |
+
),
|
38 |
+
'events' => array(
|
39 |
+
'type' => 'multicheck',
|
40 |
+
'name' => 'events',
|
41 |
+
'label' => __( 'Events', 'woocommerce-conversion-tracking' ),
|
42 |
+
'value' => '',
|
43 |
+
'options' => array(
|
44 |
+
'AddToCart' => __( 'Add to Cart', 'woocommerce-conversion-tracking' ),
|
45 |
+
'InitiateCheckout' => __( 'Initiate Checkout', 'woocommerce-conversion-tracking' ),
|
46 |
+
'Purchase' => __( 'Purchase', 'woocommerce-conversion-tracking' ),
|
47 |
+
'Registration' => __( 'Complete Registration', 'woocommerce-conversion-tracking' )
|
48 |
+
)
|
49 |
+
),
|
50 |
+
);
|
51 |
+
|
52 |
+
return apply_filters( 'wcct_settings_fb', $settings );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Build the event object
|
57 |
+
*
|
58 |
+
* @param string $event_name
|
59 |
+
* @param array $params
|
60 |
+
* @param string $method
|
61 |
+
*
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
public function build_event( $event_name, $params = array(), $method = 'track' ) {
|
65 |
+
return sprintf( "fbq('%s', '%s', %s);", $method, $event_name, json_encode( $params, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT ) );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Enqueue script
|
70 |
+
*
|
71 |
+
* @return void
|
72 |
+
*/
|
73 |
+
public function enqueue_script() {
|
74 |
+
|
75 |
+
if ( ! $this->is_enabled() ) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
$integration_settins = $this->get_integration_settings();
|
80 |
+
$facebook_pixel_id = ! empty( $integration_settins[0]['pixel_id'] ) ? $integration_settins[0]['pixel_id'] : '';
|
81 |
+
?>
|
82 |
+
<script>
|
83 |
+
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
84 |
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
|
85 |
+
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
|
86 |
+
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
|
87 |
+
document,'script','https://connect.facebook.net/en_US/fbevents.js');
|
88 |
+
|
89 |
+
<?php
|
90 |
+
if ( is_user_logged_in() ) {
|
91 |
+
$user_email = wp_get_current_user()->user_email;
|
92 |
+
|
93 |
+
echo $this->build_event( $facebook_pixel_id, array( 'em' => $user_email ), 'init' );
|
94 |
+
} else {
|
95 |
+
echo $this->build_event( $facebook_pixel_id, array(), 'init' );
|
96 |
+
}
|
97 |
+
|
98 |
+
echo $this->build_event( 'PageView', array() );
|
99 |
+
?>
|
100 |
+
</script>
|
101 |
+
|
102 |
+
<noscript><img height="1" width="1" style="display:none"
|
103 |
+
src="https://www.facebook.com/tr?id=<?php echo $facebook_pixel_id; ?>&ev=PageView&noscript=1"
|
104 |
+
/></noscript>
|
105 |
+
<?php
|
106 |
+
|
107 |
+
$this->add_to_cart_ajax();
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Enqueue add to cart event
|
112 |
+
*
|
113 |
+
* @return void
|
114 |
+
*/
|
115 |
+
public function add_to_cart() {
|
116 |
+
|
117 |
+
if ( ! $this->event_enabled( 'AddToCart' ) ) {
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
$product_ids = $this->get_content_ids_from_cart( WC()->cart->get_cart() );
|
122 |
+
|
123 |
+
$code = $this->build_event( 'AddToCart', array(
|
124 |
+
'content_ids' => json_encode( $product_ids ),
|
125 |
+
'content_type' => 'product',
|
126 |
+
'value' => WC()->cart->total,
|
127 |
+
'currency' => get_woocommerce_currency()
|
128 |
+
) );
|
129 |
+
|
130 |
+
wc_enqueue_js( $code );
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Added to cart
|
135 |
+
*
|
136 |
+
* @return void
|
137 |
+
*/
|
138 |
+
public function add_to_cart_ajax() {
|
139 |
+
if ( ! $this->event_enabled( 'AddToCart' ) ) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
<script type="text/javascript">
|
144 |
+
jQuery(function($) {
|
145 |
+
$(document).on('added_to_cart', function (event, fragments, hash, button) {
|
146 |
+
fbq('track', 'AddToCart', {
|
147 |
+
content_ids: [ $(button).data('product_id') ],
|
148 |
+
content_type: 'product',
|
149 |
+
});
|
150 |
+
});
|
151 |
+
});
|
152 |
+
</script>
|
153 |
+
<?php
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Fire initiate checkout events
|
158 |
+
*
|
159 |
+
* @return void
|
160 |
+
*/
|
161 |
+
public function initiate_checkout() {
|
162 |
+
if ( ! $this->event_enabled( 'InitiateCheckout' ) ) {
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
|
166 |
+
$product_ids = $this->get_content_ids_from_cart( WC()->cart->get_cart() );
|
167 |
+
|
168 |
+
$code = $this->build_event( 'InitiateCheckout', array(
|
169 |
+
'num_items' => WC()->cart->get_cart_contents_count(),
|
170 |
+
'content_ids' => json_encode( $product_ids ),
|
171 |
+
'content_type' => 'product',
|
172 |
+
'value' => WC()->cart->total,
|
173 |
+
'currency' => get_woocommerce_currency()
|
174 |
+
) );
|
175 |
+
|
176 |
+
wc_enqueue_js( $code );
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Check Out
|
181 |
+
*
|
182 |
+
* @param integer $order_id
|
183 |
+
*
|
184 |
+
* @return void
|
185 |
+
*/
|
186 |
+
public function checkout( $order_id ) {
|
187 |
+
if ( ! $this->event_enabled( 'Purchase' ) ) {
|
188 |
+
return;
|
189 |
+
}
|
190 |
+
|
191 |
+
$order = new WC_Order( $order_id );
|
192 |
+
$content_type = 'product';
|
193 |
+
$product_ids = array();
|
194 |
+
|
195 |
+
foreach ( $order->get_items() as $item ) {
|
196 |
+
$product = wc_get_product( $item['product_id'] );
|
197 |
+
|
198 |
+
$product_ids[] = $product->get_id();
|
199 |
+
|
200 |
+
if ( $product->get_type() === 'variable' ) {
|
201 |
+
$content_type = 'product_group';
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
$code = $this->build_event( 'Purchase', array(
|
206 |
+
'content_ids' => json_encode($product_ids),
|
207 |
+
'content_type' => $content_type,
|
208 |
+
'value' => $order->get_total(),
|
209 |
+
'currency' => get_woocommerce_currency()
|
210 |
+
) );
|
211 |
+
|
212 |
+
wc_enqueue_js( $code );
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Registration script
|
217 |
+
*
|
218 |
+
* @return void
|
219 |
+
*/
|
220 |
+
public function registration() {
|
221 |
+
if ( ! $this->event_enabled( 'Registration' ) ) {
|
222 |
+
return;
|
223 |
+
}
|
224 |
+
|
225 |
+
$code = $this->build_event( 'CompleteRegistration' );
|
226 |
+
wc_enqueue_js( $code );
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Return categories for products/pixel
|
231 |
+
*
|
232 |
+
* @param string $id
|
233 |
+
*
|
234 |
+
* @return array
|
235 |
+
*/
|
236 |
+
public function get_product_categories( $product_id ) {
|
237 |
+
$category_path = wp_get_post_terms( $product_id, 'product_cat', array( 'fields' => 'all' ) );
|
238 |
+
$content_category = array_values( array_map( function($item) {
|
239 |
+
return $item->name;
|
240 |
+
}, $category_path ) );
|
241 |
+
|
242 |
+
$content_category_slice = array_slice( $content_category, -1 );
|
243 |
+
$categories = empty( $content_category ) ? '""' : implode(', ', $content_category);
|
244 |
+
|
245 |
+
return array(
|
246 |
+
'name' => array_pop( $content_category_slice ),
|
247 |
+
'categories' => $categories
|
248 |
+
);
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
return new WCCT_Integration_Facebook();
|
includes/integrations/class-integration-google.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WCCT gate way google
|
5 |
+
*/
|
6 |
+
class WCCT_Integration_Google extends WCCT_Integration {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor for WC_Conversion_Tracking_Gateway_Google
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
$this->id = 'adwords';
|
13 |
+
$this->name = __( 'Google Adwords', 'woocommerce-conversion-tracking' );
|
14 |
+
$this->enabled = true;
|
15 |
+
$this->supports = array(
|
16 |
+
'checkout',
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get settings
|
22 |
+
*
|
23 |
+
* @return array
|
24 |
+
*/
|
25 |
+
public function get_settings() {
|
26 |
+
$settings = array(
|
27 |
+
'id' => array(
|
28 |
+
'type' => 'text',
|
29 |
+
'name' => 'account_id',
|
30 |
+
'label' => __( 'Account ID', 'woocommerce-conversion-tracking' ),
|
31 |
+
'value' => '',
|
32 |
+
'placeholder' => 'AW-123456789',
|
33 |
+
'help' => sprintf( __( 'Provide the AdWords Account ID. Usually it\'s something like <code>AW-123456789</code>, <a href="%s" target="_blank">learn more</a>.', 'woocommerce-conversion-tracking' ), 'https://wedevs.com/docs/woocommerce-conversion-tracking/google-adwords/account-id/?utm_source=wp-admin&utm_medium=inline-help&utm_campaign=wcct_docs&utm_content=adwords_learn_more' )
|
34 |
+
),
|
35 |
+
'events' => array(
|
36 |
+
'type' => 'multicheck',
|
37 |
+
'name' => 'events',
|
38 |
+
'label' => __( 'Events', 'woocommerce-conversion-tracking' ),
|
39 |
+
'value' => '',
|
40 |
+
'options' => array(
|
41 |
+
'Purchase' => array(
|
42 |
+
'event_label_box' => true,
|
43 |
+
'label' => __( 'Purchase', 'woocommerce-conversion-tracking' ),
|
44 |
+
'label_name' => 'Purchase-label',
|
45 |
+
'placeholder' => 'Add Your Purchase Label'
|
46 |
+
),
|
47 |
+
)
|
48 |
+
),
|
49 |
+
);
|
50 |
+
|
51 |
+
return apply_filters( 'wcct_settings_adwords', $settings );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Build the event object
|
56 |
+
*
|
57 |
+
* @param string $event_name
|
58 |
+
* @param array $params
|
59 |
+
* @param string $method
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function build_event( $event_name, $params = array(), $method = 'event' ) {
|
64 |
+
return sprintf( "gtag('%s', '%s', %s);", $method, $event_name, json_encode( $params, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES ) );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Enqueue script
|
69 |
+
*
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function enqueue_script() {
|
73 |
+
if ( ! $this->is_enabled() ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
$settings = $this->get_integration_settings();
|
78 |
+
$account_id = ! empty( $settings[0]['account_id'] ) ? $settings[0]['account_id'] : '';
|
79 |
+
|
80 |
+
if ( empty( $account_id ) ) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
?>
|
84 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo $account_id; ?>"></script>
|
85 |
+
<script>
|
86 |
+
window.dataLayer = window.dataLayer || [];
|
87 |
+
function gtag(){dataLayer.push(arguments)};
|
88 |
+
gtag('js', new Date());
|
89 |
+
|
90 |
+
gtag('config', '<?php echo $account_id; ?>');
|
91 |
+
</script>
|
92 |
+
<?php
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Check Out google adwords
|
97 |
+
*
|
98 |
+
* @return void
|
99 |
+
*/
|
100 |
+
public function checkout( $order_id ) {
|
101 |
+
if ( ! $this->event_enabled( 'Purchase' ) ) {
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
|
105 |
+
$settings = $this->get_integration_settings();
|
106 |
+
$account_id = isset( $settings[0]['account_id'] ) ? $settings[0]['account_id'] : '';
|
107 |
+
$label = isset( $settings[0]['events']['Purchase-label'] ) ? $settings[0]['events']['Purchase-label'] : '';
|
108 |
+
|
109 |
+
if ( empty( $account_id ) || empty( $label ) ) {
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
|
113 |
+
$order = new WC_Order( $order_id );
|
114 |
+
|
115 |
+
$code = $this->build_event( 'conversion', array(
|
116 |
+
'send_to' => sprintf( "%s/%s", $account_id, $label ),
|
117 |
+
'transaction_id' => $order_id,
|
118 |
+
'value' => $order->get_total(),
|
119 |
+
'currency' => get_woocommerce_currency()
|
120 |
+
) );
|
121 |
+
|
122 |
+
wc_enqueue_js( $code );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
return new WCCT_Integration_Google();
|
includes/integrations/class-integration-twitter.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WCCT gate way twitter
|
5 |
+
*/
|
6 |
+
class WCCT_Integration_Twitter extends WCCT_Integration {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor for WC_Conversion_Tracking_Gateway_Twitter class
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
$this->id = 'twitter';
|
13 |
+
$this->name = __( 'Twitter', 'woocommerce-conversion-tracking' );
|
14 |
+
$this->enabled = true;
|
15 |
+
$this->supports = array(
|
16 |
+
'checkout',
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get settings
|
22 |
+
*
|
23 |
+
* @return array
|
24 |
+
*/
|
25 |
+
public function get_settings() {
|
26 |
+
$settings = array(
|
27 |
+
|
28 |
+
'events' => array(
|
29 |
+
'type' => 'multicheck',
|
30 |
+
'name' => 'events',
|
31 |
+
'label' => __( 'Events', 'woocommerce-conversion-tracking' ),
|
32 |
+
'value' => '',
|
33 |
+
'options' => array(
|
34 |
+
'Purchase' => array(
|
35 |
+
'event_label_box' => true,
|
36 |
+
'label' => __( 'Purchase', 'woocommerce-conversion-tracking' ),
|
37 |
+
'label_name' => 'universal_tag_id',
|
38 |
+
'placeholder' => 'Universal Tag ID',
|
39 |
+
'help' => sprintf( __( 'Find the Universal Tag ID from <a href="%s" target="_blank">here</a>, navigate to Tools → Conversion Tracking.', 'woocommerce-conversion-tracking' ), 'https://ads.twitter.com/' )
|
40 |
+
),
|
41 |
+
)
|
42 |
+
),
|
43 |
+
);
|
44 |
+
|
45 |
+
return apply_filters( 'wcct_settings_twitter', $settings );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Build the event object
|
50 |
+
*
|
51 |
+
* @param string $event_name
|
52 |
+
* @param array $params
|
53 |
+
* @param string $method
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public function build_event( $event_name, $params = array(), $method = 'track' ) {
|
58 |
+
return sprintf( "twq('%s', '%s', %s);", $method, $event_name, json_encode( $params, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT ) );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Enqueue script
|
63 |
+
*
|
64 |
+
* @return void
|
65 |
+
*/
|
66 |
+
public function enqueue_script() {
|
67 |
+
if ( ! $this->is_enabled() ) {
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
$integration_settins = $this->get_integration_settings();
|
72 |
+
$universal_tag_id = ! empty( $integration_settins[0]['events']['universal_tag_id'] ) ? $integration_settins[0]['events']['universal_tag_id'] : '';
|
73 |
+
$advance_event = ( isset( $integration_settins[0]['events']['AddToCart'] ) ||isset( $integration_settins[0]['events']['Registration'] ) ) ? true : false;
|
74 |
+
?>
|
75 |
+
<script type="text/javascript">
|
76 |
+
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
|
77 |
+
|
78 |
+
<?php echo $this->build_event( $universal_tag_id, array(), 'init' ); ?>
|
79 |
+
<?php echo $this->build_event( 'PageView' ); ?>
|
80 |
+
</script>
|
81 |
+
|
82 |
+
<?php if ( $advance_event ): ?>
|
83 |
+
<script src="//platform.twitter.com/oct.js" type="text/javascript"></script>
|
84 |
+
<?php endif;?>
|
85 |
+
<?php
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Check Out
|
90 |
+
*
|
91 |
+
* @param integer $order_id
|
92 |
+
*
|
93 |
+
* @return void
|
94 |
+
*/
|
95 |
+
public function checkout( $order_id ) {
|
96 |
+
if ( ! $this->event_enabled( 'Purchase' ) ) {
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
$order = new WC_Order( $order_id );
|
101 |
+
$content_type = 'product';
|
102 |
+
$product_ids = array();
|
103 |
+
|
104 |
+
foreach ( $order->get_items() as $item ) {
|
105 |
+
$product = wc_get_product( $item['product_id'] );
|
106 |
+
|
107 |
+
$product_ids[] = $product->get_id();
|
108 |
+
|
109 |
+
if ( $product->get_type() === 'variable' ) {
|
110 |
+
$content_type = 'product_group';
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
$code = $this->build_event( 'Purchase', array(
|
115 |
+
'content_ids' => json_encode($product_ids),
|
116 |
+
'content_type' => $content_type,
|
117 |
+
'value' => $order->get_total(),
|
118 |
+
'currency' => get_woocommerce_currency()
|
119 |
+
) );
|
120 |
+
|
121 |
+
wc_enqueue_js( $code );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
return new WCCT_Integration_Twitter();
|
includes/upgrades/upgrade-2.0.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Change Conversion tracking option key
|
5 |
+
*
|
6 |
+
* @return void
|
7 |
+
*/
|
8 |
+
function wcct_upgrade_2_0_change_option_key() {
|
9 |
+
$wcct_settings = get_option( 'woocommerce_wc_conv_tracking_settings' );
|
10 |
+
|
11 |
+
if ( ! $wcct_settings ) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
$change_settings['custom'] = array(
|
16 |
+
'enabled' => 1,
|
17 |
+
'cart' => $wcct_settings['cart'],
|
18 |
+
'checkout' => $wcct_settings['checkout'],
|
19 |
+
'registration' => $wcct_settings['reg'],
|
20 |
+
);
|
21 |
+
|
22 |
+
update_option( 'wcct_settings', $change_settings['custom'] );
|
23 |
+
update_option( '_wcct_20_notice_dismiss', false );
|
24 |
+
|
25 |
+
// redirect transient
|
26 |
+
set_transient( 'wcct_upgrade_to_20', true, MINUTE_IN_SECONDS );
|
27 |
+
}
|
28 |
+
|
29 |
+
wcct_upgrade_2_0_change_option_key();
|
includes/views/admin.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap wcct-admin">
|
2 |
+
|
3 |
+
<?php do_action( 'wcct_before_nav' ); ?>
|
4 |
+
|
5 |
+
<?php
|
6 |
+
$this->show_navigation();
|
7 |
+
$tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'integrations';
|
8 |
+
?>
|
9 |
+
<div id="ajax-message" class="updated inline" style="display: none; margin-bottom:35px"></div>
|
10 |
+
<?php
|
11 |
+
if ( $tab == 'integrations' ) {
|
12 |
+
include WCCT_INCLUDES . '/views/settings.php';
|
13 |
+
} else {
|
14 |
+
do_action( 'wcct_nav_content_'.$tab );
|
15 |
+
}
|
16 |
+
?>
|
17 |
+
</div>
|
includes/views/settings.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wcct-two-column">
|
2 |
+
|
3 |
+
<div class="settings-wrap">
|
4 |
+
|
5 |
+
<h2><?php _e( 'Integration Settings', 'woocommerce-conversion-tracking' ); ?></h2>
|
6 |
+
|
7 |
+
<form action="" method="POST" id="integration-form">
|
8 |
+
<?php
|
9 |
+
foreach ( $integrations as $int_key => $integration ) {
|
10 |
+
$name = $integration->get_name();
|
11 |
+
$id = $integration->get_id();
|
12 |
+
$settings_fields = $integration->get_settings();
|
13 |
+
$settings = $integration->get_integration_settings();
|
14 |
+
$active = ( $integration->is_enabled() ) ? 'Deactivate' : 'Activate';
|
15 |
+
$border = ( isset( $integration->multiple ) ) ? 'wcct-border' : '';
|
16 |
+
?>
|
17 |
+
<div class="integration-wrap">
|
18 |
+
<div class="integration-name">
|
19 |
+
<div class="gateway">
|
20 |
+
<img src="<?php echo plugins_url( 'assets/images/'. $id .'.png', WCCT_FILE )?>" alt="" class="doc-list-icon">
|
21 |
+
|
22 |
+
<h3 class="gateway-text"><?php echo $name; ?></h3>
|
23 |
+
|
24 |
+
<label class="switch" title="" data-original-title="Make Inactive">
|
25 |
+
<input type="checkbox" class="toogle-seller" name="settings[<?php echo $id; ?>][enabled]" id="integration-<?php echo $id; ?>" data-id="<?php echo $id; ?>" value="1" <?php checked( true, $integration->is_enabled() ); ?> >
|
26 |
+
<span class="slider round wcct-tooltip" data-id="<?php echo $id; ?>">
|
27 |
+
<span class="wcct-tooltiptext integration-tooltip"><?php echo $active; ?> </span>
|
28 |
+
</span>
|
29 |
+
</label>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
|
33 |
+
<div class="integration-settings" id="setting-<?php echo $id; ?>">
|
34 |
+
<?php
|
35 |
+
if ( ! $settings_fields ) {
|
36 |
+
continue;
|
37 |
+
}
|
38 |
+
?>
|
39 |
+
<div class="wc-ct-form-group <?php echo $border ?>">
|
40 |
+
<table class="form-table custom-table" style="display: inline;">
|
41 |
+
<?php foreach ( $settings_fields as $key => $field ) {?>
|
42 |
+
<tr>
|
43 |
+
<th>
|
44 |
+
<label for="<?php echo $id . '-' . $field['label']; ?>"><?php echo $field['label']; ?></label>
|
45 |
+
</th>
|
46 |
+
<td>
|
47 |
+
<?php
|
48 |
+
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
49 |
+
|
50 |
+
switch ( $field['type'] ) {
|
51 |
+
case 'text':
|
52 |
+
$value = isset( $settings[0][ $field['name'] ] ) ? $settings[0][ $field['name'] ] : '';
|
53 |
+
printf( '<input type="text" name="settings[%s][%d][%s]" placeholder="%s" value="%s" id="%s" required >', $id,0, $field['name'], $placeholder, $value, $id . '-' . $field['name'] );
|
54 |
+
break;
|
55 |
+
|
56 |
+
case 'textarea':
|
57 |
+
$value = isset( $settings[ $field['name'] ] ) ? $settings[ $field['name'] ] : '';
|
58 |
+
printf( '<textarea type="text" name="settings[%s][%s]" placeholder="%s" id="%s" cols="30" rows="3">%s</textarea>', $id, $field['name'], $placeholder, $id . '-' . $field['name'], $value );
|
59 |
+
break;
|
60 |
+
|
61 |
+
case 'checkbox':
|
62 |
+
$value = isset( $settings[ $field['name'] ] ) ? $settings[ $field['name'] ] : 'off';
|
63 |
+
printf( '<label for="%5$s"><input type="checkbox" name="settings[%1$s][%2$s]" %3$s id="%5$s" value="on"> %4$s</label>', $id, $field['name'], checked( 'on', $value, false ), $field['description'], $id . '-' . $field['name'] );
|
64 |
+
break;
|
65 |
+
|
66 |
+
case 'multicheck':
|
67 |
+
?>
|
68 |
+
<div class="wc-ct-option">
|
69 |
+
<?php
|
70 |
+
foreach ( $field['options'] as $key => $option ) {
|
71 |
+
$field_name = $field['name'];
|
72 |
+
|
73 |
+
$checked = isset( $settings[0][ $field_name ][ $key ] ) ? 'on' : '';
|
74 |
+
$disabled = isset( $option['profeature'] ) ? 'disabled' : '';
|
75 |
+
$class = isset( $option['profeature'] ) ? 'disabled-class' : '';
|
76 |
+
$feature = isset( $option['profeature'] ) ? ' (Pro-feature)' : '';
|
77 |
+
?>
|
78 |
+
<label for="<?php echo $id . '-' . $key; ?>" class="<?php echo $class?>">
|
79 |
+
<input type="checkbox" name="settings[<?php echo $id; ?>][0][<?php echo $field_name; ?>][<?php echo $key; ?>]" <?php checked( 'on', $checked ); ?> id="<?php echo $id . '-' . $key; ?>" class="event <?php echo $class;?>" <?php echo $disabled ?>>
|
80 |
+
<?php
|
81 |
+
|
82 |
+
$label = isset( $option['label'] ) ? $option['label'] : $option;
|
83 |
+
echo $label . $feature;
|
84 |
+
|
85 |
+
$input_box = isset( $option['event_label_box'] ) ?: false;
|
86 |
+
|
87 |
+
$name = isset( $option['label_name'] ) ? $option['label_name'] : '';
|
88 |
+
$placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : '';
|
89 |
+
$value = isset( $settings[0][ $field_name ][ $name ] ) ? $settings[0][ $field_name ][ $name ] : '';
|
90 |
+
|
91 |
+
if ( $input_box ) {
|
92 |
+
?>
|
93 |
+
<div class="event-label-box">
|
94 |
+
<input type="text" name="settings[<?php echo $id; ?>][0][<?php echo $field_name; ?>][<?php echo $name; ?>]" class="" placeholder="<?php echo $placeholder; ?>" value="<?php echo $value ?>">
|
95 |
+
<?php
|
96 |
+
|
97 |
+
if ( isset( $option['help'] ) && ! empty( $option['help'] ) ) {
|
98 |
+
echo '<p class="help">' . $option['help'] . '</p>';
|
99 |
+
}
|
100 |
+
?>
|
101 |
+
</div>
|
102 |
+
<?php
|
103 |
+
}
|
104 |
+
?>
|
105 |
+
<?php
|
106 |
+
?>
|
107 |
+
</label>
|
108 |
+
<br>
|
109 |
+
<?php
|
110 |
+
}
|
111 |
+
?>
|
112 |
+
</div>
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( isset( $field['help'] ) && ! empty( $field['help'] ) ) {
|
117 |
+
echo '<p class="help">' . $field['help'] . '</p>';
|
118 |
+
}
|
119 |
+
?>
|
120 |
+
</td>
|
121 |
+
</tr>
|
122 |
+
<?php } ?>
|
123 |
+
</table>
|
124 |
+
</div>
|
125 |
+
<?php
|
126 |
+
|
127 |
+
do_action( 'wcct_integration_' . $id, $integration );
|
128 |
+
?>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
|
132 |
+
<?php
|
133 |
+
}
|
134 |
+
?>
|
135 |
+
<div class="submit-area">
|
136 |
+
<?php wp_nonce_field( 'wcct-settings' ); ?>
|
137 |
+
<input type="hidden" name="action" value="wcct_save_settings">
|
138 |
+
|
139 |
+
<button class="button button-primary" id="wcct-submit">Save Changes</button>
|
140 |
+
</div>
|
141 |
+
</form>
|
142 |
+
</div>
|
143 |
+
|
144 |
+
<div class="sidebar-wrap">
|
145 |
+
<div class="premium-box box-green">
|
146 |
+
<h3 class="wcct-doc-title"><?php _e( 'Documentation', 'woocommerce-conversion-tracking' )?></h3>
|
147 |
+
|
148 |
+
<ul class="wcct-doc-list">
|
149 |
+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/get-started/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Get_Started" target="_blank"><img src="<?php echo plugins_url( 'assets/images/getting_started.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Getting Started', 'woocommerce-conversion-tracking' ) ?></span></a></li>
|
150 |
+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/facebook/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Facebook" target="_blank"><img src="<?php echo plugins_url( 'assets/images/facebook.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Facebook', 'woocommerce-conversion-tracking' ) ?></span></a></li>
|
151 |
+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/twitter/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Twitter" target="_blank"><img src="<?php echo plugins_url( 'assets/images/twitter.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Twitter', 'woocommerce-conversion-tracking' ) ?></span></a></li>
|
152 |
+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/google-adwords/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Adwords" target="_blank"><img src="<?php echo plugins_url( 'assets/images/adwords.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Google Adwords', 'woocommerce-conversion-tracking' ) ?></span></a></li>
|
153 |
+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/perfect-audience/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Perfect_Audience" target="_blank"><img src="<?php echo plugins_url( 'assets/images/perfect_audience.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Perfect Audience', 'woocommerce-conversion-tracking' ) ?></span></a></li>
|
154 |
+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/custom/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Custom" target="_blank"><img src="<?php echo plugins_url( 'assets/images/custom.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Custom', 'woocommerce-conversion-tracking' ) ?></span></a></li>
|
155 |
+
</ul>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
<?php do_action( 'wcct_sidebar' ) ?>
|
159 |
+
</div>
|
160 |
+
</div>
|
includes/views/welcome-20.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wcct-welcome">
|
2 |
+
<div class="icon-wrap">
|
3 |
+
<img src="<?php echo WCCT_ASSETS; ?>/images/screenshot.png" alt="Conversion Tracking Logo">
|
4 |
+
</div>
|
5 |
+
|
6 |
+
<button type="button" class="notice-dismiss" id="dismiss-wcct-20">
|
7 |
+
<span class="screen-reader-text">Dismiss this notice.</span>
|
8 |
+
</button>
|
9 |
+
|
10 |
+
<div class="msg-wrap">
|
11 |
+
<h3>WooCommerce Conversion Tracking just got <span style="color:#CD47B1">better</span></h3>
|
12 |
+
|
13 |
+
<p>
|
14 |
+
Good news, now you can easily track conversions of your WooCommerce store and send data to your favorite ad platforms for improved and precised retargeting campaigns without any coding at all! This makes your Facebook, Twitter, Google Adwords marketing and retargeting easier than ever!
|
15 |
+
</p>
|
16 |
+
|
17 |
+
<p class="cta-buttons">
|
18 |
+
<a href="https://wedevs.com/in/woocommerce-conversion-tracking" target="_blank" class="btn-whats-new">Checkout What's New</a>
|
19 |
+
<a href="https://wedevs.com/woocommerce-conversion-tracking/upgrade-to-pro/?utm_source=wp-admin&utm_medium=pro-upgrade&utm_campaign=wcct_upgrade&utm_content=Get_Premium" target="_blank" class="btn-pro-upgrade">Upgrate to Pro</a>
|
20 |
+
</p>
|
21 |
+
|
22 |
+
<span class="bottom-logo">
|
23 |
+
<img src="<?php echo WCCT_ASSETS; ?>/images/logo-full.png" width="125" alt="Conversion Tracking Logo">
|
24 |
+
</span>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<script type="text/javascript">
|
29 |
+
jQuery(function($) {
|
30 |
+
$('#dismiss-wcct-20').on('click', function(event) {
|
31 |
+
event.preventDefault();
|
32 |
+
|
33 |
+
$(this).parents('.wcct-welcome').slideUp('fast', function() {
|
34 |
+
$(this).remove();
|
35 |
+
});
|
36 |
+
|
37 |
+
wp.ajax.send('wcct_dismiss_notice');
|
38 |
+
});
|
39 |
+
});
|
40 |
+
</script>
|
41 |
+
|
42 |
+
<style>
|
43 |
+
.wcct-welcome {
|
44 |
+
background: #fff;
|
45 |
+
padding: 10px 10px 0 10px;
|
46 |
+
border: 1px solid #e5e5e5;
|
47 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
48 |
+
display: flex;
|
49 |
+
margin-top: 15px;
|
50 |
+
margin-bottom: 15px;
|
51 |
+
position: relative;
|
52 |
+
}
|
53 |
+
|
54 |
+
.wcct-welcome .notice-dismiss {
|
55 |
+
z-index: 99;
|
56 |
+
}
|
57 |
+
|
58 |
+
.wcct-welcome .icon-wrap {
|
59 |
+
width: 242px;
|
60 |
+
margin-right: 15px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.wcct-welcome .msg-wrap {
|
64 |
+
width: calc(100% - 242px);
|
65 |
+
padding-top: 10px;
|
66 |
+
position: relative;
|
67 |
+
}
|
68 |
+
|
69 |
+
.wcct-welcome .icon-wrap img {
|
70 |
+
max-width: 100%;
|
71 |
+
}
|
72 |
+
|
73 |
+
a.btn-whats-new,
|
74 |
+
a.btn-pro-upgrade {
|
75 |
+
font-size: 14px;
|
76 |
+
line-height: 28px;
|
77 |
+
height: 32px;
|
78 |
+
display: inline-block;
|
79 |
+
color: #fff;
|
80 |
+
text-decoration: none;
|
81 |
+
cursor: pointer;
|
82 |
+
border-radius: 3px;
|
83 |
+
white-space: nowrap;
|
84 |
+
box-sizing: border-box;
|
85 |
+
padding: 1px 14px 0px;
|
86 |
+
}
|
87 |
+
|
88 |
+
a.btn-whats-new:hover {
|
89 |
+
color: #fff;
|
90 |
+
background: #e45f44;
|
91 |
+
}
|
92 |
+
|
93 |
+
a.btn-whats-new {
|
94 |
+
background-color: #FD6E51;
|
95 |
+
margin-right: 10px;
|
96 |
+
border: 1px solid #f55d3e;
|
97 |
+
}
|
98 |
+
|
99 |
+
a.btn-pro-upgrade {
|
100 |
+
color: #B190E6;
|
101 |
+
background-color: #fff;
|
102 |
+
border: 1px solid #ddd;
|
103 |
+
box-shadow: 0px 3px 10px 0px rgba(0,0,0, 0.1);
|
104 |
+
}
|
105 |
+
|
106 |
+
a.btn-pro-upgrade:hover {
|
107 |
+
background-color: #B190E6;
|
108 |
+
color: #fff;
|
109 |
+
border: 1px solid #B190E6;
|
110 |
+
}
|
111 |
+
|
112 |
+
.msg-wrap .bottom-logo {
|
113 |
+
position: absolute;
|
114 |
+
bottom: 15px;
|
115 |
+
right: 20px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.wcct-welcome h3 {
|
119 |
+
color: #000;
|
120 |
+
margin-top: 5px;
|
121 |
+
margin-bottom: 10px;
|
122 |
+
font-weight: bold;
|
123 |
+
font-size: 20px;
|
124 |
+
line-height: 150%;
|
125 |
+
}
|
126 |
+
|
127 |
+
p.cta-buttons {
|
128 |
+
margin: 18px 0 0 0;
|
129 |
+
}
|
130 |
+
|
131 |
+
@media (min-width: 768px) {
|
132 |
+
p.cta-buttons {
|
133 |
+
margin-bottom: 20px;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
@media (max-width: 767px) {
|
138 |
+
.wcct-welcome {
|
139 |
+
display: block;
|
140 |
+
padding-bottom: 20px;
|
141 |
+
}
|
142 |
+
|
143 |
+
.wcct-welcome .icon-wrap,
|
144 |
+
.wcct-welcome .msg-wrap {
|
145 |
+
width: 100%;
|
146 |
+
}
|
147 |
+
|
148 |
+
.wcct-welcome .msg-wrap {
|
149 |
+
padding: 0 15px;
|
150 |
+
}
|
151 |
+
|
152 |
+
.msg-wrap .bottom-logo {
|
153 |
+
display: none;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
</style>
|
languages/woocommerce-conversion-tracking.pot
ADDED
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2018 Tareq Hasan
|
2 |
+
# This file is distributed under the GPL2.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Conversion Tracking 2.0\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://example.com\n"
|
7 |
+
"POT-Creation-Date: 2018-02-22 11:39:03+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
|
14 |
+
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
15 |
+
|
16 |
+
#: conversion-tracking.php:268
|
17 |
+
msgid "Get PRO"
|
18 |
+
msgstr ""
|
19 |
+
|
20 |
+
#: conversion-tracking.php:271
|
21 |
+
msgid "Docs"
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: conversion-tracking.php:272
|
25 |
+
msgid "Settings"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: includes/class-admin.php:49
|
29 |
+
msgid "Conversion Tracking"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: includes/class-admin.php:73
|
33 |
+
msgid "Integrations"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: includes/class-ajax.php:41
|
37 |
+
msgid "Settings has been saved successfully!"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: includes/class-integration-pro-features.php:39
|
41 |
+
msgid "Facebook Product Catalog (Pro)"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: includes/class-integration-pro-features.php:44
|
45 |
+
msgid "Settings (Pro)"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: includes/class-integration-pro-features.php:59
|
49 |
+
msgid "View Product"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: includes/class-integration-pro-features.php:64
|
53 |
+
msgid "View Product Category"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: includes/class-integration-pro-features.php:69
|
57 |
+
msgid "Search"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: includes/class-integration-pro-features.php:74
|
61 |
+
msgid "Add To Wishlist"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: includes/class-integration-pro-features.php:90
|
65 |
+
msgid "Add to Cart "
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: includes/class-integration-pro-features.php:95
|
69 |
+
#: includes/class-integration-pro-features.php:111
|
70 |
+
#: includes/integrations/class-integration-facebook.php:47
|
71 |
+
msgid "Complete Registration"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: includes/class-integration-pro-features.php:126
|
75 |
+
msgid "Premium Features"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: includes/class-integration-pro-features.php:137
|
79 |
+
msgid "Get Premium"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: includes/class-wedevs-insights.php:282
|
83 |
+
msgid ""
|
84 |
+
"Want to help make <strong>%s</strong> even more awesome? Allow weDevs to "
|
85 |
+
"collect non-sensitive diagnostic data and usage information."
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: includes/class-wedevs-insights.php:287
|
89 |
+
msgid "what we collect"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: includes/class-wedevs-insights.php:293
|
93 |
+
msgid "Allow"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: includes/class-wedevs-insights.php:294
|
97 |
+
msgid "No thanks"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: includes/class-wedevs-insights.php:471
|
101 |
+
msgid "Once Weekly"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: includes/class-wedevs-insights.php:607
|
105 |
+
msgid "If you have a moment, please let us know why you are deactivating:"
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#: includes/class-wedevs-insights.php:621
|
109 |
+
msgid "I rather wouldn't say"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: includes/class-wedevs-insights.php:622
|
113 |
+
msgid "Submit & Deactivate"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: includes/class-wedevs-insights.php:623
|
117 |
+
msgid "Cancel"
|
118 |
+
msgstr ""
|
119 |
+
|
120 |
+
#: includes/integration.php:13
|
121 |
+
msgid "Conversion Tracking Pixel"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
#: includes/integration.php:14
|
125 |
+
msgid ""
|
126 |
+
"Various conversion tracking pixel integration like Facebook Ad, Google "
|
127 |
+
"AdWords, etc. Insert your scripts codes here:"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: includes/integration.php:43
|
131 |
+
msgid "Tags Position"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: includes/integration.php:44
|
135 |
+
msgid "Select which position in your page you want to insert the tag"
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: includes/integration.php:50 includes/integration.php:52
|
139 |
+
#. translators: %s: tag name
|
140 |
+
msgid "Inside %s tag"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: includes/integration.php:57 includes/integration.php:67
|
144 |
+
#: includes/integration.php:80
|
145 |
+
#. translators: %s: page name
|
146 |
+
msgid "Tags for %s"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: includes/integration.php:58
|
150 |
+
msgid "View Cart"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: includes/integration.php:60
|
154 |
+
msgid "Adds script on the cart page"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: includes/integration.php:68
|
158 |
+
#: includes/integrations/class-integration-custom.php:31
|
159 |
+
msgid "Successful Order"
|
160 |
+
msgstr ""
|
161 |
+
|
162 |
+
#: includes/integration.php:70
|
163 |
+
msgid "Adds script on the purchase success page"
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#: includes/integration.php:72 includes/integration.php:137
|
167 |
+
#. translators: %s: dynamic values
|
168 |
+
msgid "You can use dynamic values: %s"
|
169 |
+
msgstr ""
|
170 |
+
|
171 |
+
#: includes/integration.php:81
|
172 |
+
msgid "User Registration"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: includes/integration.php:83
|
176 |
+
msgid "Adds script on the successful registraion page"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: includes/integration.php:132
|
180 |
+
msgid "Conversion Tracking Code"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: includes/integration.php:134
|
184 |
+
msgid "Insert conversion tracking code for this product."
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: includes/integrations/class-integration-custom.php:13
|
188 |
+
#: includes/views/settings.php:154
|
189 |
+
msgid "Custom"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: includes/integrations/class-integration-custom.php:34
|
193 |
+
#. translators: %s: dynamic values
|
194 |
+
msgid "Put your JavaScript tracking scripts here. You can use dynamic values: %s"
|
195 |
+
msgstr ""
|
196 |
+
|
197 |
+
#: includes/integrations/class-integration-custom.php:41
|
198 |
+
msgid "Registration Scripts"
|
199 |
+
msgstr ""
|
200 |
+
|
201 |
+
#: includes/integrations/class-integration-custom.php:43
|
202 |
+
msgid ""
|
203 |
+
"<a href=\"%s\" target=\"_blank\">Learn more</a> about setting up custom "
|
204 |
+
"scripts."
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#: includes/integrations/class-integration-facebook.php:13
|
208 |
+
#: includes/views/settings.php:150
|
209 |
+
msgid "Facebook"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: includes/integrations/class-integration-facebook.php:33
|
213 |
+
msgid "Pixel ID"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: includes/integrations/class-integration-facebook.php:36
|
217 |
+
msgid "Find the Pixel ID from <a href=\"%s\" target=\"_blank\">here</a>."
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
#: includes/integrations/class-integration-facebook.php:41
|
221 |
+
#: includes/integrations/class-integration-google.php:38
|
222 |
+
#: includes/integrations/class-integration-twitter.php:31
|
223 |
+
msgid "Events"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: includes/integrations/class-integration-facebook.php:44
|
227 |
+
msgid "Add to Cart"
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: includes/integrations/class-integration-facebook.php:45
|
231 |
+
msgid "Initiate Checkout"
|
232 |
+
msgstr ""
|
233 |
+
|
234 |
+
#: includes/integrations/class-integration-facebook.php:46
|
235 |
+
#: includes/integrations/class-integration-google.php:43
|
236 |
+
#: includes/integrations/class-integration-twitter.php:36
|
237 |
+
msgid "Purchase"
|
238 |
+
msgstr ""
|
239 |
+
|
240 |
+
#: includes/integrations/class-integration-google.php:13
|
241 |
+
#: includes/views/settings.php:152
|
242 |
+
msgid "Google Adwords"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: includes/integrations/class-integration-google.php:30
|
246 |
+
msgid "Account ID"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: includes/integrations/class-integration-google.php:33
|
250 |
+
msgid ""
|
251 |
+
"Provide the AdWords Account ID. Usually it's something like "
|
252 |
+
"<code>AW-123456789</code>, <a href=\"%s\" target=\"_blank\">learn more</a>."
|
253 |
+
msgstr ""
|
254 |
+
|
255 |
+
#: includes/integrations/class-integration-twitter.php:13
|
256 |
+
#: includes/views/settings.php:151
|
257 |
+
msgid "Twitter"
|
258 |
+
msgstr ""
|
259 |
+
|
260 |
+
#: includes/integrations/class-integration-twitter.php:39
|
261 |
+
msgid ""
|
262 |
+
"Find the Universal Tag ID from <a href=\"%s\" target=\"_blank\">here</a>, "
|
263 |
+
"navigate to Tools → Conversion Tracking."
|
264 |
+
msgstr ""
|
265 |
+
|
266 |
+
#: includes/views/settings.php:5
|
267 |
+
msgid "Integration Settings"
|
268 |
+
msgstr ""
|
269 |
+
|
270 |
+
#: includes/views/settings.php:146
|
271 |
+
msgid "Documentation"
|
272 |
+
msgstr ""
|
273 |
+
|
274 |
+
#: includes/views/settings.php:149
|
275 |
+
msgid "Getting Started"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: includes/views/settings.php:153
|
279 |
+
msgid "Perfect Audience"
|
280 |
+
msgstr ""
|
281 |
+
|
282 |
+
#. Plugin Name of the plugin/theme
|
283 |
+
msgid "WooCommerce Conversion Tracking"
|
284 |
+
msgstr ""
|
285 |
+
|
286 |
+
#. Plugin URI of the plugin/theme
|
287 |
+
msgid "https://wedevs.com/products/plugins/woocommerce-conversion-tracking/"
|
288 |
+
msgstr ""
|
289 |
+
|
290 |
+
#. Description of the plugin/theme
|
291 |
+
msgid ""
|
292 |
+
"Adds various conversion tracking codes to cart, checkout, registration "
|
293 |
+
"success and product page on WooCommerce"
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#. Author of the plugin/theme
|
297 |
+
msgid "Tareq Hasan"
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#. Author URI of the plugin/theme
|
301 |
+
msgid "https://tareq.co/"
|
302 |
+
msgstr ""
|
readme.txt
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WooCommerce Conversion Tracking ===
|
2 |
+
Contributors: tareq1988
|
3 |
+
Tags: ecommerce, e-commerce, commerce, woocommerce, tracking, facebook, google, adwords, tracking-pixel
|
4 |
+
Donate link: https://tareq.co/donate/
|
5 |
+
Requires at least: 4.0
|
6 |
+
Tested up to: 4.9.4
|
7 |
+
Stable tag: 2.0
|
8 |
+
License: GPLv3
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
|
11 |
+
Adds various conversion tracking codes to cart, checkout, registration success and product page on WooCommerce
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
When you are integrating any advertising campaigns, they provide various tracking codes (mainly JavaScript) to insert them various pages of your site so that it can track how the conversion is happening.
|
16 |
+
|
17 |
+
This plugin inserts those codes on WooCommerce cart page, checkout success page and after user registration. So you can track who are adding your products to cart, who are buying them and who are registering to your site.
|
18 |
+
|
19 |
+
= Supported Integrations =
|
20 |
+
|
21 |
+
* [Facebook](https://wedevs.com/docs/woocommerce-conversion-tracking/facebook/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=facebook)
|
22 |
+
* [Twitter](https://wedevs.com/docs/woocommerce-conversion-tracking/twitter/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=twitter)
|
23 |
+
* [Google Adwords](https://wedevs.com/docs/woocommerce-conversion-tracking/google-adwords/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=google_adwords)
|
24 |
+
* [Custom Tracking](https://wedevs.com/docs/woocommerce-conversion-tracking/custom/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=custom)
|
25 |
+
|
26 |
+
= Pro Features =
|
27 |
+
|
28 |
+
* More Facebook Events
|
29 |
+
* Multiple Facebook Pixels
|
30 |
+
* [Facebook Product Catalog](https://wedevs.com/docs/woocommerce-conversion-tracking/facebook/facebook-product-catalog/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=product_catalog)
|
31 |
+
* [Perfect Audience](https://wedevs.com/docs/woocommerce-conversion-tracking/perfect-audience/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=perfect_audience)
|
32 |
+
* More Twitter and Google Adwords Events
|
33 |
+
|
34 |
+
[**Get Pro Version**](https://wedevs.com/woocommerce-conversion-tracking/pricing/?utm_source=wporg&utm_medium=Readme&utm_campaign=wcct-lite&utm_content=pricing)
|
35 |
+
|
36 |
+
= Videos =
|
37 |
+
[youtube http://www.youtube.com/watch?v=PZN883xb51c]
|
38 |
+
[youtube http://www.youtube.com/watch?v=6QMWzM9decU]
|
39 |
+
|
40 |
+
[**All Videos**](https://www.youtube.com/watch?v=b3BHJwQ7Q70&list=PLJorZsV2RVv_7zV2I1_X_xJODZklXHQtS)
|
41 |
+
|
42 |
+
= Contribute =
|
43 |
+
[Github](https://github.com/tareq1988/woocommerce-conversion-tracking)
|
44 |
+
|
45 |
+
= Author =
|
46 |
+
[Tareq Hasan](https://tareq.co)
|
47 |
+
|
48 |
+
== Installation ==
|
49 |
+
|
50 |
+
Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.
|
51 |
+
|
52 |
+
= Minimum Requirements =
|
53 |
+
|
54 |
+
* WooCommerce 3.0
|
55 |
+
* PHP version 5.2.4 or greater
|
56 |
+
* MySQL version 5.0 or greater
|
57 |
+
|
58 |
+
= Tracking Conversions =
|
59 |
+
|
60 |
+
If you need to track successful purchases, go to the settings and in the **Tags for Successful Order** box, place the JavaScript code you received from the services (e.g. Facebook, Twitter, AdWords) you want to use.
|
61 |
+
|
62 |
+
In the JavaScript snippet, there are places where you can use `order_number`, `order_total`, `order_subtotal`, `currency`, etc.
|
63 |
+
|
64 |
+
The plugin provides the following codes: <code>{customer_id}</code>, <code>{customer_email}</code>, <code>{customer_first_name}</code>, <code>{customer_last_name}</code>, <code>{order_number}</code>, <code>{order_total}</code>, <code>{order_subtotal}</code>, <code>{currency}</code>, <code>{payment_method}</code>.
|
65 |
+
|
66 |
+
Replace the script tag values with the suitable codes the plugin provides and finally insert the snippet in the boxes.
|
67 |
+
|
68 |
+
== Frequently Asked Questions ==
|
69 |
+
|
70 |
+
= Does it work with WooCommerce 2.x and 3.x? =
|
71 |
+
|
72 |
+
Yes, the plugin works both with the latest v3.x and the older 2.x versions.
|
73 |
+
|
74 |
+
= How conversions are tracked? =
|
75 |
+
|
76 |
+
We have three different ways of tracking a conversion. The most used one is when a order has been made.
|
77 |
+
|
78 |
+
We put the JavaScript scripts provided by you in the page and it fires a conversion event to that scripts site.
|
79 |
+
|
80 |
+
|
81 |
+
== Screenshots ==
|
82 |
+
|
83 |
+
1. Settings Panel
|
84 |
+
2. Facebook Pixel Setup
|
85 |
+
3. Google Adwords Conversion Tracking Settings
|
86 |
+
4. Twitter Purchase Tracking Setup
|
87 |
+
5. Custom Codes
|
88 |
+
|
89 |
+
== Changelog ==
|
90 |
+
|
91 |
+
= Version 2.0 (22-February-2018) =
|
92 |
+
|
93 |
+
* Major version released
|
94 |
+
* Individual gateway integrations
|
95 |
+
* More streamlined and user friendly UI
|
96 |
+
|
97 |
+
|
98 |
+
= Version 1.2.5 (28-December-2017) =
|
99 |
+
|
100 |
+
* Added plugin action links for Docs and Settings.
|
101 |
+
* Added a survey for next version features.
|
102 |
+
* Updated WooCommerce compatibility version tags.
|
103 |
+
|
104 |
+
= 1.2.4 - 01-Aug-2017 =
|
105 |
+
|
106 |
+
* [fix] The tracker option won't go away. Sorry!
|
107 |
+
|
108 |
+
= 1.2.3 - 31-July-2017 =
|
109 |
+
|
110 |
+
* [improvement] WooCommerce v3.0 compatibility
|
111 |
+
* [new] Added new shortcodes: `{customer_id}`, `{customer_email}`, `{customer_first_name}`, `{customer_last_name}`, `{payment_method}`
|
112 |
+
* [new] Added weDevs Insights class
|
113 |
+
|
114 |
+
= 1.2.2 - 10-Feb-2017 =
|
115 |
+
|
116 |
+
* Updated with plugin slug as the textdomain
|
117 |
+
* Integration class PHP compatibility
|
118 |
+
|
119 |
+
= 1.2.1 - 9-June-2016 =
|
120 |
+
|
121 |
+
* [fix] Fatal error on thank you page when without parameters
|
122 |
+
|
123 |
+
= 1.2 - 10-April-2016 =
|
124 |
+
|
125 |
+
* [new] Order number variable `{order_number}` added on checkout page
|
126 |
+
|
127 |
+
= 1.1 - 08-Jan-2016 =
|
128 |
+
|
129 |
+
* [new] Dynamic values on product and checkout script
|
130 |
+
|
131 |
+
= 1.0 - 08/07/2015 =
|
132 |
+
|
133 |
+
* [fix] Removed product specific codes from product single page, should show only on checkout. My bad!
|
134 |
+
|
135 |
+
= 0.3 - 31/05/2015 =
|
136 |
+
|
137 |
+
* [fix] Product specific code only loads on product page itself, not checkout
|
138 |
+
|
139 |
+
= 0.2 - 30/05/2015 =
|
140 |
+
|
141 |
+
* Renamed position option "In Footer" to "Inside Body Tag", may be was confusing to users.
|
142 |
+
|
143 |
+
= 0.1.1 - 06/04/2014 =
|
144 |
+
|
145 |
+
* Added position parameter for display position control
|
146 |
+
|
147 |
+
= 0.1 - 27/03/2014 =
|
148 |
+
|
149 |
+
* Initial release
|
150 |
+
|
151 |
+
== Upgrade Notice ==
|
152 |
+
|
153 |
+
N/A
|