Version Description
- Disabling search and comment tracking when Leads component not available.
Download this release
Release Info
Developer | adbox |
Plugin | WordPress Landing Pages |
Version | 2.5.9 |
Comparing to | |
See all releases |
Code changes from version 2.5.8 to 2.5.9
- landing-pages.php +2 -2
- readme.txt +4 -1
- shared/assets/js/frontend/analytics-src/analytics.lead.js +1 -1
- shared/assets/js/frontend/analytics/inboundAnalytics.js +228 -228
- shared/assets/js/frontend/analytics/inboundAnalytics.min.js +2 -2
- shared/classes/class.load-assets.php +3 -3
- shared/docs/analytics.events.md +389 -389
landing-pages.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Landing Pages
|
4 |
Plugin URI: http://www.inboundnow.com/landing-pages/
|
5 |
Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
|
6 |
-
Version: 2.5.
|
7 |
Author: Inbound Now
|
8 |
Author URI: http://www.inboundnow.com/
|
9 |
|
@@ -41,7 +41,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
|
|
41 |
*/
|
42 |
private static function load_constants() {
|
43 |
|
44 |
-
define('LANDINGPAGES_CURRENT_VERSION', '2.5.
|
45 |
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
|
46 |
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
47 |
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
|
3 |
Plugin Name: Landing Pages
|
4 |
Plugin URI: http://www.inboundnow.com/landing-pages/
|
5 |
Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
|
6 |
+
Version: 2.5.9
|
7 |
Author: Inbound Now
|
8 |
Author URI: http://www.inboundnow.com/
|
9 |
|
41 |
*/
|
42 |
private static function load_constants() {
|
43 |
|
44 |
+
define('LANDINGPAGES_CURRENT_VERSION', '2.5.9' );
|
45 |
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
|
46 |
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
47 |
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
7 |
Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
|
8 |
Requires at least: 3.8
|
9 |
Tested up to: 4.8
|
10 |
-
Stable Tag: 2.5.
|
11 |
|
12 |
|
13 |
Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
|
@@ -85,6 +85,9 @@ We also offer a guide for using <a href="https://github.com/inboundnow/landing-p
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
88 |
= 2.5.8 =
|
89 |
* Updating docblocks for APIGen
|
90 |
* [Restored] Impression tracking was failing in select theme environments.
|
7 |
Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
|
8 |
Requires at least: 3.8
|
9 |
Tested up to: 4.8
|
10 |
+
Stable Tag: 2.5.9
|
11 |
|
12 |
|
13 |
Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 2.5.9 =
|
89 |
+
* Disabling search and comment tracking when Leads component not available.
|
90 |
+
|
91 |
= 2.5.8 =
|
92 |
* Updating docblocks for APIGen
|
93 |
* [Restored] Impression tracking was failing in select theme environments.
|
shared/assets/js/frontend/analytics-src/analytics.lead.js
CHANGED
@@ -11,7 +11,7 @@ var _inboundLeadsAPI = (function(_inbound) {
|
|
11 |
var utils = _inbound.Utils,
|
12 |
wp_lead_uid = utils.readCookie("wp_lead_uid"),
|
13 |
wp_lead_id = utils.readCookie("wp_lead_id"),
|
14 |
-
expire_check = utils.readCookie("
|
15 |
|
16 |
if (!expire_check) {
|
17 |
_inbound.deBugger('leads', 'expired vistor. Run Processes');
|
11 |
var utils = _inbound.Utils,
|
12 |
wp_lead_uid = utils.readCookie("wp_lead_uid"),
|
13 |
wp_lead_id = utils.readCookie("wp_lead_id"),
|
14 |
+
expire_check = utils.readCookie("lead_data_expire");
|
15 |
|
16 |
if (!expire_check) {
|
17 |
_inbound.deBugger('leads', 'expired vistor. Run Processes');
|
shared/assets/js/frontend/analytics/inboundAnalytics.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
|
2 |
/**
|
3 |
* # _inbound
|
4 |
*
|
@@ -129,7 +129,7 @@ var _inbound = (function(options) {
|
|
129 |
|
130 |
return Analytics;
|
131 |
|
132 |
-
})(_inboundOptions);
|
133 |
/**
|
134 |
* # Hooks & Filters
|
135 |
*
|
@@ -534,7 +534,7 @@ var _inboundHooks = (function (_inbound) {
|
|
534 |
|
535 |
return _inbound;
|
536 |
|
537 |
-
})(_inbound || {});
|
538 |
/**
|
539 |
* # _inbound UTILS
|
540 |
*
|
@@ -1393,7 +1393,7 @@ var _inboundUtils = (function(_inbound) {
|
|
1393 |
return _inbound;
|
1394 |
|
1395 |
})(_inbound || {});
|
1396 |
-
|
1397 |
/**
|
1398 |
* # Inbound Forms
|
1399 |
*
|
@@ -2601,7 +2601,7 @@ var InboundForms = (function(_inbound) {
|
|
2601 |
return _inbound;
|
2602 |
|
2603 |
})(_inbound || {});
|
2604 |
-
|
2605 |
/**
|
2606 |
* # Analytics Events
|
2607 |
*
|
@@ -3211,228 +3211,228 @@ function inboundFormNoRedirectContent(){
|
|
3211 |
}
|
3212 |
|
3213 |
_inbound.add_action( 'form_after_submission', inboundFormNoRedirectContent, 10 );
|
3214 |
-
|
3215 |
-
/* LocalStorage Component */
|
3216 |
-
var InboundTotalStorage = (function (_inbound){
|
3217 |
-
|
3218 |
-
var supported, ls, mod = '_inbound';
|
3219 |
-
if ('localStorage' in window){
|
3220 |
-
try {
|
3221 |
-
ls = (typeof window.localStorage === 'undefined') ? undefined : window.localStorage;
|
3222 |
-
if (typeof ls == 'undefined' || typeof window.JSON == 'undefined'){
|
3223 |
-
supported = false;
|
3224 |
-
} else {
|
3225 |
-
supported = true;
|
3226 |
-
}
|
3227 |
-
window.localStorage.setItem(mod, '1');
|
3228 |
-
window.localStorage.removeItem(mod);
|
3229 |
-
}
|
3230 |
-
catch (err){
|
3231 |
-
supported = false;
|
3232 |
-
}
|
3233 |
-
}
|
3234 |
-
|
3235 |
-
/* Make the methods public */
|
3236 |
-
_inbound.totalStorage = function(key, value, options){
|
3237 |
-
return _inbound.totalStorage.impl.init(key, value);
|
3238 |
-
};
|
3239 |
-
|
3240 |
-
_inbound.totalStorage.setItem = function(key, value){
|
3241 |
-
return _inbound.totalStorage.impl.setItem(key, value);
|
3242 |
-
};
|
3243 |
-
|
3244 |
-
_inbound.totalStorage.getItem = function(key){
|
3245 |
-
return _inbound.totalStorage.impl.getItem(key);
|
3246 |
-
};
|
3247 |
-
|
3248 |
-
_inbound.totalStorage.getAll = function(){
|
3249 |
-
return _inbound.totalStorage.impl.getAll();
|
3250 |
-
};
|
3251 |
-
|
3252 |
-
_inbound.totalStorage.deleteItem = function(key){
|
3253 |
-
return _inbound.totalStorage.impl.deleteItem(key);
|
3254 |
-
};
|
3255 |
-
|
3256 |
-
|
3257 |
-
_inbound.totalStorage.impl = {
|
3258 |
-
|
3259 |
-
init: function(key, value){
|
3260 |
-
if (typeof value != 'undefined') {
|
3261 |
-
return this.setItem(key, value);
|
3262 |
-
} else {
|
3263 |
-
return this.getItem(key);
|
3264 |
-
}
|
3265 |
-
},
|
3266 |
-
|
3267 |
-
setItem: function(key, value){
|
3268 |
-
if (!supported){
|
3269 |
-
try {
|
3270 |
-
_inbound.Utils.createCookie(key, value);
|
3271 |
-
return value;
|
3272 |
-
} catch(e){
|
3273 |
-
console.log('Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie');
|
3274 |
-
}
|
3275 |
-
}
|
3276 |
-
var saver = JSON.stringify(value);
|
3277 |
-
ls.setItem(key, saver);
|
3278 |
-
return this.parseResult(saver);
|
3279 |
-
},
|
3280 |
-
getItem: function(key){
|
3281 |
-
if (!supported){
|
3282 |
-
try {
|
3283 |
-
return this.parseResult(_inbound.Utils.readCookie(key));
|
3284 |
-
} catch(e){
|
3285 |
-
return null;
|
3286 |
-
}
|
3287 |
-
}
|
3288 |
-
var item = ls.getItem(key);
|
3289 |
-
return this.parseResult(item);
|
3290 |
-
},
|
3291 |
-
deleteItem: function(key){
|
3292 |
-
if (!supported){
|
3293 |
-
try {
|
3294 |
-
_inbound.Utils.eraseCookie(key, null);
|
3295 |
-
return true;
|
3296 |
-
} catch(e){
|
3297 |
-
return false;
|
3298 |
-
}
|
3299 |
-
}
|
3300 |
-
ls.removeItem(key);
|
3301 |
-
return true;
|
3302 |
-
},
|
3303 |
-
getAll: function(){
|
3304 |
-
var items = [];
|
3305 |
-
if (!supported){
|
3306 |
-
try {
|
3307 |
-
var pairs = document.cookie.split(";");
|
3308 |
-
for (var i = 0; i<pairs.length; i++){
|
3309 |
-
var pair = pairs[i].split('=');
|
3310 |
-
var key = pair[0];
|
3311 |
-
items.push({key:key, value:this.parseResult(_inbound.Utils.readCookie(key))});
|
3312 |
-
}
|
3313 |
-
} catch(e){
|
3314 |
-
return null;
|
3315 |
-
}
|
3316 |
-
} else {
|
3317 |
-
for (var j in ls){
|
3318 |
-
if (j.length){
|
3319 |
-
items.push({key:j, value:this.parseResult(ls.getItem(j))});
|
3320 |
-
}
|
3321 |
-
}
|
3322 |
-
}
|
3323 |
-
return items;
|
3324 |
-
},
|
3325 |
-
parseResult: function(res){
|
3326 |
-
var ret;
|
3327 |
-
try {
|
3328 |
-
ret = JSON.parse(res);
|
3329 |
-
if (typeof ret == 'undefined'){
|
3330 |
-
ret = res;
|
3331 |
-
}
|
3332 |
-
if (ret == 'true'){
|
3333 |
-
ret = true;
|
3334 |
-
}
|
3335 |
-
if (ret == 'false'){
|
3336 |
-
ret = false;
|
3337 |
-
}
|
3338 |
-
if (parseFloat(ret) == ret && typeof ret != "object"){
|
3339 |
-
ret = parseFloat(ret);
|
3340 |
-
}
|
3341 |
-
} catch(e){
|
3342 |
-
ret = res;
|
3343 |
-
}
|
3344 |
-
return ret;
|
3345 |
-
}
|
3346 |
-
};
|
3347 |
-
})(_inbound || {});
|
3348 |
-
/**
|
3349 |
-
* Leads API functions
|
3350 |
-
* @param Object _inbound - Main JS object
|
3351 |
-
* @return Object - include event triggers
|
3352 |
-
*/
|
3353 |
-
var _inboundLeadsAPI = (function(_inbound) {
|
3354 |
-
var httpRequest;
|
3355 |
-
_inbound.LeadsAPI = {
|
3356 |
-
init: function() {
|
3357 |
-
|
3358 |
-
var utils = _inbound.Utils,
|
3359 |
-
wp_lead_uid = utils.readCookie("wp_lead_uid"),
|
3360 |
-
wp_lead_id = utils.readCookie("wp_lead_id"),
|
3361 |
-
expire_check = utils.readCookie("
|
3362 |
-
|
3363 |
-
if (!expire_check) {
|
3364 |
-
_inbound.deBugger('leads', 'expired vistor. Run Processes');
|
3365 |
-
//var data_to_lookup = global-localized-vars;
|
3366 |
-
if (wp_lead_id) {
|
3367 |
-
/* Get InboundLeadData */
|
3368 |
-
_inbound.LeadsAPI.getAllLeadData();
|
3369 |
-
}
|
3370 |
-
}
|
3371 |
-
},
|
3372 |
-
setGlobalLeadData: function(data) {
|
3373 |
-
InboundLeadData = data;
|
3374 |
-
},
|
3375 |
-
getAllLeadData: function(expire_check) {
|
3376 |
-
var wp_lead_id = _inbound.Utils.readCookie("wp_lead_id"),
|
3377 |
-
leadData = _inbound.totalStorage('inbound_lead_data'),
|
3378 |
-
leadDataExpire = _inbound.Utils.readCookie("lead_data_expire");
|
3379 |
-
data = {
|
3380 |
-
action: 'inbound_get_all_lead_data',
|
3381 |
-
wp_lead_id: wp_lead_id
|
3382 |
-
},
|
3383 |
-
success = function(returnData) {
|
3384 |
-
var leadData = JSON.parse(returnData);
|
3385 |
-
_inbound.LeadsAPI.setGlobalLeadData(leadData);
|
3386 |
-
_inbound.totalStorage('inbound_lead_data', leadData); // store lead data
|
3387 |
-
|
3388 |
-
/* Set 3 day timeout for checking DB for new lead data for Lead_Global var */
|
3389 |
-
var d = new Date();
|
3390 |
-
d.setTime(d.getTime() + 30 * 60 * 1000);
|
3391 |
-
var expire = _inbound.Utils.addDays(d, 3);
|
3392 |
-
_inbound.Utils.createCookie("lead_data_expire", true, expire);
|
3393 |
-
|
3394 |
-
};
|
3395 |
-
|
3396 |
-
if (!leadData) {
|
3397 |
-
// Get New Lead Data from DB
|
3398 |
-
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
|
3399 |
-
|
3400 |
-
} else {
|
3401 |
-
// set global lead var with localstorage data
|
3402 |
-
_inbound.LeadsAPI.setGlobalLeadData(leadData);
|
3403 |
-
_inbound.deBugger('lead', 'Set Global Lead Data from Localstorage');
|
3404 |
-
|
3405 |
-
if (!leadDataExpire) {
|
3406 |
-
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
|
3407 |
-
//console.log('Set Global Lead Data from Localstorage');
|
3408 |
-
_inbound.deBugger('lead', 'localized data old. Pull new from DB');
|
3409 |
-
//console.log('localized data old. Pull new from DB');
|
3410 |
-
}
|
3411 |
-
}
|
3412 |
-
|
3413 |
-
},
|
3414 |
-
getLeadLists: function() {
|
3415 |
-
var wp_lead_id = _inbound.Utils.readCookie("wp_lead_id");
|
3416 |
-
var data = {
|
3417 |
-
action: 'wpl_check_lists',
|
3418 |
-
wp_lead_id: wp_lead_id
|
3419 |
-
};
|
3420 |
-
var success = function(user_id) {
|
3421 |
-
_inbound.Utils.createCookie("lead_session_list_check", true, {
|
3422 |
-
path: '/',
|
3423 |
-
expires: 1
|
3424 |
-
});
|
3425 |
-
_inbound.deBugger('lead', "Lists checked");
|
3426 |
-
//console.log("Lists checked");
|
3427 |
-
};
|
3428 |
-
//_inbound.Utils.doAjax(data, success);
|
3429 |
-
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
|
3430 |
-
}
|
3431 |
-
};
|
3432 |
-
|
3433 |
-
return _inbound;
|
3434 |
-
|
3435 |
-
})(_inbound || {});
|
3436 |
/**
|
3437 |
* # Page View Tracking
|
3438 |
*
|
@@ -3827,7 +3827,7 @@ var _inboundPageTracking = (function(_inbound) {
|
|
3827 |
|
3828 |
return _inbound;
|
3829 |
|
3830 |
-
})(_inbound || {});
|
3831 |
/**
|
3832 |
* # Start
|
3833 |
*
|
1 |
+
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
|
2 |
/**
|
3 |
* # _inbound
|
4 |
*
|
129 |
|
130 |
return Analytics;
|
131 |
|
132 |
+
})(_inboundOptions);
|
133 |
/**
|
134 |
* # Hooks & Filters
|
135 |
*
|
534 |
|
535 |
return _inbound;
|
536 |
|
537 |
+
})(_inbound || {});
|
538 |
/**
|
539 |
* # _inbound UTILS
|
540 |
*
|
1393 |
return _inbound;
|
1394 |
|
1395 |
})(_inbound || {});
|
1396 |
+
|
1397 |
/**
|
1398 |
* # Inbound Forms
|
1399 |
*
|
2601 |
return _inbound;
|
2602 |
|
2603 |
})(_inbound || {});
|
2604 |
+
|
2605 |
/**
|
2606 |
* # Analytics Events
|
2607 |
*
|
3211 |
}
|
3212 |
|
3213 |
_inbound.add_action( 'form_after_submission', inboundFormNoRedirectContent, 10 );
|
3214 |
+
|
3215 |
+
/* LocalStorage Component */
|
3216 |
+
var InboundTotalStorage = (function (_inbound){
|
3217 |
+
|
3218 |
+
var supported, ls, mod = '_inbound';
|
3219 |
+
if ('localStorage' in window){
|
3220 |
+
try {
|
3221 |
+
ls = (typeof window.localStorage === 'undefined') ? undefined : window.localStorage;
|
3222 |
+
if (typeof ls == 'undefined' || typeof window.JSON == 'undefined'){
|
3223 |
+
supported = false;
|
3224 |
+
} else {
|
3225 |
+
supported = true;
|
3226 |
+
}
|
3227 |
+
window.localStorage.setItem(mod, '1');
|
3228 |
+
window.localStorage.removeItem(mod);
|
3229 |
+
}
|
3230 |
+
catch (err){
|
3231 |
+
supported = false;
|
3232 |
+
}
|
3233 |
+
}
|
3234 |
+
|
3235 |
+
/* Make the methods public */
|
3236 |
+
_inbound.totalStorage = function(key, value, options){
|
3237 |
+
return _inbound.totalStorage.impl.init(key, value);
|
3238 |
+
};
|
3239 |
+
|
3240 |
+
_inbound.totalStorage.setItem = function(key, value){
|
3241 |
+
return _inbound.totalStorage.impl.setItem(key, value);
|
3242 |
+
};
|
3243 |
+
|
3244 |
+
_inbound.totalStorage.getItem = function(key){
|
3245 |
+
return _inbound.totalStorage.impl.getItem(key);
|
3246 |
+
};
|
3247 |
+
|
3248 |
+
_inbound.totalStorage.getAll = function(){
|
3249 |
+
return _inbound.totalStorage.impl.getAll();
|
3250 |
+
};
|
3251 |
+
|
3252 |
+
_inbound.totalStorage.deleteItem = function(key){
|
3253 |
+
return _inbound.totalStorage.impl.deleteItem(key);
|
3254 |
+
};
|
3255 |
+
|
3256 |
+
|
3257 |
+
_inbound.totalStorage.impl = {
|
3258 |
+
|
3259 |
+
init: function(key, value){
|
3260 |
+
if (typeof value != 'undefined') {
|
3261 |
+
return this.setItem(key, value);
|
3262 |
+
} else {
|
3263 |
+
return this.getItem(key);
|
3264 |
+
}
|
3265 |
+
},
|
3266 |
+
|
3267 |
+
setItem: function(key, value){
|
3268 |
+
if (!supported){
|
3269 |
+
try {
|
3270 |
+
_inbound.Utils.createCookie(key, value);
|
3271 |
+
return value;
|
3272 |
+
} catch(e){
|
3273 |
+
console.log('Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie');
|
3274 |
+
}
|
3275 |
+
}
|
3276 |
+
var saver = JSON.stringify(value);
|
3277 |
+
ls.setItem(key, saver);
|
3278 |
+
return this.parseResult(saver);
|
3279 |
+
},
|
3280 |
+
getItem: function(key){
|
3281 |
+
if (!supported){
|
3282 |
+
try {
|
3283 |
+
return this.parseResult(_inbound.Utils.readCookie(key));
|
3284 |
+
} catch(e){
|
3285 |
+
return null;
|
3286 |
+
}
|
3287 |
+
}
|
3288 |
+
var item = ls.getItem(key);
|
3289 |
+
return this.parseResult(item);
|
3290 |
+
},
|
3291 |
+
deleteItem: function(key){
|
3292 |
+
if (!supported){
|
3293 |
+
try {
|
3294 |
+
_inbound.Utils.eraseCookie(key, null);
|
3295 |
+
return true;
|
3296 |
+
} catch(e){
|
3297 |
+
return false;
|
3298 |
+
}
|
3299 |
+
}
|
3300 |
+
ls.removeItem(key);
|
3301 |
+
return true;
|
3302 |
+
},
|
3303 |
+
getAll: function(){
|
3304 |
+
var items = [];
|
3305 |
+
if (!supported){
|
3306 |
+
try {
|
3307 |
+
var pairs = document.cookie.split(";");
|
3308 |
+
for (var i = 0; i<pairs.length; i++){
|
3309 |
+
var pair = pairs[i].split('=');
|
3310 |
+
var key = pair[0];
|
3311 |
+
items.push({key:key, value:this.parseResult(_inbound.Utils.readCookie(key))});
|
3312 |
+
}
|
3313 |
+
} catch(e){
|
3314 |
+
return null;
|
3315 |
+
}
|
3316 |
+
} else {
|
3317 |
+
for (var j in ls){
|
3318 |
+
if (j.length){
|
3319 |
+
items.push({key:j, value:this.parseResult(ls.getItem(j))});
|
3320 |
+
}
|
3321 |
+
}
|
3322 |
+
}
|
3323 |
+
return items;
|
3324 |
+
},
|
3325 |
+
parseResult: function(res){
|
3326 |
+
var ret;
|
3327 |
+
try {
|
3328 |
+
ret = JSON.parse(res);
|
3329 |
+
if (typeof ret == 'undefined'){
|
3330 |
+
ret = res;
|
3331 |
+
}
|
3332 |
+
if (ret == 'true'){
|
3333 |
+
ret = true;
|
3334 |
+
}
|
3335 |
+
if (ret == 'false'){
|
3336 |
+
ret = false;
|
3337 |
+
}
|
3338 |
+
if (parseFloat(ret) == ret && typeof ret != "object"){
|
3339 |
+
ret = parseFloat(ret);
|
3340 |
+
}
|
3341 |
+
} catch(e){
|
3342 |
+
ret = res;
|
3343 |
+
}
|
3344 |
+
return ret;
|
3345 |
+
}
|
3346 |
+
};
|
3347 |
+
})(_inbound || {});
|
3348 |
+
/**
|
3349 |
+
* Leads API functions
|
3350 |
+
* @param Object _inbound - Main JS object
|
3351 |
+
* @return Object - include event triggers
|
3352 |
+
*/
|
3353 |
+
var _inboundLeadsAPI = (function(_inbound) {
|
3354 |
+
var httpRequest;
|
3355 |
+
_inbound.LeadsAPI = {
|
3356 |
+
init: function() {
|
3357 |
+
|
3358 |
+
var utils = _inbound.Utils,
|
3359 |
+
wp_lead_uid = utils.readCookie("wp_lead_uid"),
|
3360 |
+
wp_lead_id = utils.readCookie("wp_lead_id"),
|
3361 |
+
expire_check = utils.readCookie("lead_data_expire");
|
3362 |
+
|
3363 |
+
if (!expire_check) {
|
3364 |
+
_inbound.deBugger('leads', 'expired vistor. Run Processes');
|
3365 |
+
//var data_to_lookup = global-localized-vars;
|
3366 |
+
if (wp_lead_id) {
|
3367 |
+
/* Get InboundLeadData */
|
3368 |
+
_inbound.LeadsAPI.getAllLeadData();
|
3369 |
+
}
|
3370 |
+
}
|
3371 |
+
},
|
3372 |
+
setGlobalLeadData: function(data) {
|
3373 |
+
InboundLeadData = data;
|
3374 |
+
},
|
3375 |
+
getAllLeadData: function(expire_check) {
|
3376 |
+
var wp_lead_id = _inbound.Utils.readCookie("wp_lead_id"),
|
3377 |
+
leadData = _inbound.totalStorage('inbound_lead_data'),
|
3378 |
+
leadDataExpire = _inbound.Utils.readCookie("lead_data_expire");
|
3379 |
+
data = {
|
3380 |
+
action: 'inbound_get_all_lead_data',
|
3381 |
+
wp_lead_id: wp_lead_id
|
3382 |
+
},
|
3383 |
+
success = function(returnData) {
|
3384 |
+
var leadData = JSON.parse(returnData);
|
3385 |
+
_inbound.LeadsAPI.setGlobalLeadData(leadData);
|
3386 |
+
_inbound.totalStorage('inbound_lead_data', leadData); // store lead data
|
3387 |
+
|
3388 |
+
/* Set 3 day timeout for checking DB for new lead data for Lead_Global var */
|
3389 |
+
var d = new Date();
|
3390 |
+
d.setTime(d.getTime() + 30 * 60 * 1000);
|
3391 |
+
var expire = _inbound.Utils.addDays(d, 3);
|
3392 |
+
_inbound.Utils.createCookie("lead_data_expire", true, expire);
|
3393 |
+
|
3394 |
+
};
|
3395 |
+
|
3396 |
+
if (!leadData) {
|
3397 |
+
// Get New Lead Data from DB
|
3398 |
+
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
|
3399 |
+
|
3400 |
+
} else {
|
3401 |
+
// set global lead var with localstorage data
|
3402 |
+
_inbound.LeadsAPI.setGlobalLeadData(leadData);
|
3403 |
+
_inbound.deBugger('lead', 'Set Global Lead Data from Localstorage');
|
3404 |
+
|
3405 |
+
if (!leadDataExpire) {
|
3406 |
+
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
|
3407 |
+
//console.log('Set Global Lead Data from Localstorage');
|
3408 |
+
_inbound.deBugger('lead', 'localized data old. Pull new from DB');
|
3409 |
+
//console.log('localized data old. Pull new from DB');
|
3410 |
+
}
|
3411 |
+
}
|
3412 |
+
|
3413 |
+
},
|
3414 |
+
getLeadLists: function() {
|
3415 |
+
var wp_lead_id = _inbound.Utils.readCookie("wp_lead_id");
|
3416 |
+
var data = {
|
3417 |
+
action: 'wpl_check_lists',
|
3418 |
+
wp_lead_id: wp_lead_id
|
3419 |
+
};
|
3420 |
+
var success = function(user_id) {
|
3421 |
+
_inbound.Utils.createCookie("lead_session_list_check", true, {
|
3422 |
+
path: '/',
|
3423 |
+
expires: 1
|
3424 |
+
});
|
3425 |
+
_inbound.deBugger('lead', "Lists checked");
|
3426 |
+
//console.log("Lists checked");
|
3427 |
+
};
|
3428 |
+
//_inbound.Utils.doAjax(data, success);
|
3429 |
+
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
|
3430 |
+
}
|
3431 |
+
};
|
3432 |
+
|
3433 |
+
return _inbound;
|
3434 |
+
|
3435 |
+
})(_inbound || {});
|
3436 |
/**
|
3437 |
* # Page View Tracking
|
3438 |
*
|
3827 |
|
3828 |
return _inbound;
|
3829 |
|
3830 |
+
})(_inbound || {});
|
3831 |
/**
|
3832 |
* # Start
|
3833 |
*
|
shared/assets/js/frontend/analytics/inboundAnalytics.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
|
2 |
-
function inboundFormNoRedirect(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form,n=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])');0!=n.length&&"IA=="!=n[0].value||(t.action="javascript:void(0)")}}function inboundFormNoRedirectContent(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),n=jQuery(e).css("background"),o=jQuery(e).css("color"),i=jQuery(e).css("height"),a=e.getElementsByClassName("inbound-form-spinner");0!=t.length&&"IA=="!=t[0].value||(jQuery(a).remove(),jQuery(e).prepend('<div id="redir-check"><i class="fa fa-check-square" aria-hidden="true" style="background='+n+"; color="+o+"; font-size:calc("+i+' * .42);"></i></div>'))}}var inbound_data=inbound_data||{},_inboundOptions=_inboundOptions||{},_gaq=_gaq||[],_inbound=function(e){var t={timeout:inbound_settings.is_admin?500:1e4,formAutoTracking:!0,formAutoPopulation:!0},n={init:function(){_inbound.Utils.init(),_inbound.Utils.domReady(window,function(){_inbound.DomLoaded()})},DomLoaded:function(){_inbound.PageTracking.init(),_inbound.Forms.init(),_inbound.Utils.setUrlParams(),_inbound.LeadsAPI.init(),setTimeout(function(){_inbound.Forms.init()},2e3),_inbound.trigger("analytics_ready")},extend:function(e,t){var n,o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o},debug:function(e,t){},deBugger:function(e,t,n){if(console){var o,i,a,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(a=(r=r.split("-"))[1]),i="true"===_inbound.Utils.readCookie("inbound_debug"),((o="true"===_inbound.Utils.readCookie("inbound_debug_"+e))||s||i)&&(t&&"string"==typeof t&&(i||"all"===a?console.log('logAll "'+e+'" =>',t):o?console.log('log "'+e+'" =>',t):e===a&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},o=n.extend(t,e);return n.Settings=o||{},n}(_inboundOptions),_inboundHooks=function(e){return e.hooks=new function(){function e(e,t,n,o){if(a[e][t])if(n){var i,r=a[e][t];if(o)for(i=r.length;i--;){var s=r[i];s.callback===n&&s.context===o&&r.splice(i,1)}else for(i=r.length;i--;)r[i].callback===n&&r.splice(i,1)}else a[e][t]=[]}function t(e,t,o,i,r){var s={callback:o,priority:i,context:r},l=a[e][t];l?(l.push(s),l=n(l)):l=[s],a[e][t]=l}function n(e){for(var t,n,o,i=1,a=e.length;i<a;i++){for(t=e[i],n=i;(o=e[n-1])&&o.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function o(e,t,n){var o=a[e][t];if(!o)return"filters"===e&&n[0];var i=0,r=o.length;if("filters"===e)for(;i<r;i++)n[0]=o[i].callback.apply(o[i].context,n);else for(;i<r;i++)o[i].callback.apply(o[i].context,n);return"filters"!==e||n[0]}var i={removeFilter:function(t,n){return"string"==typeof t&&e("filters",t,n),i},applyFilters:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?o("filters",t,e):i},addFilter:function(e,n,o,a){return"string"==typeof e&&"function"==typeof n&&t("filters",e,n,o=parseInt(o||10,10)),i},removeAction:function(t,n){return"string"==typeof t&&e("actions",t,n),i},doAction:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&o("actions",t,e),i},addAction:function(e,n,o,a){return"string"==typeof e&&"function"==typeof n&&t("actions",e,n,o=parseInt(o||10,10),a),i}},a={actions:{},filters:{}};return i},e.add_action=function(){var t=arguments[0].split(" ");for(k in t)arguments[0]="inbound."+t[k],e.hooks.addAction.apply(this,arguments);return this},e.remove_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeAction.apply(this,arguments),this},e.do_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.doAction.apply(this,arguments),this},e.add_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.addFilter.apply(this,arguments),this},e.remove_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeFilter.apply(this,arguments),this},e.apply_filters=function(){return arguments[0]="inbound."+arguments[0],e.hooks.applyFilters.apply(this,arguments)},e}(_inbound||{}),_inboundUtils=function(e){var t,n=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,o=(Object.prototype.toString,{api_host:("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/$/,""),track_pageview:!0,track_links_timeout:300,cookie_name:"_sp",cookie_expiration:365,cookie_domain:(host=location.hostname.match(/[a-z0-9][a-z0-9\-]+\.[a-z\.]{2,6}$/i))?host[0]:""});return e.Utils={init:function(){this.polyFills(),this.checkLocalStorage(),this.SetUID(),this.storeReferralData()},polyFills:function(){window.console||(window.console={});for(var e=["log","info","warn","error","debug","trace","dir","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","dirxml","assert","count","markTimeline","timeStamp","clear"],t=0;t<e.length;t++)window.console[e[t]]||(window.console[e[t]]=function(){});Date.prototype.toISOString||function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();try{new CustomEvent("?")}catch(e){this.CustomEvent=function(e,t){function n(t,n,o,i){this["init"+e](t,n,o,i),"detail"in this||(this.detail=i)}return function(o,i){var a=document.createEvent(e);return null!==o?n.call(a,o,(i||(i=t)).bubbles,i.cancelable,i.detail):a.initCustomEvent=n,a}}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),o=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)(t=document._qsa.shift()).style.removeAttribute("x-qsa"),o.push(t);return document._qsa=null,o}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var e,t=window.getSelection(),n=[],o=0;o<t.rangeCount;o++)n[o]=t.getRangeAt(o);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(o=0;o<n.length;o++)t.addRange(n[o]);return e})},createCookie:function(e,t,n){var o="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}document.cookie=e+"="+t+o+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.length)}return null},eraseCookie:function(e){this.createCookie(e,"",-1)},getAllCookies:function(){var t={};if(document.cookie&&""!==document.cookie)for(var n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o].split("=");i[0]=i[0].replace(/^ /,""),t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e.totalStorage("inbound_cookies",t),t},setUrlParams:function(){var n={};!function(){for(var e,t=function(e){return decodeURIComponent(e).replace(/\+/g," ")},o=window.location.search.substring(1),i=/([^&=]+)=?([^&]*)/g;e=i.exec(o);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var a=e[1].indexOf("["),r=e[1].slice(a+1,e[1].indexOf("]",a)),s=t(e[1].slice(0,a));"object"!=typeof n[s]&&(n[t(s)]={},n[t(s)].length=0),r?n[t(s)][t(r)]=t(e[2]):Array.prototype.push.call(n[t(s)],t(e[2]))}}();for(var o in n)if("action"!=o)if("object"==typeof n[o])for(var i in n[o])this.createCookie(i,n[o][i],30);else this.createCookie(o,n[o],30);if(t){var a=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(a,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){n={};if(t)var n=e.totalStorage("inbound_url_params");return n},getParameterVal:function(e,t){return(RegExp(e+"=(.+?)(&|$)").exec(t)||[,!1])[1]},checkLocalStorage:function(){if("localStorage"in window)try{ls=void 0===window.localStorage?void 0:window.localStorage,t="undefined"!=typeof ls&&void 0!==window.JSON}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}var n=Object.keys(localStorage).map(function(t){return{name:t,size:e(localStorage[t])}}).map(function(e){return e.size=t(e.size).toFixed(2)+" MB",e});console.table(n)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=t<10?"0":"",o=e.getFullYear(),i=e.getHours(),a=i<10?"0":"",r=e.getMinutes(),s=r<10?"0":"",l=e.getSeconds(),u=l<10?"0":"",d=e.getMonth()+1;return o+"/"+(d<10?"0":"")+d+"/"+n+t+" "+a+i+":"+s+r+":"+u+l},SetSessionTimeout:function(){this.readCookie("lead_session_expire");var e=new Date;e.setTime(e.getTime()+18e5),this.createCookie("lead_session_expire",!0,e)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",o=e.Utils.readCookie("inbound_referral_site"),i=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),o||this.createCookie("inbound_referral_site",n,t),i||e.totalStorage("inbound_original_referral",i)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n},generateGUID:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,guid)},SetUID:function(e){if(!this.readCookie("wp_lead_uid")){var t=e||this.CreateUID(35);this.createCookie("wp_lead_uid",t)}},countProperties:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&++t;return t},mergeObjs:function(e,t){var n={};for(var o in e)n[o]=e[o];for(var o in t)n[o]=t[o];return n},hasClass:function(e,t){if("classList"in document.documentElement)n=t.classList.contains(e);else var n=new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className);return n},addClass:function(e,t){"classList"in document.documentElement?t.classList.add(e):this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)},removeClass:function(e,t){"classList"in document.documentElement?t.classList.remove(e):this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)*"+e+"(\\s|$)*","g"),""))},removeElement:function(e){e.parentNode.removeChild(e)},trim:function(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,"\n")},ajaxPolyFill:function(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(var e,t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(e){}return e},ajaxSendData:function(e,t,n,o,i){var a=this.ajaxPolyFill();setTimeout(function(){a.open(n,e,!0),a.onreadystatechange=function(){4==a.readyState&&t(a.responseText)},"POST"==n&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(o)},100)},ajaxGet:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e+"?"+i.join("&"),n,"GET",null,o)},ajaxPost:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e,n,"POST",i.join("&"),o)},sendEvent:function(e,t,i){t=t||{},async=!0;var a=getCookie();if(a){var r;for(r in a)t[r]=a[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=o.api_host+"/track?data="+encodeURIComponent(JSON.stringify(s));if(n){var u=new XMLHttpRequest;u.open("GET",l,async),u.withCredentials=async,u.send(null)}else{var d=document.createElement("script");d.type="text/javascript",d.async=async,d.defer=async,d.src=l;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(d,c)}return action(i),self},domReady:function(e,t){var n=!1,o=!0,i=e.document,a=i.documentElement,r=i.addEventListener?"addEventListener":"attachEvent",s=i.addEventListener?"removeEventListener":"detachEvent",l=i.addEventListener?"":"on",u=function(o){"readystatechange"==o.type&&"complete"!=i.readyState||(("load"==o.type?e:i)[s](l+o.type,u,!1),!n&&(n=!0)&&t.call(e,o.type||o))},d=function(){try{a.doScroll("left")}catch(e){return void setTimeout(d,50)}u("poll")};if("complete"==i.readyState)t.call(e,"lazy");else{if(i.createEventObject&&a.doScroll){try{o=!e.frameElement}catch(e){}o&&d()}i[r](l+"DOMContentLoaded",u,!1),i[r](l+"readystatechange",u,!1),e[r](l+"load",u,!1)}},addListener:function(e,t,n){e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},removeListener:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},throttle:function(e,t){var n,o,i,a=null,r=0,s=function(){r=new Date,a=null,i=e.apply(n,o)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,o=arguments,u<=0?(clearTimeout(a),a=null,r=l,i=e.apply(n,o)):a||(a=setTimeout(s,u)),i}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),void 0!==_gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)},cacheSearchData:function(n,o){if(t){var i=e.totalStorage.getItem("inbound_search_storage");if(i)i.unshift(n),e.totalStorage.setItem("inbound_search_storage",i);else{var a=[n];e.totalStorage.setItem("inbound_search_storage",a)}}else{var r=JSON.stringify(n),s=this.readCookie("inbound_search_storage");s&&(r+="SPLIT-TOKEN"+s),this.createCookie("inbound_search_storage",r,"180")}e.Forms.releaseFormSubmit(o)},storeSearchData:function(){if(inbound_settings.wp_lead_data.lead_id&&inbound_settings.wp_lead_data.lead_nonce){var t=[],n=e.totalStorage.getItem("inbound_search_storage"),o=this.readCookie("inbound_search_storage");if(n||o){if(o){o=o.split("SPLIT-TOKEN");for(var i in o)t.push(JSON.parse(o[i]))}n&&(t=t.concat(n)),t.sort(function(e,t){return e.timestamp-t.timestamp});var a={action:"inbound_search_store",data:t=encodeURIComponent(JSON.stringify(t)),nonce:inbound_settings.wp_lead_data.lead_nonce,lead_id:inbound_settings.wp_lead_data.lead_id};callback=function(t){t&&(t=JSON.parse(t)),t.success&&(console.log(t.success),e.Utils.eraseCookie("inbound_search_storage"),e.totalStorage.deleteItem("inbound_search_storage")),t.error&&console.log(t.error)},this.ajaxPost(inbound_settings.admin_url,a,callback)}}}},e}(_inbound||{}),InboundForms=function(e){var t=e.Utils,n=[],o=[],a=[],r={},s=e.Settings,l=["first name","last name","name","email","e-mail","phone","website","job title","your favorite food","company","tele","address","comment"];if(e.Forms={init:function(){e.Forms.runFieldMappingFilters(),e.Forms.formTrackInit(),e.Forms.searchTrackInit()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,t){return},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=window.document.forms[e];t.dataset.formProcessed||(t.dataset.formProcessed=!0,this.checkTrackStatus(t)&&(this.attachFormSubmitEvent(t),this.initFormMapping(t)))}},searchTrackInit:function(){if("off"!=inbound_settings.search_tracking&&!r.searchTrackInit){for(var e=0;e<window.document.forms.length;e++){var n=window.document.forms[e];n.dataset.searchChecked||(n.dataset.searchChecked=!0,this.checkSearchTrackStatus(n)&&this.attachSearchFormSubmitEvent(n))}t.storeSearchData(),r.searchTrackInit=!0}},checkTrackStatus:function(t){var n=t.getAttribute("class");if(""!==n&&null!==n)return n.toLowerCase().indexOf("wpl-track-me")>-1||(n.toLowerCase().indexOf("inbound-track")>-1||(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1))},checkSearchTrackStatus:function(t){var n=t.getAttribute("class"),o=t.getAttribute("id");return""!==n&&null!==n&&n.toLowerCase().indexOf("search")>-1||(""===o||null===o?(cb=function(){console.log(t)},e.deBugger("searches","This search form is not tracked. Please assign on in settings...",cb),!1):o.toLowerCase().indexOf("search")>-1||void 0)},loopClassSelectors:function(n,o){for(var i=n.length-1;i>=0;i--){var a=t.trim(n[i]);-1===a.indexOf("#")&&-1===a.indexOf(".")&&(a="#"+a),(a=document.querySelector(a))&&("add"===o?(e.Utils.addClass("wpl-track-me",a),e.Utils.addClass("inbound-track",a)):(e.Utils.removeClass("wpl-track-me",a),e.Utils.removeClass("inbound-track",a)))}},initFormMapping:function(t){for(var n=[],o=0;o<t.elements.length;o++)formInput=t.elements[o],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&!e.Utils.hasClass("nopopulate",t)&&this.fillInputValues(formInput)):n.push(formInput);for(var i=n.length-1;i>=0;i--)formInput=n[i],this.mapField(formInput)},mapField:function(o){var a=o.id||!1,r=o.name||!1,s=this.getInputLabel(o);if(s&&this.ignoreFieldByLabel(s[0].innerText))return o.dataset.ignoreFormField=!0,!1;for(i=0;i<l.length;i++){var u=!1,d=l[i],c=t.trim(d),m=c.replace(/ /g,"_");r&&r.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching name attribute for -> "+c)):a&&a.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching ID attribute for ->"+c)):s?s[0].innerText.toLowerCase().indexOf(c)>-1&&(u=!0,e.deBugger("forms","Found matching sibling label for -> "+c)):n.push(c),u&&(this.addDataAttr(o,m),this.removeArrayItem(l,c),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},searchFormListener:function(t){t.preventDefault(),e.Forms.saveSearchData(t.target)},attachFormSubmitEvent:function(e){t.addListener(e,"submit",this.formListener);document.querySelector(".inbound-email")},attachSearchFormSubmitEvent:function(e){t.addListener(e,"submit",this.searchFormListener)},ignoreFieldByLabel:function(t){var n=!1;return!!t&&(-1==t.toLowerCase().indexOf("credit card")&&-1==t.toLowerCase().indexOf("card number")||(n=!0),-1==t.toLowerCase().indexOf("expiration")&&-1==t.toLowerCase().indexOf("expiry")||(n=!0),"month"!=t.toLowerCase()&&"mm"!=t.toLowerCase()&&"yy"!=t.toLowerCase()&&"yyyy"!=t.toLowerCase()&&"year"!=t.toLowerCase()||(n=!0),-1==t.toLowerCase().indexOf("cvv")&&-1==t.toLowerCase().indexOf("cvc")&&-1==t.toLowerCase().indexOf("secure code")&&-1==t.toLowerCase().indexOf("security code")||(n=!0),n&&e.deBugger("forms","ignore "+t),n)},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;if("visa"!=e.toLowerCase()&&"mastercard"!=e.toLowerCase()&&"american express"!=e.toLowerCase()&&"amex"!=e.toLowerCase()&&"discover"!=e.toLowerCase()||(t=!0),new RegExp("/^[0-9]+$/").test(e)){var n=e.replace(" ","");this.isInt(n)&&n.length>=16&&(t=!0)}return t},isInt:function(e){return"number"==typeof e&&isFinite(e)&&e%1==0},releaseFormSubmit:function(e){document.body.style.cursor="default",t.removeClass("wpl-track-me",e),t.removeListener(e,"submit",this.formListener);var n=e.getAttribute("class");if(""!==n&&null!==n&&-1!=n.toLowerCase().indexOf("wpcf7-form"))return setTimeout(function(){document.body.style.cursor="default"},300),!0;e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&"submit"===formInput.name&&e.elements[t].click()},2e3)},saveFormData:function(n){for(var i=i||{},r=0;r<n.elements.length;r++)if(formInput=n.elements[r],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),i[inputName]||(i[inputName]={}),formInput.type&&(i[inputName].type=formInput.type),i[inputName].name||(i[inputName].name=formInput.name),formInput.dataset.mapFormField&&(i[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(l=this.getInputValue(formInput)))continue;break;case"TEXTAREA":l=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var s=0;s<formInput.length;s++)formInput[s].selected&&values.push(encodeURIComponent(formInput[s].value))}else l=formInput.value}if(e.deBugger("forms","Input Value = "+l),l){i[inputName].value||(i[inputName].value=[]),i[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",i);for(var u in i){var d=i[u].value,c=i[u].map;if(void 0!==d&&null!=d&&""!=d&&o.push(u+"="+i[u].value.join(",")),void 0!==c&&null!=c&&i[u].value&&(a.push(c+"="+i[u].value.join(",")),"email"===u))var m=i[u].value.join(",")}var f=o.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=a.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g),(m=t.getParameterVal("email",g)||t.readCookie("wp_lead_email"))||(m=t.getParameterVal("wpleads_email_address",g));var p=t.getParameterVal("name",g),h=t.getParameterVal("first_name",g),v=t.getParameterVal("last_name",g);if(!v&&h&&(_=decodeURI(h).split(" ")).length>0&&(h=_[0],v=_[1]),p&&!v&&!h){var _=decodeURI(p).split(" ");_.length>0&&(h=_[0],v=_[1])}p=h&&v?h+" "+v:p,h||(h=""),v||(v=""),e.deBugger("forms","fName = "+h),e.deBugger("forms","lName = "+v),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{},w=n.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),k=!1;if(0==w.length||"IA=="==w[0].value)k=!0;var S=n.querySelectorAll('input[value][type="hidden"][name="inbound_form_id"]');S=S.length>0?S[0].value:0;if("undefined"!=typeof landing_path_info)C=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)C=cta_path_info.variation;else var C=inbound_settings.variation_id;var I=inbound_settings.post_type||"page",L=inbound_settings.post_id||0;search_data={},formData={action:"inbound_lead_store",email:m,full_name:p,first_name:h,last_name:v,raw_params:f,mapped_params:g,url_params:JSON.stringify(y),search_data:"test",page_views:JSON.stringify(b),post_type:I,page_id:L,variation:C,source:t.readCookie("inbound_referral_site"),inbound_submitted:k,inbound_form_id:S,inbound_nonce:inbound_settings.ajax_nonce,event:n},callback=function(o){e.deBugger("forms","Lead Created with ID: "+o),o=parseInt(o,10),formData.leadID=o,o&&(t.createCookie("wp_lead_id",o),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(n)},e.trigger("form_before_submission",formData),t.ajaxPost(inbound_settings.admin_url,formData,callback)},saveSearchData:function(n){for(var o=o||{},i=0;i<n.elements.length;i++)if(formInput=n.elements[i],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("searches","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),o[inputName]||(o[inputName]={}),formInput.type&&(o[inputName].type=formInput.type),o[inputName].name||(o[inputName].name=formInput.name),formInput.dataset.mapFormField&&(o[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(r=this.getInputValue(formInput)))continue;break;case"TEXTAREA":r=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var a=0;a<formInput.length;a++)formInput[a].selected&&values.push(encodeURIComponent(formInput[a].value))}else r=formInput.value}if(e.deBugger("searches","Input Value = "+r),r){o[inputName].value||(o[inputName].value=[]),o[inputName].value.push(multiple?values.join(","):encodeURIComponent(r));var r=multiple?values.join(","):encodeURIComponent(r)}}e.deBugger("searches",o);var s=[];for(var l in o){var u=o[l].value,d=o[l].type;void 0!==u&&null!=u&&""!=u&&"search"==d&&s.push("search_text|value|"+o[l].value)}if(s[0]){var c=s.join("|field|");if(e.deBugger("searches","Stringified Search Form PARAMS: "+c),"undefined"!=typeof landing_path_info)m=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)m=cta_path_info.variation;else var m=inbound_settings.variation_id;var f=inbound_settings.post_type||"page",g=inbound_settings.post_id||0,p=t.readCookie("wp_lead_uid");inbound_settings.wp_lead_data.lead_email?email=inbound_settings.wp_lead_data.lead_email:t.readCookie("inbound_wpleads_email_address")?email=t.readCookie("inbound_wpleads_email_address"):email="",searchData={email:email,search_data:c,user_UID:p,post_type:f,page_id:g,variation:m,source:t.readCookie("inbound_referral_site"),ip_address:inbound_settings.ip_address,timestamp:Math.floor((new Date).getTime()/1e3)},e.trigger("search_before_caching",searchData),inbound_settings.wp_lead_data.lead_id?(searchData.lead_id=inbound_settings.wp_lead_data.lead_id,t.cacheSearchData(searchData,n)):t.cacheSearchData(searchData,n)}},rememberInputValues:function(n){n.name&&n.name;var o=n.type?n.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o||n.dataset.ignoreFormField)return!1;t.addListener(n,"change",function(n){if(n.target.name){if("checkbox"!==o)var i=n.target.value;else for(var a=[],r=document.querySelectorAll('input[name="'+n.target.name+'"]'),s=0;s<r.length;s++)r[s].checked&&a.push(r[s].value),i=a.join(",");inputData={name:n.target.name,node:n.target.nodeName.toLowerCase(),type:o,value:i,mapping:n.target.dataset.mapFormField},e.trigger("form_input_change",inputData),t.createCookie("inbound_"+n.target.name,encodeURIComponent(i))}})},fillInputValues:function(e){var n=e.name?"inbound_"+e.name:"",o=e.type?e.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o)return!1;if(t.readCookie(n)&&"comment"!=n)if(value=decodeURIComponent(t.readCookie(n)),"checkbox"===o||"radio"===o)for(var i=value.split(","),a=0;a<i.length;a++)e.value.indexOf(i[a])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},getInputLabel:function(e){var t;return(t=this.siblingsIsLabel(e))?t:!!(t=this.CheckParentForLabel(e))&&t},getInputValue:function(e){var t=!1;switch(e.type){case"radio":case"checkbox":e.checked&&(t=e.value);break;case"text":case"hidden":default:t=e.value}return t},addDataAttr:function(e,t){for(var n=document.getElementsByName(e.name),o=n.length-1;o>=0;o--)e.dataset.mapFormField||(n[o].dataset.mapFormField=t)},removeArrayItem:function(e,t){if(e.indexOf)index=e.indexOf(t);else for(index=e.length-1;index>=0&&e[index]!==t;--index);index>=0&&e.splice(index,1)},siblingsIsLabel:function(e){for(var t=this.getSiblings(e),n=[],o=t.length-1;o>=0;o--)"label"===t[o].nodeName.toLowerCase()&&n.push(t[o]);return n.length>0&&n.length<2&&n},getChildren:function(e,t){for(var n=[];e;e=e.nextSibling)1==e.nodeType&&e!=t&&n.push(e);return n},getSiblings:function(e){return this.getChildren(e.parentNode.firstChild,e)},CheckParentForLabel:function(e){if("FORM"===e.nodeName)return null;do{var t=e.getElementsByTagName("label");if(t.length>0&&t.length<2)return e.getElementsByTagName("label")}while(e=e.parentNode);return null},mailCheck:function(){var e=document.querySelector(".inbound-email");e&&(t.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(n){var o=document.querySelector(".email_suggestion");o&&t.removeElement(o);var i=document.createElement("span");i.innerHTML="<span class=\"email_suggestion\">Did youu mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+n.full+"</b></i>?</span>",e.parentNode.insertBefore(i,e.nextSibling);var a=document.getElementById("email_correction");t.addListener(a,"click",function(){e.value=a.innerHTML,a.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},void 0===u)var u={domainThreshold:1,topLevelThreshold:3,defaultDomains:["yahoo.com","google.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","mail.com","outlook.com","icloud.com"],defaultTopLevelDomains:["co.jp","co.uk","com","net","org","info","edu","gov","mil","ca","de"],run:function(e){e.domains=e.domains||u.defaultDomains,e.topLevelDomains=e.topLevelDomains||u.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||u.sift3Distance;var t=function(e){return e},n=e.suggested||t,o=e.empty||t,i=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return i?n(i):o()},suggest:function(e,t,n,o){e=e.toLowerCase();var i=this.splitEmail(e),a=this.findClosestDomain(i.domain,t,o,this.domainThreshold);if(a){if(a!=i.domain)return{address:i.address,domain:a,full:i.address+"@"+a}}else{var r=this.findClosestDomain(i.topLevelDomain,n,o,this.topLevelThreshold);if(i.domain&&r&&r!=i.topLevelDomain){var s=i.domain;return a=s.substring(0,s.lastIndexOf(i.topLevelDomain))+r,{address:i.address,domain:a,full:i.address+"@"+a}}}return!1},findClosestDomain:function(e,t,n,o){o=o||this.topLevelThreshold;var i,a=99,r=null;if(!e||!t)return!1;n||(n=this.sift3Distance);for(var s=0;s<t.length;s++){if(e===t[s])return e;(i=n(e,t[s]))<a&&(a=i,r=t[s])}return a<=o&&null!==r&&r},sift3Distance:function(e,t){if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(var n=0,o=0,i=0,a=0;n+o<e.length&&n+i<t.length;){if(e.charAt(n+o)==t.charAt(n+i))a++;else{o=0,i=0;for(var r=0;r<5;r++){if(n+r<e.length&&e.charAt(n+r)==t.charAt(n)){o=r;break}if(n+r<t.length&&e.charAt(n)==t.charAt(n+r)){i=r;break}}}n++}return(e.length+t.length)/2-a},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(a=0;a<t.length;a++)if(""===t[a])return!1;var n=t.pop(),o=n.split("."),i="";if(0===o.length)return!1;if(1==o.length)i=o[0];else{for(var a=1;a<o.length;a++)i+=o[a]+".";o.length>=2&&(i=i.substring(0,i.length-1))}return{topLevelDomain:i,domain:n,address:t.join("@")}},encodeEmail:function(e){var t=encodeURI(e);return t=t.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return e}(_inbound||{}),_inboundEvents=function(e){function t(t,o,i){var o=o||{};(i=i||{}).bubbles=i.bubbles||!0,i.cancelable=i.cancelable||!0,o=e.apply_filters("filter_"+t,o);!window.ActiveXObject&&window;if("function"==typeof CustomEvent)var a=new CustomEvent(t,{detail:o,bubbles:i.bubbles,cancelable:i.cancelable});else(a=document.createEvent("Event")).initEvent(t,!0,!0);window.dispatchEvent(a),e.do_action(t,o),n(t,o)}function n(e,t){if(window.jQuery){var t=t||{};jQuery(document).trigger(e,t)}}e.trigger=function(t,n){e.Events[t](n)};return e.Events={analytics_ready:function(){t("analytics_ready",{data:"xyxy"},{opt1:!0})},url_parameters:function(e){t("url_parameters",e)},session_start:function(){console.log(""),t("session_start")},session_end:function(e){t("session_end",e),console.log("Session End")},session_active:function(){t("session_active")},session_idle:function(e){t("session_idle",e)},session_resume:function(){t("session_resume")},session_heartbeat:function(e){t("session_heartbeat",{clock:e,leadData:InboundLeadData})},page_visit:function(e){t("page_view",e)},page_first_visit:function(n){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);e.deBugger("pages",status,function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")})},tab_hidden:function(n){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(n){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(n){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){e.deBugger("forms","inputData change. Data=",function(){console.log(n)}),t("form_input_change",n)},form_before_submission:function(e){t("form_before_submission",e)},form_after_submission:function(e){t("form_after_submission",e)},search_before_caching:function(e){t("search_before_caching",e)},analyticsError:function(e,t,n){var o=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(o),console.log("Page Save Error")}},e}(_inbound||{});_inbound.add_action("form_before_submission",inboundFormNoRedirect,10),_inbound.add_action("form_after_submission",inboundFormNoRedirectContent,10);var InboundTotalStorage=function(e){var t,n;if("localStorage"in window)try{n=void 0===window.localStorage?void 0:window.localStorage,t=void 0!==n&&void 0!==window.JSON,window.localStorage.setItem("_inbound","1"),window.localStorage.removeItem("_inbound")}catch(e){t=!1}e.totalStorage=function(t,n,o){return e.totalStorage.impl.init(t,n)},e.totalStorage.setItem=function(t,n){return e.totalStorage.impl.setItem(t,n)},e.totalStorage.getItem=function(t){return e.totalStorage.impl.getItem(t)},e.totalStorage.getAll=function(){return e.totalStorage.impl.getAll()},e.totalStorage.deleteItem=function(t){return e.totalStorage.impl.deleteItem(t)},e.totalStorage.impl={init:function(e,t){return void 0!==t?this.setItem(e,t):this.getItem(e)},setItem:function(o,i){if(!t)try{return e.Utils.createCookie(o,i),i}catch(e){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var a=JSON.stringify(i);return n.setItem(o,a),this.parseResult(a)},getItem:function(o){if(!t)try{return this.parseResult(e.Utils.readCookie(o))}catch(e){return null}var i=n.getItem(o);return this.parseResult(i)},deleteItem:function(o){if(!t)try{return e.Utils.eraseCookie(o,null),!0}catch(e){return!1}return n.removeItem(o),!0},getAll:function(){var o=[];if(t)for(var i in n)i.length&&o.push({key:i,value:this.parseResult(n.getItem(i))});else try{for(var a=document.cookie.split(";"),r=0;r<a.length;r++){var s=a[r].split("=")[0];o.push({key:s,value:this.parseResult(e.Utils.readCookie(s))})}}catch(e){return null}return o},parseResult:function(e){var t;try{void 0===(t=JSON.parse(e))&&(t=e),"true"==t&&(t=!0),"false"==t&&(t=!1),parseFloat(t)==t&&"object"!=typeof t&&(t=parseFloat(t))}catch(n){t=e}return t}}}(_inbound||{}),_inboundLeadsAPI=function(e){return e.LeadsAPI={init:function(){var t=e.Utils,n=(t.readCookie("wp_lead_uid"),t.readCookie("wp_lead_id"));t.readCookie("lead_session_expire")||(e.deBugger("leads","expired vistor. Run Processes"),n&&e.LeadsAPI.getAllLeadData())},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(t){var n=e.Utils.readCookie("wp_lead_id"),o=e.totalStorage("inbound_lead_data"),i=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:n},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var o=new Date;o.setTime(o.getTime()+18e5);var i=e.Utils.addDays(o,3);e.Utils.createCookie("lead_data_expire",!0,i)},o?(e.LeadsAPI.setGlobalLeadData(o),e.deBugger("lead","Set Global Lead Data from Localstorage"),i||(e.Utils.ajaxPost(inbound_settings.admin_url,data,success),e.deBugger("lead","localized data old. Pull new from DB"))):e.Utils.ajaxPost(inbound_settings.admin_url,data,success)},getLeadLists:function(){var t={action:"wpl_check_lists",wp_lead_id:e.Utils.readCookie("wp_lead_id")};e.Utils.ajaxPost(inbound_settings.admin_url,t,function(t){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")})}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,o=!1,i=!1,a=!1,r=parseInt(e.Utils.readCookie("lead_session"),10)||0,s=0,l=(new Date,null),u=null,d=null,c=e.Utils,m=e.Utils.GetDate(),f="page_views",g=e.totalStorage(f)||{},p=inbound_settings.post_id||window.location.pathname,h=e.Settings.timeout||1e4;return e.PageTracking={init:function(o){this.CheckTimeOut(),o=o||{},t=parseInt(o.reportInterval,10)||10,n=parseInt(o.idleTimeout,10)||3,c.addListener(document,"keydown",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(document,"click",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(window,"mousemove",c.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession()},setIdle:function(t){var n="Session IDLE. Activity Timeout due to "+(t=t||"No Movement");e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n;void 0!==document.hidden?(t="hidden",n="visibilitychange"):void 0!==document.mozHidden?(t="mozHidden",n="mozvisibilitychange"):void 0!==document.msHidden?(t="msHidden",n="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",n="webkitvisibilitychange");var o=document[t];e.Utils.addListener(document,n,function(n){o!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),o=document[t])})},clock:function(){var n="Total time spent on Page in this Session: "+((r+=1)/60).toFixed(2)+" min";if(e.deBugger("pages",n),r>0&&r%t==0){var o=new Date;o.setTime(o.getTime()+18e5),c.createCookie("lead_session",r,o),e.trigger("session_heartbeat",r)}},inactiveClock:function(){var t="Time until Session Timeout: "+((1800-(s+=1))/60).toFixed(2)+" min";e.deBugger("pages",t),s>1800&&(e.trigger("session_end",InboundLeadData),e.Utils.eraseCookie("lead_session"),s=0,clearTimeout(u))},stopClock:function(){i=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){i=!1,e.trigger("session_resume"),e.deBugger("pages","Activity resumed. Session Active"),clearTimeout(l),s=0,clearTimeout(u),l=setInterval(e.PageTracking.clock,1e3)},turnOff:function(){e.PageTracking.setIdle(),a=!0},turnOn:function(){a=!1},startSession:function(){new Date;if(o=!0,l=setInterval(e.PageTracking.clock,1e3),c.readCookie("lead_session"))e.trigger("session_active");else{e.trigger("session_start");var t=new Date;t.setTime(t.getTime()+18e5),e.Utils.createCookie("lead_session",1,t)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){a||(o||e.PageTracking.startSession(),i&&e.PageTracking.restartClock(),clearTimeout(d),d=setTimeout(e.PageTracking.setIdle,1e3*n+100),void 0!==t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){if(e.Utils.checkLocalStorage()){var t=localStorage.getItem(f),n=JSON.parse(t);return n}},isRevisit:function(e){var t=!1,n=(e=e||{})[p];return void 0!==n&&null!==n&&(t=!0),t},triggerPageView:function(t){var n={title:document.title,url:document.location.href,path:document.location.pathname,count:1};t?(g[p].push(m),n.count=g[p].length,e.trigger("page_revisit",n)):(g[p]=[],g[p].push(m),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage(f,g),this.storePageView()},CheckTimeOut:function(){var t,n=this.isRevisit(g);if(n){var o=g[p].length-1,i=g[p][o],a=Math.abs(new Date(i).getTime()-new Date(m).getTime());a>h?(t="Timeout Happened. Page view fired",this.triggerPageView(n)):(time_left=.001*Math.abs(h-a),t=h/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(n);e.deBugger("pages",t)},storePageView:function(){var t=!1;"off"==inbound_settings.page_tracking&&"landing-page"!=inbound_settings.post_type||(document.onreadystatechange=function(){"loading"!==document.readyState&&!1===t&&setTimeout(function(){var n=e.Utils.readCookie("wp_lead_id")?e.Utils.readCookie("wp_lead_id"):"",o=e.Utils.readCookie("wp_lead_uid")?e.Utils.readCookie("wp_lead_uid"):"",i=e.totalStorage("wp_cta_loaded"),a=e.totalStorage("wp_cta_impressions");t=!0,e.totalStorage("wp_cta_impressions",{});var r={action:"inbound_track_lead",wp_lead_uid:o,wp_lead_id:n,page_id:inbound_settings.post_id,variation_id:inbound_settings.variation_id,post_type:inbound_settings.post_type,current_url:window.location.href,page_views:JSON.stringify(e.PageTracking.getPageViews()),cta_impressions:JSON.stringify(a),cta_history:JSON.stringify(i),json:"0"};e.Utils.ajaxPost(inbound_settings.admin_url,r,function(e){})},200)})}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
|
1 |
+
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
|
2 |
+
function inboundFormNoRedirect(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form,n=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])');0!=n.length&&"IA=="!=n[0].value||(t.action="javascript:void(0)")}}function inboundFormNoRedirectContent(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),n=jQuery(e).css("background"),o=jQuery(e).css("color"),i=jQuery(e).css("height"),a=e.getElementsByClassName("inbound-form-spinner");0!=t.length&&"IA=="!=t[0].value||(jQuery(a).remove(),jQuery(e).prepend('<div id="redir-check"><i class="fa fa-check-square" aria-hidden="true" style="background='+n+"; color="+o+"; font-size:calc("+i+' * .42);"></i></div>'))}}var inbound_data=inbound_data||{},_inboundOptions=_inboundOptions||{},_gaq=_gaq||[],_inbound=function(e){var t={timeout:inbound_settings.is_admin?500:1e4,formAutoTracking:!0,formAutoPopulation:!0},n={init:function(){_inbound.Utils.init(),_inbound.Utils.domReady(window,function(){_inbound.DomLoaded()})},DomLoaded:function(){_inbound.PageTracking.init(),_inbound.Forms.init(),_inbound.Utils.setUrlParams(),_inbound.LeadsAPI.init(),setTimeout(function(){_inbound.Forms.init()},2e3),_inbound.trigger("analytics_ready")},extend:function(e,t){var n,o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o},debug:function(e,t){},deBugger:function(e,t,n){if(console){var o,i,a,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(a=(r=r.split("-"))[1]),i="true"===_inbound.Utils.readCookie("inbound_debug"),((o="true"===_inbound.Utils.readCookie("inbound_debug_"+e))||s||i)&&(t&&"string"==typeof t&&(i||"all"===a?console.log('logAll "'+e+'" =>',t):o?console.log('log "'+e+'" =>',t):e===a&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},o=n.extend(t,e);return n.Settings=o||{},n}(_inboundOptions),_inboundHooks=function(e){return e.hooks=new function(){function e(e,t,n,o){if(a[e][t])if(n){var i,r=a[e][t];if(o)for(i=r.length;i--;){var s=r[i];s.callback===n&&s.context===o&&r.splice(i,1)}else for(i=r.length;i--;)r[i].callback===n&&r.splice(i,1)}else a[e][t]=[]}function t(e,t,o,i,r){var s={callback:o,priority:i,context:r},l=a[e][t];l?(l.push(s),l=n(l)):l=[s],a[e][t]=l}function n(e){for(var t,n,o,i=1,a=e.length;i<a;i++){for(t=e[i],n=i;(o=e[n-1])&&o.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function o(e,t,n){var o=a[e][t];if(!o)return"filters"===e&&n[0];var i=0,r=o.length;if("filters"===e)for(;i<r;i++)n[0]=o[i].callback.apply(o[i].context,n);else for(;i<r;i++)o[i].callback.apply(o[i].context,n);return"filters"!==e||n[0]}var i={removeFilter:function(t,n){return"string"==typeof t&&e("filters",t,n),i},applyFilters:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?o("filters",t,e):i},addFilter:function(e,n,o,a){return"string"==typeof e&&"function"==typeof n&&t("filters",e,n,o=parseInt(o||10,10)),i},removeAction:function(t,n){return"string"==typeof t&&e("actions",t,n),i},doAction:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&o("actions",t,e),i},addAction:function(e,n,o,a){return"string"==typeof e&&"function"==typeof n&&t("actions",e,n,o=parseInt(o||10,10),a),i}},a={actions:{},filters:{}};return i},e.add_action=function(){var t=arguments[0].split(" ");for(k in t)arguments[0]="inbound."+t[k],e.hooks.addAction.apply(this,arguments);return this},e.remove_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeAction.apply(this,arguments),this},e.do_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.doAction.apply(this,arguments),this},e.add_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.addFilter.apply(this,arguments),this},e.remove_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeFilter.apply(this,arguments),this},e.apply_filters=function(){return arguments[0]="inbound."+arguments[0],e.hooks.applyFilters.apply(this,arguments)},e}(_inbound||{}),_inboundUtils=function(e){var t,n=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,o=(Object.prototype.toString,{api_host:("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/$/,""),track_pageview:!0,track_links_timeout:300,cookie_name:"_sp",cookie_expiration:365,cookie_domain:(host=location.hostname.match(/[a-z0-9][a-z0-9\-]+\.[a-z\.]{2,6}$/i))?host[0]:""});return e.Utils={init:function(){this.polyFills(),this.checkLocalStorage(),this.SetUID(),this.storeReferralData()},polyFills:function(){window.console||(window.console={});for(var e=["log","info","warn","error","debug","trace","dir","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","dirxml","assert","count","markTimeline","timeStamp","clear"],t=0;t<e.length;t++)window.console[e[t]]||(window.console[e[t]]=function(){});Date.prototype.toISOString||function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();try{new CustomEvent("?")}catch(e){this.CustomEvent=function(e,t){function n(t,n,o,i){this["init"+e](t,n,o,i),"detail"in this||(this.detail=i)}return function(o,i){var a=document.createEvent(e);return null!==o?n.call(a,o,(i||(i=t)).bubbles,i.cancelable,i.detail):a.initCustomEvent=n,a}}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),o=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)(t=document._qsa.shift()).style.removeAttribute("x-qsa"),o.push(t);return document._qsa=null,o}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var e,t=window.getSelection(),n=[],o=0;o<t.rangeCount;o++)n[o]=t.getRangeAt(o);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(o=0;o<n.length;o++)t.addRange(n[o]);return e})},createCookie:function(e,t,n){var o="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}document.cookie=e+"="+t+o+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.length)}return null},eraseCookie:function(e){this.createCookie(e,"",-1)},getAllCookies:function(){var t={};if(document.cookie&&""!==document.cookie)for(var n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o].split("=");i[0]=i[0].replace(/^ /,""),t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e.totalStorage("inbound_cookies",t),t},setUrlParams:function(){var n={};!function(){for(var e,t=function(e){return decodeURIComponent(e).replace(/\+/g," ")},o=window.location.search.substring(1),i=/([^&=]+)=?([^&]*)/g;e=i.exec(o);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var a=e[1].indexOf("["),r=e[1].slice(a+1,e[1].indexOf("]",a)),s=t(e[1].slice(0,a));"object"!=typeof n[s]&&(n[t(s)]={},n[t(s)].length=0),r?n[t(s)][t(r)]=t(e[2]):Array.prototype.push.call(n[t(s)],t(e[2]))}}();for(var o in n)if("action"!=o)if("object"==typeof n[o])for(var i in n[o])this.createCookie(i,n[o][i],30);else this.createCookie(o,n[o],30);if(t){var a=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(a,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){n={};if(t)var n=e.totalStorage("inbound_url_params");return n},getParameterVal:function(e,t){return(RegExp(e+"=(.+?)(&|$)").exec(t)||[,!1])[1]},checkLocalStorage:function(){if("localStorage"in window)try{ls=void 0===window.localStorage?void 0:window.localStorage,t="undefined"!=typeof ls&&void 0!==window.JSON}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}var n=Object.keys(localStorage).map(function(t){return{name:t,size:e(localStorage[t])}}).map(function(e){return e.size=t(e.size).toFixed(2)+" MB",e});console.table(n)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=t<10?"0":"",o=e.getFullYear(),i=e.getHours(),a=i<10?"0":"",r=e.getMinutes(),s=r<10?"0":"",l=e.getSeconds(),u=l<10?"0":"",d=e.getMonth()+1;return o+"/"+(d<10?"0":"")+d+"/"+n+t+" "+a+i+":"+s+r+":"+u+l},SetSessionTimeout:function(){this.readCookie("lead_session_expire");var e=new Date;e.setTime(e.getTime()+18e5),this.createCookie("lead_session_expire",!0,e)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",o=e.Utils.readCookie("inbound_referral_site"),i=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),o||this.createCookie("inbound_referral_site",n,t),i||e.totalStorage("inbound_original_referral",i)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n},generateGUID:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,guid)},SetUID:function(e){if(!this.readCookie("wp_lead_uid")){var t=e||this.CreateUID(35);this.createCookie("wp_lead_uid",t)}},countProperties:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&++t;return t},mergeObjs:function(e,t){var n={};for(var o in e)n[o]=e[o];for(var o in t)n[o]=t[o];return n},hasClass:function(e,t){if("classList"in document.documentElement)n=t.classList.contains(e);else var n=new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className);return n},addClass:function(e,t){"classList"in document.documentElement?t.classList.add(e):this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)},removeClass:function(e,t){"classList"in document.documentElement?t.classList.remove(e):this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)*"+e+"(\\s|$)*","g"),""))},removeElement:function(e){e.parentNode.removeChild(e)},trim:function(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,"\n")},ajaxPolyFill:function(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(var e,t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(e){}return e},ajaxSendData:function(e,t,n,o,i){var a=this.ajaxPolyFill();setTimeout(function(){a.open(n,e,!0),a.onreadystatechange=function(){4==a.readyState&&t(a.responseText)},"POST"==n&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(o)},100)},ajaxGet:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e+"?"+i.join("&"),n,"GET",null,o)},ajaxPost:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e,n,"POST",i.join("&"),o)},sendEvent:function(e,t,i){t=t||{},async=!0;var a=getCookie();if(a){var r;for(r in a)t[r]=a[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=o.api_host+"/track?data="+encodeURIComponent(JSON.stringify(s));if(n){var u=new XMLHttpRequest;u.open("GET",l,async),u.withCredentials=async,u.send(null)}else{var d=document.createElement("script");d.type="text/javascript",d.async=async,d.defer=async,d.src=l;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(d,c)}return action(i),self},domReady:function(e,t){var n=!1,o=!0,i=e.document,a=i.documentElement,r=i.addEventListener?"addEventListener":"attachEvent",s=i.addEventListener?"removeEventListener":"detachEvent",l=i.addEventListener?"":"on",u=function(o){"readystatechange"==o.type&&"complete"!=i.readyState||(("load"==o.type?e:i)[s](l+o.type,u,!1),!n&&(n=!0)&&t.call(e,o.type||o))},d=function(){try{a.doScroll("left")}catch(e){return void setTimeout(d,50)}u("poll")};if("complete"==i.readyState)t.call(e,"lazy");else{if(i.createEventObject&&a.doScroll){try{o=!e.frameElement}catch(e){}o&&d()}i[r](l+"DOMContentLoaded",u,!1),i[r](l+"readystatechange",u,!1),e[r](l+"load",u,!1)}},addListener:function(e,t,n){e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},removeListener:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},throttle:function(e,t){var n,o,i,a=null,r=0,s=function(){r=new Date,a=null,i=e.apply(n,o)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,o=arguments,u<=0?(clearTimeout(a),a=null,r=l,i=e.apply(n,o)):a||(a=setTimeout(s,u)),i}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),void 0!==_gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)},cacheSearchData:function(n,o){if(t){var i=e.totalStorage.getItem("inbound_search_storage");if(i)i.unshift(n),e.totalStorage.setItem("inbound_search_storage",i);else{var a=[n];e.totalStorage.setItem("inbound_search_storage",a)}}else{var r=JSON.stringify(n),s=this.readCookie("inbound_search_storage");s&&(r+="SPLIT-TOKEN"+s),this.createCookie("inbound_search_storage",r,"180")}e.Forms.releaseFormSubmit(o)},storeSearchData:function(){if(inbound_settings.wp_lead_data.lead_id&&inbound_settings.wp_lead_data.lead_nonce){var t=[],n=e.totalStorage.getItem("inbound_search_storage"),o=this.readCookie("inbound_search_storage");if(n||o){if(o){o=o.split("SPLIT-TOKEN");for(var i in o)t.push(JSON.parse(o[i]))}n&&(t=t.concat(n)),t.sort(function(e,t){return e.timestamp-t.timestamp});var a={action:"inbound_search_store",data:t=encodeURIComponent(JSON.stringify(t)),nonce:inbound_settings.wp_lead_data.lead_nonce,lead_id:inbound_settings.wp_lead_data.lead_id};callback=function(t){t&&(t=JSON.parse(t)),t.success&&(console.log(t.success),e.Utils.eraseCookie("inbound_search_storage"),e.totalStorage.deleteItem("inbound_search_storage")),t.error&&console.log(t.error)},this.ajaxPost(inbound_settings.admin_url,a,callback)}}}},e}(_inbound||{}),InboundForms=function(e){var t=e.Utils,n=[],o=[],a=[],r={},s=e.Settings,l=["first name","last name","name","email","e-mail","phone","website","job title","your favorite food","company","tele","address","comment"];if(e.Forms={init:function(){e.Forms.runFieldMappingFilters(),e.Forms.formTrackInit(),e.Forms.searchTrackInit()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,t){return},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=window.document.forms[e];t.dataset.formProcessed||(t.dataset.formProcessed=!0,this.checkTrackStatus(t)&&(this.attachFormSubmitEvent(t),this.initFormMapping(t)))}},searchTrackInit:function(){if("off"!=inbound_settings.search_tracking&&!r.searchTrackInit){for(var e=0;e<window.document.forms.length;e++){var n=window.document.forms[e];n.dataset.searchChecked||(n.dataset.searchChecked=!0,this.checkSearchTrackStatus(n)&&this.attachSearchFormSubmitEvent(n))}t.storeSearchData(),r.searchTrackInit=!0}},checkTrackStatus:function(t){var n=t.getAttribute("class");if(""!==n&&null!==n)return n.toLowerCase().indexOf("wpl-track-me")>-1||(n.toLowerCase().indexOf("inbound-track")>-1||(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1))},checkSearchTrackStatus:function(t){var n=t.getAttribute("class"),o=t.getAttribute("id");return""!==n&&null!==n&&n.toLowerCase().indexOf("search")>-1||(""===o||null===o?(cb=function(){console.log(t)},e.deBugger("searches","This search form is not tracked. Please assign on in settings...",cb),!1):o.toLowerCase().indexOf("search")>-1||void 0)},loopClassSelectors:function(n,o){for(var i=n.length-1;i>=0;i--){var a=t.trim(n[i]);-1===a.indexOf("#")&&-1===a.indexOf(".")&&(a="#"+a),(a=document.querySelector(a))&&("add"===o?(e.Utils.addClass("wpl-track-me",a),e.Utils.addClass("inbound-track",a)):(e.Utils.removeClass("wpl-track-me",a),e.Utils.removeClass("inbound-track",a)))}},initFormMapping:function(t){for(var n=[],o=0;o<t.elements.length;o++)formInput=t.elements[o],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&!e.Utils.hasClass("nopopulate",t)&&this.fillInputValues(formInput)):n.push(formInput);for(var i=n.length-1;i>=0;i--)formInput=n[i],this.mapField(formInput)},mapField:function(o){var a=o.id||!1,r=o.name||!1,s=this.getInputLabel(o);if(s&&this.ignoreFieldByLabel(s[0].innerText))return o.dataset.ignoreFormField=!0,!1;for(i=0;i<l.length;i++){var u=!1,d=l[i],c=t.trim(d),m=c.replace(/ /g,"_");r&&r.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching name attribute for -> "+c)):a&&a.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching ID attribute for ->"+c)):s?s[0].innerText.toLowerCase().indexOf(c)>-1&&(u=!0,e.deBugger("forms","Found matching sibling label for -> "+c)):n.push(c),u&&(this.addDataAttr(o,m),this.removeArrayItem(l,c),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},searchFormListener:function(t){t.preventDefault(),e.Forms.saveSearchData(t.target)},attachFormSubmitEvent:function(e){t.addListener(e,"submit",this.formListener);document.querySelector(".inbound-email")},attachSearchFormSubmitEvent:function(e){t.addListener(e,"submit",this.searchFormListener)},ignoreFieldByLabel:function(t){var n=!1;return!!t&&(-1==t.toLowerCase().indexOf("credit card")&&-1==t.toLowerCase().indexOf("card number")||(n=!0),-1==t.toLowerCase().indexOf("expiration")&&-1==t.toLowerCase().indexOf("expiry")||(n=!0),"month"!=t.toLowerCase()&&"mm"!=t.toLowerCase()&&"yy"!=t.toLowerCase()&&"yyyy"!=t.toLowerCase()&&"year"!=t.toLowerCase()||(n=!0),-1==t.toLowerCase().indexOf("cvv")&&-1==t.toLowerCase().indexOf("cvc")&&-1==t.toLowerCase().indexOf("secure code")&&-1==t.toLowerCase().indexOf("security code")||(n=!0),n&&e.deBugger("forms","ignore "+t),n)},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;if("visa"!=e.toLowerCase()&&"mastercard"!=e.toLowerCase()&&"american express"!=e.toLowerCase()&&"amex"!=e.toLowerCase()&&"discover"!=e.toLowerCase()||(t=!0),new RegExp("/^[0-9]+$/").test(e)){var n=e.replace(" ","");this.isInt(n)&&n.length>=16&&(t=!0)}return t},isInt:function(e){return"number"==typeof e&&isFinite(e)&&e%1==0},releaseFormSubmit:function(e){document.body.style.cursor="default",t.removeClass("wpl-track-me",e),t.removeListener(e,"submit",this.formListener);var n=e.getAttribute("class");if(""!==n&&null!==n&&-1!=n.toLowerCase().indexOf("wpcf7-form"))return setTimeout(function(){document.body.style.cursor="default"},300),!0;e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&"submit"===formInput.name&&e.elements[t].click()},2e3)},saveFormData:function(n){for(var i=i||{},r=0;r<n.elements.length;r++)if(formInput=n.elements[r],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),i[inputName]||(i[inputName]={}),formInput.type&&(i[inputName].type=formInput.type),i[inputName].name||(i[inputName].name=formInput.name),formInput.dataset.mapFormField&&(i[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(l=this.getInputValue(formInput)))continue;break;case"TEXTAREA":l=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var s=0;s<formInput.length;s++)formInput[s].selected&&values.push(encodeURIComponent(formInput[s].value))}else l=formInput.value}if(e.deBugger("forms","Input Value = "+l),l){i[inputName].value||(i[inputName].value=[]),i[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",i);for(var u in i){var d=i[u].value,c=i[u].map;if(void 0!==d&&null!=d&&""!=d&&o.push(u+"="+i[u].value.join(",")),void 0!==c&&null!=c&&i[u].value&&(a.push(c+"="+i[u].value.join(",")),"email"===u))var m=i[u].value.join(",")}var f=o.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=a.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g),(m=t.getParameterVal("email",g)||t.readCookie("wp_lead_email"))||(m=t.getParameterVal("wpleads_email_address",g));var p=t.getParameterVal("name",g),h=t.getParameterVal("first_name",g),v=t.getParameterVal("last_name",g);if(!v&&h&&(_=decodeURI(h).split(" ")).length>0&&(h=_[0],v=_[1]),p&&!v&&!h){var _=decodeURI(p).split(" ");_.length>0&&(h=_[0],v=_[1])}p=h&&v?h+" "+v:p,h||(h=""),v||(v=""),e.deBugger("forms","fName = "+h),e.deBugger("forms","lName = "+v),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{},w=n.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),k=!1;if(0==w.length||"IA=="==w[0].value)k=!0;var S=n.querySelectorAll('input[value][type="hidden"][name="inbound_form_id"]');S=S.length>0?S[0].value:0;if("undefined"!=typeof landing_path_info)C=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)C=cta_path_info.variation;else var C=inbound_settings.variation_id;var I=inbound_settings.post_type||"page",L=inbound_settings.post_id||0;search_data={},formData={action:"inbound_lead_store",email:m,full_name:p,first_name:h,last_name:v,raw_params:f,mapped_params:g,url_params:JSON.stringify(y),search_data:"test",page_views:JSON.stringify(b),post_type:I,page_id:L,variation:C,source:t.readCookie("inbound_referral_site"),inbound_submitted:k,inbound_form_id:S,inbound_nonce:inbound_settings.ajax_nonce,event:n},callback=function(o){e.deBugger("forms","Lead Created with ID: "+o),o=parseInt(o,10),formData.leadID=o,o&&(t.createCookie("wp_lead_id",o),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(n)},e.trigger("form_before_submission",formData),t.ajaxPost(inbound_settings.admin_url,formData,callback)},saveSearchData:function(n){for(var o=o||{},i=0;i<n.elements.length;i++)if(formInput=n.elements[i],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("searches","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),o[inputName]||(o[inputName]={}),formInput.type&&(o[inputName].type=formInput.type),o[inputName].name||(o[inputName].name=formInput.name),formInput.dataset.mapFormField&&(o[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(r=this.getInputValue(formInput)))continue;break;case"TEXTAREA":r=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var a=0;a<formInput.length;a++)formInput[a].selected&&values.push(encodeURIComponent(formInput[a].value))}else r=formInput.value}if(e.deBugger("searches","Input Value = "+r),r){o[inputName].value||(o[inputName].value=[]),o[inputName].value.push(multiple?values.join(","):encodeURIComponent(r));var r=multiple?values.join(","):encodeURIComponent(r)}}e.deBugger("searches",o);var s=[];for(var l in o){var u=o[l].value,d=o[l].type;void 0!==u&&null!=u&&""!=u&&"search"==d&&s.push("search_text|value|"+o[l].value)}if(s[0]){var c=s.join("|field|");if(e.deBugger("searches","Stringified Search Form PARAMS: "+c),"undefined"!=typeof landing_path_info)m=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)m=cta_path_info.variation;else var m=inbound_settings.variation_id;var f=inbound_settings.post_type||"page",g=inbound_settings.post_id||0,p=t.readCookie("wp_lead_uid");inbound_settings.wp_lead_data.lead_email?email=inbound_settings.wp_lead_data.lead_email:t.readCookie("inbound_wpleads_email_address")?email=t.readCookie("inbound_wpleads_email_address"):email="",searchData={email:email,search_data:c,user_UID:p,post_type:f,page_id:g,variation:m,source:t.readCookie("inbound_referral_site"),ip_address:inbound_settings.ip_address,timestamp:Math.floor((new Date).getTime()/1e3)},e.trigger("search_before_caching",searchData),inbound_settings.wp_lead_data.lead_id?(searchData.lead_id=inbound_settings.wp_lead_data.lead_id,t.cacheSearchData(searchData,n)):t.cacheSearchData(searchData,n)}},rememberInputValues:function(n){n.name&&n.name;var o=n.type?n.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o||n.dataset.ignoreFormField)return!1;t.addListener(n,"change",function(n){if(n.target.name){if("checkbox"!==o)var i=n.target.value;else for(var a=[],r=document.querySelectorAll('input[name="'+n.target.name+'"]'),s=0;s<r.length;s++)r[s].checked&&a.push(r[s].value),i=a.join(",");inputData={name:n.target.name,node:n.target.nodeName.toLowerCase(),type:o,value:i,mapping:n.target.dataset.mapFormField},e.trigger("form_input_change",inputData),t.createCookie("inbound_"+n.target.name,encodeURIComponent(i))}})},fillInputValues:function(e){var n=e.name?"inbound_"+e.name:"",o=e.type?e.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o)return!1;if(t.readCookie(n)&&"comment"!=n)if(value=decodeURIComponent(t.readCookie(n)),"checkbox"===o||"radio"===o)for(var i=value.split(","),a=0;a<i.length;a++)e.value.indexOf(i[a])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},getInputLabel:function(e){var t;return(t=this.siblingsIsLabel(e))?t:!!(t=this.CheckParentForLabel(e))&&t},getInputValue:function(e){var t=!1;switch(e.type){case"radio":case"checkbox":e.checked&&(t=e.value);break;case"text":case"hidden":default:t=e.value}return t},addDataAttr:function(e,t){for(var n=document.getElementsByName(e.name),o=n.length-1;o>=0;o--)e.dataset.mapFormField||(n[o].dataset.mapFormField=t)},removeArrayItem:function(e,t){if(e.indexOf)index=e.indexOf(t);else for(index=e.length-1;index>=0&&e[index]!==t;--index);index>=0&&e.splice(index,1)},siblingsIsLabel:function(e){for(var t=this.getSiblings(e),n=[],o=t.length-1;o>=0;o--)"label"===t[o].nodeName.toLowerCase()&&n.push(t[o]);return n.length>0&&n.length<2&&n},getChildren:function(e,t){for(var n=[];e;e=e.nextSibling)1==e.nodeType&&e!=t&&n.push(e);return n},getSiblings:function(e){return this.getChildren(e.parentNode.firstChild,e)},CheckParentForLabel:function(e){if("FORM"===e.nodeName)return null;do{var t=e.getElementsByTagName("label");if(t.length>0&&t.length<2)return e.getElementsByTagName("label")}while(e=e.parentNode);return null},mailCheck:function(){var e=document.querySelector(".inbound-email");e&&(t.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(n){var o=document.querySelector(".email_suggestion");o&&t.removeElement(o);var i=document.createElement("span");i.innerHTML="<span class=\"email_suggestion\">Did youu mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+n.full+"</b></i>?</span>",e.parentNode.insertBefore(i,e.nextSibling);var a=document.getElementById("email_correction");t.addListener(a,"click",function(){e.value=a.innerHTML,a.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},void 0===u)var u={domainThreshold:1,topLevelThreshold:3,defaultDomains:["yahoo.com","google.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","mail.com","outlook.com","icloud.com"],defaultTopLevelDomains:["co.jp","co.uk","com","net","org","info","edu","gov","mil","ca","de"],run:function(e){e.domains=e.domains||u.defaultDomains,e.topLevelDomains=e.topLevelDomains||u.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||u.sift3Distance;var t=function(e){return e},n=e.suggested||t,o=e.empty||t,i=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return i?n(i):o()},suggest:function(e,t,n,o){e=e.toLowerCase();var i=this.splitEmail(e),a=this.findClosestDomain(i.domain,t,o,this.domainThreshold);if(a){if(a!=i.domain)return{address:i.address,domain:a,full:i.address+"@"+a}}else{var r=this.findClosestDomain(i.topLevelDomain,n,o,this.topLevelThreshold);if(i.domain&&r&&r!=i.topLevelDomain){var s=i.domain;return a=s.substring(0,s.lastIndexOf(i.topLevelDomain))+r,{address:i.address,domain:a,full:i.address+"@"+a}}}return!1},findClosestDomain:function(e,t,n,o){o=o||this.topLevelThreshold;var i,a=99,r=null;if(!e||!t)return!1;n||(n=this.sift3Distance);for(var s=0;s<t.length;s++){if(e===t[s])return e;(i=n(e,t[s]))<a&&(a=i,r=t[s])}return a<=o&&null!==r&&r},sift3Distance:function(e,t){if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(var n=0,o=0,i=0,a=0;n+o<e.length&&n+i<t.length;){if(e.charAt(n+o)==t.charAt(n+i))a++;else{o=0,i=0;for(var r=0;r<5;r++){if(n+r<e.length&&e.charAt(n+r)==t.charAt(n)){o=r;break}if(n+r<t.length&&e.charAt(n)==t.charAt(n+r)){i=r;break}}}n++}return(e.length+t.length)/2-a},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(a=0;a<t.length;a++)if(""===t[a])return!1;var n=t.pop(),o=n.split("."),i="";if(0===o.length)return!1;if(1==o.length)i=o[0];else{for(var a=1;a<o.length;a++)i+=o[a]+".";o.length>=2&&(i=i.substring(0,i.length-1))}return{topLevelDomain:i,domain:n,address:t.join("@")}},encodeEmail:function(e){var t=encodeURI(e);return t=t.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return e}(_inbound||{}),_inboundEvents=function(e){function t(t,o,i){var o=o||{};(i=i||{}).bubbles=i.bubbles||!0,i.cancelable=i.cancelable||!0,o=e.apply_filters("filter_"+t,o);!window.ActiveXObject&&window;if("function"==typeof CustomEvent)var a=new CustomEvent(t,{detail:o,bubbles:i.bubbles,cancelable:i.cancelable});else(a=document.createEvent("Event")).initEvent(t,!0,!0);window.dispatchEvent(a),e.do_action(t,o),n(t,o)}function n(e,t){if(window.jQuery){var t=t||{};jQuery(document).trigger(e,t)}}e.trigger=function(t,n){e.Events[t](n)};return e.Events={analytics_ready:function(){t("analytics_ready",{data:"xyxy"},{opt1:!0})},url_parameters:function(e){t("url_parameters",e)},session_start:function(){console.log(""),t("session_start")},session_end:function(e){t("session_end",e),console.log("Session End")},session_active:function(){t("session_active")},session_idle:function(e){t("session_idle",e)},session_resume:function(){t("session_resume")},session_heartbeat:function(e){t("session_heartbeat",{clock:e,leadData:InboundLeadData})},page_visit:function(e){t("page_view",e)},page_first_visit:function(n){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);e.deBugger("pages",status,function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")})},tab_hidden:function(n){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(n){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(n){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){e.deBugger("forms","inputData change. Data=",function(){console.log(n)}),t("form_input_change",n)},form_before_submission:function(e){t("form_before_submission",e)},form_after_submission:function(e){t("form_after_submission",e)},search_before_caching:function(e){t("search_before_caching",e)},analyticsError:function(e,t,n){var o=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(o),console.log("Page Save Error")}},e}(_inbound||{});_inbound.add_action("form_before_submission",inboundFormNoRedirect,10),_inbound.add_action("form_after_submission",inboundFormNoRedirectContent,10);var InboundTotalStorage=function(e){var t,n;if("localStorage"in window)try{n=void 0===window.localStorage?void 0:window.localStorage,t=void 0!==n&&void 0!==window.JSON,window.localStorage.setItem("_inbound","1"),window.localStorage.removeItem("_inbound")}catch(e){t=!1}e.totalStorage=function(t,n,o){return e.totalStorage.impl.init(t,n)},e.totalStorage.setItem=function(t,n){return e.totalStorage.impl.setItem(t,n)},e.totalStorage.getItem=function(t){return e.totalStorage.impl.getItem(t)},e.totalStorage.getAll=function(){return e.totalStorage.impl.getAll()},e.totalStorage.deleteItem=function(t){return e.totalStorage.impl.deleteItem(t)},e.totalStorage.impl={init:function(e,t){return void 0!==t?this.setItem(e,t):this.getItem(e)},setItem:function(o,i){if(!t)try{return e.Utils.createCookie(o,i),i}catch(e){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var a=JSON.stringify(i);return n.setItem(o,a),this.parseResult(a)},getItem:function(o){if(!t)try{return this.parseResult(e.Utils.readCookie(o))}catch(e){return null}var i=n.getItem(o);return this.parseResult(i)},deleteItem:function(o){if(!t)try{return e.Utils.eraseCookie(o,null),!0}catch(e){return!1}return n.removeItem(o),!0},getAll:function(){var o=[];if(t)for(var i in n)i.length&&o.push({key:i,value:this.parseResult(n.getItem(i))});else try{for(var a=document.cookie.split(";"),r=0;r<a.length;r++){var s=a[r].split("=")[0];o.push({key:s,value:this.parseResult(e.Utils.readCookie(s))})}}catch(e){return null}return o},parseResult:function(e){var t;try{void 0===(t=JSON.parse(e))&&(t=e),"true"==t&&(t=!0),"false"==t&&(t=!1),parseFloat(t)==t&&"object"!=typeof t&&(t=parseFloat(t))}catch(n){t=e}return t}}}(_inbound||{}),_inboundLeadsAPI=function(e){return e.LeadsAPI={init:function(){var t=e.Utils,n=(t.readCookie("wp_lead_uid"),t.readCookie("wp_lead_id"));t.readCookie("lead_data_expire")||(e.deBugger("leads","expired vistor. Run Processes"),n&&e.LeadsAPI.getAllLeadData())},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(t){var n=e.Utils.readCookie("wp_lead_id"),o=e.totalStorage("inbound_lead_data"),i=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:n},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var o=new Date;o.setTime(o.getTime()+18e5);var i=e.Utils.addDays(o,3);e.Utils.createCookie("lead_data_expire",!0,i)},o?(e.LeadsAPI.setGlobalLeadData(o),e.deBugger("lead","Set Global Lead Data from Localstorage"),i||(e.Utils.ajaxPost(inbound_settings.admin_url,data,success),e.deBugger("lead","localized data old. Pull new from DB"))):e.Utils.ajaxPost(inbound_settings.admin_url,data,success)},getLeadLists:function(){var t={action:"wpl_check_lists",wp_lead_id:e.Utils.readCookie("wp_lead_id")};e.Utils.ajaxPost(inbound_settings.admin_url,t,function(t){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")})}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,o=!1,i=!1,a=!1,r=parseInt(e.Utils.readCookie("lead_session"),10)||0,s=0,l=(new Date,null),u=null,d=null,c=e.Utils,m=e.Utils.GetDate(),f="page_views",g=e.totalStorage(f)||{},p=inbound_settings.post_id||window.location.pathname,h=e.Settings.timeout||1e4;return e.PageTracking={init:function(o){this.CheckTimeOut(),o=o||{},t=parseInt(o.reportInterval,10)||10,n=parseInt(o.idleTimeout,10)||3,c.addListener(document,"keydown",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(document,"click",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(window,"mousemove",c.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession()},setIdle:function(t){var n="Session IDLE. Activity Timeout due to "+(t=t||"No Movement");e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n;void 0!==document.hidden?(t="hidden",n="visibilitychange"):void 0!==document.mozHidden?(t="mozHidden",n="mozvisibilitychange"):void 0!==document.msHidden?(t="msHidden",n="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",n="webkitvisibilitychange");var o=document[t];e.Utils.addListener(document,n,function(n){o!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),o=document[t])})},clock:function(){var n="Total time spent on Page in this Session: "+((r+=1)/60).toFixed(2)+" min";if(e.deBugger("pages",n),r>0&&r%t==0){var o=new Date;o.setTime(o.getTime()+18e5),c.createCookie("lead_session",r,o),e.trigger("session_heartbeat",r)}},inactiveClock:function(){var t="Time until Session Timeout: "+((1800-(s+=1))/60).toFixed(2)+" min";e.deBugger("pages",t),s>1800&&(e.trigger("session_end",InboundLeadData),e.Utils.eraseCookie("lead_session"),s=0,clearTimeout(u))},stopClock:function(){i=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){i=!1,e.trigger("session_resume"),e.deBugger("pages","Activity resumed. Session Active"),clearTimeout(l),s=0,clearTimeout(u),l=setInterval(e.PageTracking.clock,1e3)},turnOff:function(){e.PageTracking.setIdle(),a=!0},turnOn:function(){a=!1},startSession:function(){new Date;if(o=!0,l=setInterval(e.PageTracking.clock,1e3),c.readCookie("lead_session"))e.trigger("session_active");else{e.trigger("session_start");var t=new Date;t.setTime(t.getTime()+18e5),e.Utils.createCookie("lead_session",1,t)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){a||(o||e.PageTracking.startSession(),i&&e.PageTracking.restartClock(),clearTimeout(d),d=setTimeout(e.PageTracking.setIdle,1e3*n+100),void 0!==t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){if(e.Utils.checkLocalStorage()){var t=localStorage.getItem(f),n=JSON.parse(t);return n}},isRevisit:function(e){var t=!1,n=(e=e||{})[p];return void 0!==n&&null!==n&&(t=!0),t},triggerPageView:function(t){var n={title:document.title,url:document.location.href,path:document.location.pathname,count:1};t?(g[p].push(m),n.count=g[p].length,e.trigger("page_revisit",n)):(g[p]=[],g[p].push(m),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage(f,g),this.storePageView()},CheckTimeOut:function(){var t,n=this.isRevisit(g);if(n){var o=g[p].length-1,i=g[p][o],a=Math.abs(new Date(i).getTime()-new Date(m).getTime());a>h?(t="Timeout Happened. Page view fired",this.triggerPageView(n)):(time_left=.001*Math.abs(h-a),t=h/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(n);e.deBugger("pages",t)},storePageView:function(){var t=!1;"off"==inbound_settings.page_tracking&&"landing-page"!=inbound_settings.post_type||(document.onreadystatechange=function(){"loading"!==document.readyState&&!1===t&&setTimeout(function(){var n=e.Utils.readCookie("wp_lead_id")?e.Utils.readCookie("wp_lead_id"):"",o=e.Utils.readCookie("wp_lead_uid")?e.Utils.readCookie("wp_lead_uid"):"",i=e.totalStorage("wp_cta_loaded"),a=e.totalStorage("wp_cta_impressions");t=!0,e.totalStorage("wp_cta_impressions",{});var r={action:"inbound_track_lead",wp_lead_uid:o,wp_lead_id:n,page_id:inbound_settings.post_id,variation_id:inbound_settings.variation_id,post_type:inbound_settings.post_type,current_url:window.location.href,page_views:JSON.stringify(e.PageTracking.getPageViews()),cta_impressions:JSON.stringify(a),cta_history:JSON.stringify(i),json:"0"};e.Utils.ajaxPost(inbound_settings.admin_url,r,function(e){})},200)})}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
|
shared/classes/class.load-assets.php
CHANGED
@@ -145,13 +145,13 @@ class Inbound_Asset_Loader {
|
|
145 |
$lead_page_view_tracking = ( isset( $inbound_settings['inbound-analytics-rules']['page-tracking']) && $inbound_settings['inbound-analytics-rules']['page-tracking'] == 'off' ) ? false : true;
|
146 |
$lead_search_tracking = self::get_lead_setting( 'wpl-main-search-tracking', 1);
|
147 |
$lead_comment_tracking = self::get_lead_setting( 'wpl-main-comment-tracking', 1);
|
148 |
-
if (!$lead_search_tracking) {
|
149 |
$search_tracking = 'off';
|
150 |
}
|
151 |
-
if (!$lead_comment_tracking) {
|
152 |
$comment_tracking = 'off';
|
153 |
}
|
154 |
-
if (!$lead_page_view_tracking || isset($_GET['inbound-do-not-track']) ) {
|
155 |
$page_tracking = 'off';
|
156 |
}
|
157 |
|
145 |
$lead_page_view_tracking = ( isset( $inbound_settings['inbound-analytics-rules']['page-tracking']) && $inbound_settings['inbound-analytics-rules']['page-tracking'] == 'off' ) ? false : true;
|
146 |
$lead_search_tracking = self::get_lead_setting( 'wpl-main-search-tracking', 1);
|
147 |
$lead_comment_tracking = self::get_lead_setting( 'wpl-main-comment-tracking', 1);
|
148 |
+
if (!$lead_search_tracking || !class_exists( 'Inbound_Leads_Plugin' ) ) {
|
149 |
$search_tracking = 'off';
|
150 |
}
|
151 |
+
if (!$lead_comment_tracking || !class_exists( 'Inbound_Leads_Plugin' ) ) {
|
152 |
$comment_tracking = 'off';
|
153 |
}
|
154 |
+
if (!$lead_page_view_tracking || isset($_GET['inbound-do-not-track']) || !class_exists( 'Inbound_Leads_Plugin' ) ) {
|
155 |
$page_tracking = 'off';
|
156 |
}
|
157 |
|
shared/docs/analytics.events.md
CHANGED
@@ -1,389 +1,389 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
<!-- Start core\shared\assets\js\frontend\analytics-src\analytics.events.js -->
|
4 |
-
|
5 |
-
# Analytics Events
|
6 |
-
|
7 |
-
Events are triggered throughout the visitors journey through the site. See more on [Inbound Now][in]
|
8 |
-
|
9 |
-
Version: 0.0.2
|
10 |
-
[in]: http://www.inboundnow.com/
|
11 |
-
|
12 |
-
# Event Usage
|
13 |
-
|
14 |
-
Events are triggered throughout the visitors path through the site.
|
15 |
-
You can hook into these custom actions and filters much like WordPress Core
|
16 |
-
|
17 |
-
See below for examples
|
18 |
-
|
19 |
-
Adding Custom Actions
|
20 |
-
------------------
|
21 |
-
You can hook into custom events throughout analytics. See the full list of available [events below](#all-events)
|
22 |
-
|
23 |
-
`
|
24 |
-
_inbound.add_action( 'action_name', callback, priority );
|
25 |
-
`
|
26 |
-
|
27 |
-
```js
|
28 |
-
// example:
|
29 |
-
|
30 |
-
// Add custom function to `page_visit` event
|
31 |
-
_inbound.add_action( 'page_visit', callback, 10 );
|
32 |
-
|
33 |
-
// add custom callback to trigger when `page_visit` fires
|
34 |
-
function callback(pageData){
|
35 |
-
var pageData = pageData || {};
|
36 |
-
// run callback on 'page_visit' trigger
|
37 |
-
alert(pageData.title);
|
38 |
-
}
|
39 |
-
```
|
40 |
-
|
41 |
-
### Params:
|
42 |
-
|
43 |
-
* **string** *action_name* Name of the event trigger
|
44 |
-
* **function** *callback* function to trigger when event happens
|
45 |
-
* **int** *priority* Order to trigger the event in
|
46 |
-
|
47 |
-
Removing Custom Actions
|
48 |
-
------------------
|
49 |
-
You can hook into custom events throughout analytics. See the full list of available [events below](#all-events)
|
50 |
-
|
51 |
-
`
|
52 |
-
_inbound.remove_action( 'action_name');
|
53 |
-
`
|
54 |
-
|
55 |
-
```js
|
56 |
-
// example:
|
57 |
-
|
58 |
-
_inbound.remove_action( 'page_visit');
|
59 |
-
// all 'page_visit' actions have been deregistered
|
60 |
-
```
|
61 |
-
|
62 |
-
### Params:
|
63 |
-
|
64 |
-
* **string** *action_name* Name of the event trigger
|
65 |
-
|
66 |
-
# Event List
|
67 |
-
|
68 |
-
Events are triggered throughout the visitors journey through the site
|
69 |
-
|
70 |
-
## analytics_ready()
|
71 |
-
|
72 |
-
Triggers when analyics has finished loading
|
73 |
-
|
74 |
-
## url_parameters()
|
75 |
-
|
76 |
-
Triggers when the browser url params are parsed. You can perform custom actions
|
77 |
-
if specific url params exist.
|
78 |
-
|
79 |
-
```js
|
80 |
-
// Usage:
|
81 |
-
|
82 |
-
// Add function to 'url_parameters' event
|
83 |
-
_inbound.add_action( 'url_parameters', url_parameters_func_example, 10);
|
84 |
-
|
85 |
-
function url_parameters_func_example(urlParams) {
|
86 |
-
var urlParams = urlParams || {};
|
87 |
-
for( var param in urlParams ) {
|
88 |
-
var key = param;
|
89 |
-
var value = urlParams[param];
|
90 |
-
}
|
91 |
-
// All URL Params
|
92 |
-
alert(JSON.stringify(urlParams));
|
93 |
-
|
94 |
-
// Check if URL parameter `utm_source` exists and matches value
|
95 |
-
if(urlParams.utm_source === "twitter") {
|
96 |
-
alert('This person is from twitter!');
|
97 |
-
}
|
98 |
-
}
|
99 |
-
```
|
100 |
-
|
101 |
-
## session_start()
|
102 |
-
|
103 |
-
Triggers when session starts
|
104 |
-
|
105 |
-
```js
|
106 |
-
// Usage:
|
107 |
-
|
108 |
-
// Add function to 'session_start' event
|
109 |
-
_inbound.add_action( 'session_start', session_start_func_example, 10);
|
110 |
-
|
111 |
-
function session_start_func_example(data) {
|
112 |
-
var data = data || {};
|
113 |
-
// session start. Do something for new visitor
|
114 |
-
}
|
115 |
-
```
|
116 |
-
|
117 |
-
## session_end()
|
118 |
-
|
119 |
-
Triggers when visitor session goes idle for more than 30 minutes.
|
120 |
-
|
121 |
-
```js
|
122 |
-
// Usage:
|
123 |
-
|
124 |
-
// Add function to 'session_end' event
|
125 |
-
_inbound.add_action( 'session_end', session_end_func_example, 10);
|
126 |
-
|
127 |
-
function session_end_func_example(data) {
|
128 |
-
var data = data || {};
|
129 |
-
// Do something when session ends
|
130 |
-
alert("Hey! It's been 30 minutes... where did you go?");
|
131 |
-
}
|
132 |
-
```
|
133 |
-
|
134 |
-
## session_active()
|
135 |
-
|
136 |
-
Triggers if active session is detected
|
137 |
-
|
138 |
-
```js
|
139 |
-
// Usage:
|
140 |
-
|
141 |
-
// Add function to 'session_active' event
|
142 |
-
_inbound.add_action( 'session_active', session_active_func_example, 10);
|
143 |
-
|
144 |
-
function session_active_func_example(data) {
|
145 |
-
var data = data || {};
|
146 |
-
// session active
|
147 |
-
}
|
148 |
-
```
|
149 |
-
|
150 |
-
## session_idle()
|
151 |
-
|
152 |
-
Triggers when visitor session goes idle. Idling occurs after 60 seconds of
|
153 |
-
inactivity or when the visitor switches browser tabs
|
154 |
-
|
155 |
-
```js
|
156 |
-
// Usage:
|
157 |
-
|
158 |
-
// Add function to 'session_idle' event
|
159 |
-
_inbound.add_action( 'session_idle', session_idle_func_example, 10);
|
160 |
-
|
161 |
-
function session_idle_func_example(data) {
|
162 |
-
var data = data || {};
|
163 |
-
// Do something when session idles
|
164 |
-
alert('Here is a special offer for you!');
|
165 |
-
}
|
166 |
-
```
|
167 |
-
|
168 |
-
## session_resume()
|
169 |
-
|
170 |
-
Triggers when session is already active and gets resumed
|
171 |
-
|
172 |
-
```js
|
173 |
-
// Usage:
|
174 |
-
|
175 |
-
// Add function to 'session_resume' event
|
176 |
-
_inbound.add_action( 'session_resume', session_resume_func_example, 10);
|
177 |
-
|
178 |
-
function session_resume_func_example(data) {
|
179 |
-
var data = data || {};
|
180 |
-
// Session exists and is being resumed
|
181 |
-
}
|
182 |
-
```
|
183 |
-
|
184 |
-
## session_heartbeat()
|
185 |
-
|
186 |
-
Session emitter. Runs every 10 seconds. This is a useful function for
|
187 |
-
pinging third party services
|
188 |
-
|
189 |
-
```js
|
190 |
-
// Usage:
|
191 |
-
|
192 |
-
// Add session_heartbeat_func_example function to 'session_heartbeat' event
|
193 |
-
_inbound.add_action( 'session_heartbeat', session_heartbeat_func_example, 10);
|
194 |
-
|
195 |
-
function session_heartbeat_func_example(data) {
|
196 |
-
var data = data || {};
|
197 |
-
// Do something with every 10 seconds
|
198 |
-
}
|
199 |
-
```
|
200 |
-
|
201 |
-
## page_visit()
|
202 |
-
|
203 |
-
Triggers Every Page View
|
204 |
-
|
205 |
-
```js
|
206 |
-
// Usage:
|
207 |
-
|
208 |
-
// Add function to 'page_visit' event
|
209 |
-
_inbound.add_action( 'page_visit', page_visit_func_example, 10);
|
210 |
-
|
211 |
-
function session_idle_func_example(pageData) {
|
212 |
-
var pageData = pageData || {};
|
213 |
-
if( pageData.view_count > 8 ){
|
214 |
-
alert('Wow you have been to this page more than 8 times.');
|
215 |
-
}
|
216 |
-
}
|
217 |
-
```
|
218 |
-
|
219 |
-
## page_first_visit()
|
220 |
-
|
221 |
-
Triggers If the visitor has never seen the page before
|
222 |
-
|
223 |
-
```js
|
224 |
-
// Usage:
|
225 |
-
|
226 |
-
// Add function to 'page_first_visit' event
|
227 |
-
_inbound.add_action( 'page_first_visit', page_first_visit_func_example, 10);
|
228 |
-
|
229 |
-
function page_first_visit_func_example(pageData) {
|
230 |
-
var pageData = pageData || {};
|
231 |
-
alert('Welcome to this page! Its the first time you have seen it')
|
232 |
-
}
|
233 |
-
```
|
234 |
-
|
235 |
-
## page_revisit()
|
236 |
-
|
237 |
-
Triggers If the visitor has seen the page before
|
238 |
-
|
239 |
-
```js
|
240 |
-
// Usage:
|
241 |
-
|
242 |
-
// Add function to 'page_revisit' event
|
243 |
-
_inbound.add_action( 'page_revisit', page_revisit_func_example, 10);
|
244 |
-
|
245 |
-
function page_revisit_func_example(pageData) {
|
246 |
-
var pageData = pageData || {};
|
247 |
-
alert('Welcome back to this page!');
|
248 |
-
// Show visitor special content/offer
|
249 |
-
}
|
250 |
-
```
|
251 |
-
|
252 |
-
## tab_hidden()
|
253 |
-
|
254 |
-
`tab_hidden` is triggered when the visitor switches browser tabs
|
255 |
-
|
256 |
-
```js
|
257 |
-
// Usage:
|
258 |
-
|
259 |
-
// Adding the callback
|
260 |
-
function tab_hidden_function( data ) {
|
261 |
-
alert('The Tab is Hidden');
|
262 |
-
};
|
263 |
-
|
264 |
-
// Hook the function up the the `tab_hidden` event
|
265 |
-
_inbound.add_action( 'tab_hidden', tab_hidden_function, 10 );
|
266 |
-
```
|
267 |
-
|
268 |
-
## tab_visible()
|
269 |
-
|
270 |
-
`tab_visible` is triggered when the visitor switches back to the sites tab
|
271 |
-
|
272 |
-
```js
|
273 |
-
// Usage:
|
274 |
-
|
275 |
-
// Adding the callback
|
276 |
-
function tab_visible_function( data ) {
|
277 |
-
alert('Welcome back to this tab!');
|
278 |
-
// trigger popup or offer special discount etc.
|
279 |
-
};
|
280 |
-
|
281 |
-
// Hook the function up the the `tab_visible` event
|
282 |
-
_inbound.add_action( 'tab_visible', tab_visible_function, 10 );
|
283 |
-
```
|
284 |
-
|
285 |
-
## tab_mouseout()
|
286 |
-
|
287 |
-
`tab_mouseout` is triggered when the visitor mouses out of the browser window.
|
288 |
-
This is especially useful for exit popups
|
289 |
-
|
290 |
-
```js
|
291 |
-
// Usage:
|
292 |
-
|
293 |
-
// Adding the callback
|
294 |
-
function tab_mouseout_function( data ) {
|
295 |
-
alert("Wait don't Go");
|
296 |
-
// trigger popup or offer special discount etc.
|
297 |
-
};
|
298 |
-
|
299 |
-
// Hook the function up the the `tab_mouseout` event
|
300 |
-
_inbound.add_action( 'tab_mouseout', tab_mouseout_function, 10 );
|
301 |
-
```
|
302 |
-
|
303 |
-
## form_input_change()
|
304 |
-
|
305 |
-
`form_input_change` is triggered when tracked form inputs change
|
306 |
-
You can use this to add additional validation or set conditional triggers
|
307 |
-
|
308 |
-
```js
|
309 |
-
// Usage:
|
310 |
-
|
311 |
-
```
|
312 |
-
|
313 |
-
## form_before_submission()
|
314 |
-
|
315 |
-
`form_before_submission` is triggered before the form is submitted to the server.
|
316 |
-
You can filter the data here or send it to third party services
|
317 |
-
|
318 |
-
```js
|
319 |
-
// Usage:
|
320 |
-
|
321 |
-
// Adding the callback
|
322 |
-
function form_before_submission_function( data ) {
|
323 |
-
var data = data || {};
|
324 |
-
// filter form data
|
325 |
-
};
|
326 |
-
|
327 |
-
// Hook the function up the the `form_before_submission` event
|
328 |
-
_inbound.add_action( 'form_before_submission', form_before_submission_function, 10 );
|
329 |
-
```
|
330 |
-
|
331 |
-
## form_after_submission()
|
332 |
-
|
333 |
-
`form_after_submission` is triggered after the form is submitted to the server.
|
334 |
-
You can filter the data here or send it to third party services
|
335 |
-
|
336 |
-
```js
|
337 |
-
// Usage:
|
338 |
-
|
339 |
-
// Adding the callback
|
340 |
-
function form_after_submission_function( data ) {
|
341 |
-
var data = data || {};
|
342 |
-
// filter form data
|
343 |
-
};
|
344 |
-
|
345 |
-
// Hook the function up the the `form_after_submission` event
|
346 |
-
_inbound.add_action( 'form_after_submission', form_after_submission_function, 10 );
|
347 |
-
```
|
348 |
-
|
349 |
-
## search_before_caching()
|
350 |
-
|
351 |
-
`search_before_caching` is triggered before the search is stored in the user's browser.
|
352 |
-
If a lead ID is set, the search data will be saved to the server when the next page loads.
|
353 |
-
You can filter the data here or send it to third party services
|
354 |
-
|
355 |
-
```js
|
356 |
-
// Usage:
|
357 |
-
|
358 |
-
// Adding the callback
|
359 |
-
function search_before_caching_function( data ) {
|
360 |
-
var data = data || {};
|
361 |
-
// filter search data
|
362 |
-
};
|
363 |
-
|
364 |
-
// Hook the function up the the `search_before_caching` event
|
365 |
-
_inbound.add_action( 'search_before_caching', search_before_caching_function, 10 );
|
366 |
-
```
|
367 |
-
|
368 |
-
button == the button that was clicked, form == the form that button belongs to, formRedirectUrl == the link that the form redirects to, if set
|
369 |
-
|
370 |
-
Get the button...
|
371 |
-
|
372 |
-
## if()
|
373 |
-
|
374 |
-
If not an iframe
|
375 |
-
|
376 |
-
If it is an iframe
|
377 |
-
|
378 |
-
## if()
|
379 |
-
|
380 |
-
If the redirect link is not set, or there is a single space in it, the form isn't supposed to redirect. So set the action for void
|
381 |
-
|
382 |
-
## if()
|
383 |
-
|
384 |
-
If not an iframe
|
385 |
-
|
386 |
-
If it is an iframe
|
387 |
-
|
388 |
-
<!-- End core\shared\assets\js\frontend\analytics-src\analytics.events.js -->
|
389 |
-
|
1 |
+
|
2 |
+
|
3 |
+
<!-- Start core\shared\assets\js\frontend\analytics-src\analytics.events.js -->
|
4 |
+
|
5 |
+
# Analytics Events
|
6 |
+
|
7 |
+
Events are triggered throughout the visitors journey through the site. See more on [Inbound Now][in]
|
8 |
+
|
9 |
+
Version: 0.0.2
|
10 |
+
[in]: http://www.inboundnow.com/
|
11 |
+
|
12 |
+
# Event Usage
|
13 |
+
|
14 |
+
Events are triggered throughout the visitors path through the site.
|
15 |
+
You can hook into these custom actions and filters much like WordPress Core
|
16 |
+
|
17 |
+
See below for examples
|
18 |
+
|
19 |
+
Adding Custom Actions
|
20 |
+
------------------
|
21 |
+
You can hook into custom events throughout analytics. See the full list of available [events below](#all-events)
|
22 |
+
|
23 |
+
`
|
24 |
+
_inbound.add_action( 'action_name', callback, priority );
|
25 |
+
`
|
26 |
+
|
27 |
+
```js
|
28 |
+
// example:
|
29 |
+
|
30 |
+
// Add custom function to `page_visit` event
|
31 |
+
_inbound.add_action( 'page_visit', callback, 10 );
|
32 |
+
|
33 |
+
// add custom callback to trigger when `page_visit` fires
|
34 |
+
function callback(pageData){
|
35 |
+
var pageData = pageData || {};
|
36 |
+
// run callback on 'page_visit' trigger
|
37 |
+
alert(pageData.title);
|
38 |
+
}
|
39 |
+
```
|
40 |
+
|
41 |
+
### Params:
|
42 |
+
|
43 |
+
* **string** *action_name* Name of the event trigger
|
44 |
+
* **function** *callback* function to trigger when event happens
|
45 |
+
* **int** *priority* Order to trigger the event in
|
46 |
+
|
47 |
+
Removing Custom Actions
|
48 |
+
------------------
|
49 |
+
You can hook into custom events throughout analytics. See the full list of available [events below](#all-events)
|
50 |
+
|
51 |
+
`
|
52 |
+
_inbound.remove_action( 'action_name');
|
53 |
+
`
|
54 |
+
|
55 |
+
```js
|
56 |
+
// example:
|
57 |
+
|
58 |
+
_inbound.remove_action( 'page_visit');
|
59 |
+
// all 'page_visit' actions have been deregistered
|
60 |
+
```
|
61 |
+
|
62 |
+
### Params:
|
63 |
+
|
64 |
+
* **string** *action_name* Name of the event trigger
|
65 |
+
|
66 |
+
# Event List
|
67 |
+
|
68 |
+
Events are triggered throughout the visitors journey through the site
|
69 |
+
|
70 |
+
## analytics_ready()
|
71 |
+
|
72 |
+
Triggers when analyics has finished loading
|
73 |
+
|
74 |
+
## url_parameters()
|
75 |
+
|
76 |
+
Triggers when the browser url params are parsed. You can perform custom actions
|
77 |
+
if specific url params exist.
|
78 |
+
|
79 |
+
```js
|
80 |
+
// Usage:
|
81 |
+
|
82 |
+
// Add function to 'url_parameters' event
|
83 |
+
_inbound.add_action( 'url_parameters', url_parameters_func_example, 10);
|
84 |
+
|
85 |
+
function url_parameters_func_example(urlParams) {
|
86 |
+
var urlParams = urlParams || {};
|
87 |
+
for( var param in urlParams ) {
|
88 |
+
var key = param;
|
89 |
+
var value = urlParams[param];
|
90 |
+
}
|
91 |
+
// All URL Params
|
92 |
+
alert(JSON.stringify(urlParams));
|
93 |
+
|
94 |
+
// Check if URL parameter `utm_source` exists and matches value
|
95 |
+
if(urlParams.utm_source === "twitter") {
|
96 |
+
alert('This person is from twitter!');
|
97 |
+
}
|
98 |
+
}
|
99 |
+
```
|
100 |
+
|
101 |
+
## session_start()
|
102 |
+
|
103 |
+
Triggers when session starts
|
104 |
+
|
105 |
+
```js
|
106 |
+
// Usage:
|
107 |
+
|
108 |
+
// Add function to 'session_start' event
|
109 |
+
_inbound.add_action( 'session_start', session_start_func_example, 10);
|
110 |
+
|
111 |
+
function session_start_func_example(data) {
|
112 |
+
var data = data || {};
|
113 |
+
// session start. Do something for new visitor
|
114 |
+
}
|
115 |
+
```
|
116 |
+
|
117 |
+
## session_end()
|
118 |
+
|
119 |
+
Triggers when visitor session goes idle for more than 30 minutes.
|
120 |
+
|
121 |
+
```js
|
122 |
+
// Usage:
|
123 |
+
|
124 |
+
// Add function to 'session_end' event
|
125 |
+
_inbound.add_action( 'session_end', session_end_func_example, 10);
|
126 |
+
|
127 |
+
function session_end_func_example(data) {
|
128 |
+
var data = data || {};
|
129 |
+
// Do something when session ends
|
130 |
+
alert("Hey! It's been 30 minutes... where did you go?");
|
131 |
+
}
|
132 |
+
```
|
133 |
+
|
134 |
+
## session_active()
|
135 |
+
|
136 |
+
Triggers if active session is detected
|
137 |
+
|
138 |
+
```js
|
139 |
+
// Usage:
|
140 |
+
|
141 |
+
// Add function to 'session_active' event
|
142 |
+
_inbound.add_action( 'session_active', session_active_func_example, 10);
|
143 |
+
|
144 |
+
function session_active_func_example(data) {
|
145 |
+
var data = data || {};
|
146 |
+
// session active
|
147 |
+
}
|
148 |
+
```
|
149 |
+
|
150 |
+
## session_idle()
|
151 |
+
|
152 |
+
Triggers when visitor session goes idle. Idling occurs after 60 seconds of
|
153 |
+
inactivity or when the visitor switches browser tabs
|
154 |
+
|
155 |
+
```js
|
156 |
+
// Usage:
|
157 |
+
|
158 |
+
// Add function to 'session_idle' event
|
159 |
+
_inbound.add_action( 'session_idle', session_idle_func_example, 10);
|
160 |
+
|
161 |
+
function session_idle_func_example(data) {
|
162 |
+
var data = data || {};
|
163 |
+
// Do something when session idles
|
164 |
+
alert('Here is a special offer for you!');
|
165 |
+
}
|
166 |
+
```
|
167 |
+
|
168 |
+
## session_resume()
|
169 |
+
|
170 |
+
Triggers when session is already active and gets resumed
|
171 |
+
|
172 |
+
```js
|
173 |
+
// Usage:
|
174 |
+
|
175 |
+
// Add function to 'session_resume' event
|
176 |
+
_inbound.add_action( 'session_resume', session_resume_func_example, 10);
|
177 |
+
|
178 |
+
function session_resume_func_example(data) {
|
179 |
+
var data = data || {};
|
180 |
+
// Session exists and is being resumed
|
181 |
+
}
|
182 |
+
```
|
183 |
+
|
184 |
+
## session_heartbeat()
|
185 |
+
|
186 |
+
Session emitter. Runs every 10 seconds. This is a useful function for
|
187 |
+
pinging third party services
|
188 |
+
|
189 |
+
```js
|
190 |
+
// Usage:
|
191 |
+
|
192 |
+
// Add session_heartbeat_func_example function to 'session_heartbeat' event
|
193 |
+
_inbound.add_action( 'session_heartbeat', session_heartbeat_func_example, 10);
|
194 |
+
|
195 |
+
function session_heartbeat_func_example(data) {
|
196 |
+
var data = data || {};
|
197 |
+
// Do something with every 10 seconds
|
198 |
+
}
|
199 |
+
```
|
200 |
+
|
201 |
+
## page_visit()
|
202 |
+
|
203 |
+
Triggers Every Page View
|
204 |
+
|
205 |
+
```js
|
206 |
+
// Usage:
|
207 |
+
|
208 |
+
// Add function to 'page_visit' event
|
209 |
+
_inbound.add_action( 'page_visit', page_visit_func_example, 10);
|
210 |
+
|
211 |
+
function session_idle_func_example(pageData) {
|
212 |
+
var pageData = pageData || {};
|
213 |
+
if( pageData.view_count > 8 ){
|
214 |
+
alert('Wow you have been to this page more than 8 times.');
|
215 |
+
}
|
216 |
+
}
|
217 |
+
```
|
218 |
+
|
219 |
+
## page_first_visit()
|
220 |
+
|
221 |
+
Triggers If the visitor has never seen the page before
|
222 |
+
|
223 |
+
```js
|
224 |
+
// Usage:
|
225 |
+
|
226 |
+
// Add function to 'page_first_visit' event
|
227 |
+
_inbound.add_action( 'page_first_visit', page_first_visit_func_example, 10);
|
228 |
+
|
229 |
+
function page_first_visit_func_example(pageData) {
|
230 |
+
var pageData = pageData || {};
|
231 |
+
alert('Welcome to this page! Its the first time you have seen it')
|
232 |
+
}
|
233 |
+
```
|
234 |
+
|
235 |
+
## page_revisit()
|
236 |
+
|
237 |
+
Triggers If the visitor has seen the page before
|
238 |
+
|
239 |
+
```js
|
240 |
+
// Usage:
|
241 |
+
|
242 |
+
// Add function to 'page_revisit' event
|
243 |
+
_inbound.add_action( 'page_revisit', page_revisit_func_example, 10);
|
244 |
+
|
245 |
+
function page_revisit_func_example(pageData) {
|
246 |
+
var pageData = pageData || {};
|
247 |
+
alert('Welcome back to this page!');
|
248 |
+
// Show visitor special content/offer
|
249 |
+
}
|
250 |
+
```
|
251 |
+
|
252 |
+
## tab_hidden()
|
253 |
+
|
254 |
+
`tab_hidden` is triggered when the visitor switches browser tabs
|
255 |
+
|
256 |
+
```js
|
257 |
+
// Usage:
|
258 |
+
|
259 |
+
// Adding the callback
|
260 |
+
function tab_hidden_function( data ) {
|
261 |
+
alert('The Tab is Hidden');
|
262 |
+
};
|
263 |
+
|
264 |
+
// Hook the function up the the `tab_hidden` event
|
265 |
+
_inbound.add_action( 'tab_hidden', tab_hidden_function, 10 );
|
266 |
+
```
|
267 |
+
|
268 |
+
## tab_visible()
|
269 |
+
|
270 |
+
`tab_visible` is triggered when the visitor switches back to the sites tab
|
271 |
+
|
272 |
+
```js
|
273 |
+
// Usage:
|
274 |
+
|
275 |
+
// Adding the callback
|
276 |
+
function tab_visible_function( data ) {
|
277 |
+
alert('Welcome back to this tab!');
|
278 |
+
// trigger popup or offer special discount etc.
|
279 |
+
};
|
280 |
+
|
281 |
+
// Hook the function up the the `tab_visible` event
|
282 |
+
_inbound.add_action( 'tab_visible', tab_visible_function, 10 );
|
283 |
+
```
|
284 |
+
|
285 |
+
## tab_mouseout()
|
286 |
+
|
287 |
+
`tab_mouseout` is triggered when the visitor mouses out of the browser window.
|
288 |
+
This is especially useful for exit popups
|
289 |
+
|
290 |
+
```js
|
291 |
+
// Usage:
|
292 |
+
|
293 |
+
// Adding the callback
|
294 |
+
function tab_mouseout_function( data ) {
|
295 |
+
alert("Wait don't Go");
|
296 |
+
// trigger popup or offer special discount etc.
|
297 |
+
};
|
298 |
+
|
299 |
+
// Hook the function up the the `tab_mouseout` event
|
300 |
+
_inbound.add_action( 'tab_mouseout', tab_mouseout_function, 10 );
|
301 |
+
```
|
302 |
+
|
303 |
+
## form_input_change()
|
304 |
+
|
305 |
+
`form_input_change` is triggered when tracked form inputs change
|
306 |
+
You can use this to add additional validation or set conditional triggers
|
307 |
+
|
308 |
+
```js
|
309 |
+
// Usage:
|
310 |
+
|
311 |
+
```
|
312 |
+
|
313 |
+
## form_before_submission()
|
314 |
+
|
315 |
+
`form_before_submission` is triggered before the form is submitted to the server.
|
316 |
+
You can filter the data here or send it to third party services
|
317 |
+
|
318 |
+
```js
|
319 |
+
// Usage:
|
320 |
+
|
321 |
+
// Adding the callback
|
322 |
+
function form_before_submission_function( data ) {
|
323 |
+
var data = data || {};
|
324 |
+
// filter form data
|
325 |
+
};
|
326 |
+
|
327 |
+
// Hook the function up the the `form_before_submission` event
|
328 |
+
_inbound.add_action( 'form_before_submission', form_before_submission_function, 10 );
|
329 |
+
```
|
330 |
+
|
331 |
+
## form_after_submission()
|
332 |
+
|
333 |
+
`form_after_submission` is triggered after the form is submitted to the server.
|
334 |
+
You can filter the data here or send it to third party services
|
335 |
+
|
336 |
+
```js
|
337 |
+
// Usage:
|
338 |
+
|
339 |
+
// Adding the callback
|
340 |
+
function form_after_submission_function( data ) {
|
341 |
+
var data = data || {};
|
342 |
+
// filter form data
|
343 |
+
};
|
344 |
+
|
345 |
+
// Hook the function up the the `form_after_submission` event
|
346 |
+
_inbound.add_action( 'form_after_submission', form_after_submission_function, 10 );
|
347 |
+
```
|
348 |
+
|
349 |
+
## search_before_caching()
|
350 |
+
|
351 |
+
`search_before_caching` is triggered before the search is stored in the user's browser.
|
352 |
+
If a lead ID is set, the search data will be saved to the server when the next page loads.
|
353 |
+
You can filter the data here or send it to third party services
|
354 |
+
|
355 |
+
```js
|
356 |
+
// Usage:
|
357 |
+
|
358 |
+
// Adding the callback
|
359 |
+
function search_before_caching_function( data ) {
|
360 |
+
var data = data || {};
|
361 |
+
// filter search data
|
362 |
+
};
|
363 |
+
|
364 |
+
// Hook the function up the the `search_before_caching` event
|
365 |
+
_inbound.add_action( 'search_before_caching', search_before_caching_function, 10 );
|
366 |
+
```
|
367 |
+
|
368 |
+
button == the button that was clicked, form == the form that button belongs to, formRedirectUrl == the link that the form redirects to, if set
|
369 |
+
|
370 |
+
Get the button...
|
371 |
+
|
372 |
+
## if()
|
373 |
+
|
374 |
+
If not an iframe
|
375 |
+
|
376 |
+
If it is an iframe
|
377 |
+
|
378 |
+
## if()
|
379 |
+
|
380 |
+
If the redirect link is not set, or there is a single space in it, the form isn't supposed to redirect. So set the action for void
|
381 |
+
|
382 |
+
## if()
|
383 |
+
|
384 |
+
If not an iframe
|
385 |
+
|
386 |
+
If it is an iframe
|
387 |
+
|
388 |
+
<!-- End core\shared\assets\js\frontend\analytics-src\analytics.events.js -->
|
389 |
+
|