Version Description
- Updating shared files
Download this release
Release Info
Developer | adbox |
Plugin | WordPress Landing Pages |
Version | 2.5.5 |
Comparing to | |
See all releases |
Code changes from version 2.5.4 to 2.5.5
- landing-pages.php +2 -2
- readme.txt +5 -1
- shared/assets/js/frontend/analytics-src/analytics.events.js +21 -0
- shared/assets/js/frontend/analytics-src/analytics.forms.js +217 -1
- shared/assets/js/frontend/analytics-src/analytics.page.js +9 -4
- shared/assets/js/frontend/analytics-src/analytics.utils.js +89 -0
- shared/assets/js/frontend/analytics/inboundAnalytics.js +334 -2
- shared/assets/js/frontend/analytics/inboundAnalytics.min.js +2 -2
- shared/classes/class.ajax.php +1 -1
- shared/classes/class.confirm-double-optin.php +4 -27
- shared/classes/class.database-routines.php +60 -10
- shared/classes/class.events.php +86 -3
- shared/classes/class.form.php +44 -30
- shared/classes/class.inbound-api.php +35 -33
- shared/classes/class.lead-storage.php +26 -39
- shared/classes/class.list-double-optin.php +3 -21
- shared/classes/class.load-assets.php +1 -0
- shared/classes/class.load-shared.php +1 -1
- shared/classes/class.post-type.wp-lead.php +1 -0
- shared/classes/class.shortcodes.cookie-values.php +1 -0
- shared/docs/shared/assets/js/frontend/analytics-src/analytics.events.md +391 -0
- shared/shortcodes/inbound-shortcodes.php +6 -3
- shared/shortcodes/js/shortcodes.js +3 -0
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 |
|
@@ -37,7 +37,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
|
|
37 |
*/
|
38 |
private static function load_constants() {
|
39 |
|
40 |
-
define('LANDINGPAGES_CURRENT_VERSION', '2.5.
|
41 |
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
|
42 |
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
43 |
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.5
|
7 |
Author: Inbound Now
|
8 |
Author URI: http://www.inboundnow.com/
|
9 |
|
37 |
*/
|
38 |
private static function load_constants() {
|
39 |
|
40 |
+
define('LANDINGPAGES_CURRENT_VERSION', '2.5.5' );
|
41 |
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
|
42 |
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
|
43 |
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.7.4
|
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,10 @@ We also offer a guide for using <a href="https://github.com/inboundnow/landing-p
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
88 |
= 2.5.4 =
|
89 |
* Making sure PHP sessions are only used on the backend to fix X-CACHE issue.
|
90 |
* Updating shared files and database tables.
|
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.7.4
|
10 |
+
Stable Tag: 2.5.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 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 2.5.5 =
|
89 |
+
* Updating shared files
|
90 |
+
|
91 |
+
|
92 |
= 2.5.4 =
|
93 |
* Making sure PHP sessions are only used on the backend to fix X-CACHE issue.
|
94 |
* Updating shared files and database tables.
|
shared/assets/js/frontend/analytics-src/analytics.events.js
CHANGED
@@ -506,6 +506,27 @@ var _inboundEvents = (function(_inbound) {
|
|
506 |
fireEvent('form_after_submission', formData);
|
507 |
|
508 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
/*! Scrol depth https://github.com/robflaherty/jquery-scrolldepth/blob/master/jquery.scrolldepth.js */
|
510 |
|
511 |
analyticsError: function(MLHttpRequest, textStatus, errorThrown) {
|
506 |
fireEvent('form_after_submission', formData);
|
507 |
|
508 |
},
|
509 |
+
/**
|
510 |
+
* `search_before_caching` is triggered before the search is stored in the user's browser.
|
511 |
+
* If a lead ID is set, the search data will be saved to the server when the next page loads.
|
512 |
+
* You can filter the data here or send it to third party services
|
513 |
+
*
|
514 |
+
* ```js
|
515 |
+
* // Usage:
|
516 |
+
*
|
517 |
+
* // Adding the callback
|
518 |
+
* function search_before_caching_function( data ) {
|
519 |
+
* var data = data || {};
|
520 |
+
* // filter search data
|
521 |
+
* };
|
522 |
+
*
|
523 |
+
* // Hook the function up the the `search_before_caching` event
|
524 |
+
* _inbound.add_action( 'search_before_caching', search_before_caching_function, 10 );
|
525 |
+
* ```
|
526 |
+
*/
|
527 |
+
search_before_caching: function(searchData) {
|
528 |
+
fireEvent('search_before_caching', searchData);
|
529 |
+
},
|
530 |
/*! Scrol depth https://github.com/robflaherty/jquery-scrolldepth/blob/master/jquery.scrolldepth.js */
|
531 |
|
532 |
analyticsError: function(MLHttpRequest, textStatus, errorThrown) {
|
shared/assets/js/frontend/analytics-src/analytics.forms.js
CHANGED
@@ -17,6 +17,7 @@ var InboundForms = (function(_inbound) {
|
|
17 |
no_match = [],
|
18 |
rawParams = [],
|
19 |
mappedParams = [],
|
|
|
20 |
settings = _inbound.Settings;
|
21 |
|
22 |
var FieldMapArray = [
|
@@ -42,6 +43,7 @@ var InboundForms = (function(_inbound) {
|
|
42 |
init: function() {
|
43 |
_inbound.Forms.runFieldMappingFilters();
|
44 |
_inbound.Forms.formTrackInit();
|
|
|
45 |
},
|
46 |
/**
|
47 |
* This triggers the forms.field_map filter on the mapping array.
|
@@ -104,6 +106,32 @@ var InboundForms = (function(_inbound) {
|
|
104 |
}
|
105 |
}
|
106 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
checkTrackStatus: function(form) {
|
108 |
var ClassIs = form.getAttribute('class');
|
109 |
if (ClassIs !== "" && ClassIs !== null) {
|
@@ -118,6 +146,24 @@ var InboundForms = (function(_inbound) {
|
|
118 |
}
|
119 |
}
|
120 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
/* Loop through include/exclude items for tracking */
|
122 |
loopClassSelectors: function(selectors, action) {
|
123 |
for (var i = selectors.length - 1; i >= 0; i--) {
|
@@ -254,12 +300,23 @@ var InboundForms = (function(_inbound) {
|
|
254 |
_inbound.Forms.saveFormData(event.target);
|
255 |
document.body.style.cursor = "wait";
|
256 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
/* attach form listeners */
|
258 |
attachFormSubmitEvent: function(form) {
|
259 |
utils.addListener(form, 'submit', this.formListener);
|
260 |
var email_input = document.querySelector('.inbound-email');
|
261 |
/* utils.addListener(email_input, 'blur', this.mailCheck); */
|
262 |
},
|
|
|
|
|
|
|
|
|
263 |
/* Ignore CC data */
|
264 |
ignoreFieldByLabel: function(label) {
|
265 |
var ignore_field = false;
|
@@ -588,6 +645,165 @@ var InboundForms = (function(_inbound) {
|
|
588 |
_inbound.trigger('form_before_submission', formData);
|
589 |
|
590 |
utils.ajaxPost(inbound_settings.admin_url, formData, callback);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
},
|
592 |
rememberInputValues: function(input) {
|
593 |
var name = (input.name) ? "inbound_" + input.name : '';
|
@@ -987,4 +1203,4 @@ var InboundForms = (function(_inbound) {
|
|
987 |
|
988 |
return _inbound;
|
989 |
|
990 |
-
})(_inbound || {});
|
17 |
no_match = [],
|
18 |
rawParams = [],
|
19 |
mappedParams = [],
|
20 |
+
callTracker = {},
|
21 |
settings = _inbound.Settings;
|
22 |
|
23 |
var FieldMapArray = [
|
43 |
init: function() {
|
44 |
_inbound.Forms.runFieldMappingFilters();
|
45 |
_inbound.Forms.formTrackInit();
|
46 |
+
_inbound.Forms.searchTrackInit();
|
47 |
},
|
48 |
/**
|
49 |
* This triggers the forms.field_map filter on the mapping array.
|
106 |
}
|
107 |
}
|
108 |
},
|
109 |
+
searchTrackInit: function(){
|
110 |
+
|
111 |
+
/* exit if searches aren't supposed to be tracked, or this function has already been called */
|
112 |
+
if(inbound_settings.search_tracking == 'off' || callTracker['searchTrackInit']){
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
for (var i = 0; i < window.document.forms.length; i++) {
|
117 |
+
var trackForm = false;
|
118 |
+
var form = window.document.forms[i];
|
119 |
+
/* process forms only once */
|
120 |
+
if (!form.dataset.searchChecked) {
|
121 |
+
form.dataset.searchChecked = true;
|
122 |
+
trackForm = this.checkSearchTrackStatus(form);
|
123 |
+
if (trackForm) {
|
124 |
+
this.attachSearchFormSubmitEvent(form); /* attach form listener */
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
/* store the search data on init */
|
130 |
+
utils.storeSearchData();
|
131 |
+
|
132 |
+
/* log that this function has been called */
|
133 |
+
callTracker['searchTrackInit'] = true;
|
134 |
+
},
|
135 |
checkTrackStatus: function(form) {
|
136 |
var ClassIs = form.getAttribute('class');
|
137 |
if (ClassIs !== "" && ClassIs !== null) {
|
146 |
}
|
147 |
}
|
148 |
},
|
149 |
+
checkSearchTrackStatus: function(form) {
|
150 |
+
var ClassIs = form.getAttribute('class'),
|
151 |
+
IdIs = form.getAttribute('id');
|
152 |
+
if (ClassIs !== "" && ClassIs !== null) {
|
153 |
+
if (ClassIs.toLowerCase().indexOf("search") > -1) {
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
if (IdIs !== "" && IdIs !== null) {
|
158 |
+
if (IdIs.toLowerCase().indexOf("search") > -1) {
|
159 |
+
return true;
|
160 |
+
}
|
161 |
+
}else{
|
162 |
+
cb = function() { console.log(form); };
|
163 |
+
_inbound.deBugger('searches', "This search form is not tracked. Please assign on in settings...", cb);
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
},
|
167 |
/* Loop through include/exclude items for tracking */
|
168 |
loopClassSelectors: function(selectors, action) {
|
169 |
for (var i = selectors.length - 1; i >= 0; i--) {
|
300 |
_inbound.Forms.saveFormData(event.target);
|
301 |
document.body.style.cursor = "wait";
|
302 |
},
|
303 |
+
/* prevent default submission temporarily */
|
304 |
+
searchFormListener: function(event) {
|
305 |
+
//console.log(event);
|
306 |
+
event.preventDefault();
|
307 |
+
_inbound.Forms.saveSearchData(event.target);
|
308 |
+
//document.body.style.cursor = "wait";
|
309 |
+
},
|
310 |
/* attach form listeners */
|
311 |
attachFormSubmitEvent: function(form) {
|
312 |
utils.addListener(form, 'submit', this.formListener);
|
313 |
var email_input = document.querySelector('.inbound-email');
|
314 |
/* utils.addListener(email_input, 'blur', this.mailCheck); */
|
315 |
},
|
316 |
+
/* attach search form listener */
|
317 |
+
attachSearchFormSubmitEvent: function(form) {
|
318 |
+
utils.addListener(form, 'submit', this.searchFormListener);
|
319 |
+
},
|
320 |
/* Ignore CC data */
|
321 |
ignoreFieldByLabel: function(label) {
|
322 |
var ignore_field = false;
|
645 |
_inbound.trigger('form_before_submission', formData);
|
646 |
|
647 |
utils.ajaxPost(inbound_settings.admin_url, formData, callback);
|
648 |
+
},
|
649 |
+
saveSearchData: function(form) {
|
650 |
+
var inputsObject = inputsObject || {};
|
651 |
+
for (var i = 0; i < form.elements.length; i++) {
|
652 |
+
|
653 |
+
//console.log(inputsObject);
|
654 |
+
|
655 |
+
formInput = form.elements[i];
|
656 |
+
multiple = false;
|
657 |
+
|
658 |
+
if (formInput.name) {
|
659 |
+
|
660 |
+
if (formInput.dataset.ignoreFormField) {
|
661 |
+
_inbound.deBugger('searches', 'ignore ' + formInput.name);
|
662 |
+
continue;
|
663 |
+
}
|
664 |
+
|
665 |
+
inputName = formInput.name.replace(/\[([^\[]*)\]/g, "%5B%5D$1");
|
666 |
+
//inputName = inputName.replace(/-/g, "_");
|
667 |
+
if (!inputsObject[inputName]) {
|
668 |
+
inputsObject[inputName] = {};
|
669 |
+
}
|
670 |
+
if (formInput.type) {
|
671 |
+
inputsObject[inputName]['type'] = formInput.type;
|
672 |
+
|
673 |
+
}
|
674 |
+
if (!inputsObject[inputName]['name']) {
|
675 |
+
inputsObject[inputName]['name'] = formInput.name;
|
676 |
+
}
|
677 |
+
if (formInput.dataset.mapFormField) {
|
678 |
+
inputsObject[inputName]['map'] = formInput.dataset.mapFormField;
|
679 |
+
}
|
680 |
+
|
681 |
+
|
682 |
+
switch (formInput.nodeName) {
|
683 |
+
|
684 |
+
case 'INPUT':
|
685 |
+
value = this.getInputValue(formInput);
|
686 |
+
|
687 |
+
|
688 |
+
if (value === false) {
|
689 |
+
continue;
|
690 |
+
}
|
691 |
+
break;
|
692 |
+
|
693 |
+
case 'TEXTAREA':
|
694 |
+
value = formInput.value;
|
695 |
+
break;
|
696 |
+
|
697 |
+
case 'SELECT':
|
698 |
+
if (formInput.multiple) {
|
699 |
+
values = [];
|
700 |
+
multiple = true;
|
701 |
+
|
702 |
+
for (var j = 0; j < formInput.length; j++) {
|
703 |
+
if (formInput[j].selected) {
|
704 |
+
values.push(encodeURIComponent(formInput[j].value));
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
} else {
|
709 |
+
value = (formInput.value);
|
710 |
+
}
|
711 |
+
|
712 |
+
break;
|
713 |
+
}
|
714 |
+
|
715 |
+
_inbound.deBugger('searches', 'Input Value = ' + value);
|
716 |
+
|
717 |
+
|
718 |
+
if (value) {
|
719 |
+
/* inputsObject[inputName].push(multiple ? values.join(',') : encodeURIComponent(value)); */
|
720 |
+
if (!inputsObject[inputName]['value']) {
|
721 |
+
inputsObject[inputName]['value'] = [];
|
722 |
+
}
|
723 |
+
inputsObject[inputName]['value'].push(multiple ? values.join(',') : encodeURIComponent(value));
|
724 |
+
var value = multiple ? values.join(',') : encodeURIComponent(value);
|
725 |
+
|
726 |
+
}
|
727 |
+
|
728 |
+
}
|
729 |
+
}
|
730 |
+
|
731 |
+
_inbound.deBugger('searches', inputsObject);
|
732 |
+
|
733 |
+
/* create an array of search fields //(not fully implemented) at the moment, it only maps the text in the "search" input types*/
|
734 |
+
var searchQuery = [];
|
735 |
+
for (var input in inputsObject) {
|
736 |
+
var inputValue = inputsObject[input]['value'];
|
737 |
+
var inputType = inputsObject[input]['type'];
|
738 |
+
|
739 |
+
/* Add custom hook here to look for additional values */
|
740 |
+
if (typeof(inputValue) != "undefined" && inputValue != null && inputValue != "") {
|
741 |
+
// This is for mapping all fields of a search form. The resulting string is processed
|
742 |
+
// in inbound-pro\classes\admin\report-templates\report.lead-searches-and-comments.php
|
743 |
+
// In the function print_action_popup()
|
744 |
+
// searchQuery.push(input + '|value|' + inputsObject[input]['value'].join(','));
|
745 |
+
|
746 |
+
// get the search input value
|
747 |
+
if(inputType == 'search'){
|
748 |
+
searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
|
749 |
+
}
|
750 |
+
}
|
751 |
+
}
|
752 |
+
/* exit if there isn't a search query */
|
753 |
+
if(!searchQuery[0]){
|
754 |
+
return;
|
755 |
+
}
|
756 |
+
|
757 |
+
var searchString = searchQuery.join('|field|');
|
758 |
+
_inbound.deBugger('searches', "Stringified Search Form PARAMS: " + searchString);
|
759 |
+
|
760 |
+
/* Get Variation ID */
|
761 |
+
if (typeof(landing_path_info) != "undefined") {
|
762 |
+
var variation = landing_path_info.variation;
|
763 |
+
} else if (typeof(cta_path_info) != "undefined") {
|
764 |
+
var variation = cta_path_info.variation;
|
765 |
+
} else {
|
766 |
+
var variation = inbound_settings.variation_id;
|
767 |
+
}
|
768 |
+
var post_type = inbound_settings.post_type || 'page';
|
769 |
+
var page_id = inbound_settings.post_id || 0;
|
770 |
+
|
771 |
+
var user_UID = utils.readCookie("wp_lead_uid");
|
772 |
+
|
773 |
+
/* get the user's email address if possible */
|
774 |
+
if(inbound_settings.wp_lead_data.lead_email){
|
775 |
+
email = inbound_settings.wp_lead_data.lead_email;
|
776 |
+
}else if(utils.readCookie('inbound_wpleads_email_address')){
|
777 |
+
email = utils.readCookie('inbound_wpleads_email_address');
|
778 |
+
}else{
|
779 |
+
email = '';
|
780 |
+
}
|
781 |
+
|
782 |
+
/* Filter here for raw */
|
783 |
+
searchData = {
|
784 |
+
'email': email,
|
785 |
+
'search_data': searchString,
|
786 |
+
'user_UID': user_UID,
|
787 |
+
'post_type': post_type,
|
788 |
+
'page_id': page_id,
|
789 |
+
'variation': variation,
|
790 |
+
'source': utils.readCookie("inbound_referral_site"),
|
791 |
+
'ip_address': inbound_settings.ip_address,
|
792 |
+
'timestamp': Math.floor((new Date).getTime()/1000),
|
793 |
+
};
|
794 |
+
|
795 |
+
/* filter data before caching it in the user's browser */
|
796 |
+
_inbound.trigger('search_before_caching', searchData);
|
797 |
+
|
798 |
+
/* cache search data */
|
799 |
+
if(inbound_settings.wp_lead_data.lead_id){
|
800 |
+
searchData['lead_id'] = inbound_settings.wp_lead_data.lead_id;
|
801 |
+
utils.cacheSearchData(searchData, form)
|
802 |
+
}else{
|
803 |
+
utils.cacheSearchData(searchData, form);
|
804 |
+
}
|
805 |
+
|
806 |
+
|
807 |
},
|
808 |
rememberInputValues: function(input) {
|
809 |
var name = (input.name) ? "inbound_" + input.name : '';
|
1203 |
|
1204 |
return _inbound;
|
1205 |
|
1206 |
+
})(_inbound || {});
|
shared/assets/js/frontend/analytics-src/analytics.page.js
CHANGED
@@ -339,11 +339,15 @@ var _inboundPageTracking = (function(_inbound) {
|
|
339 |
}
|
340 |
|
341 |
/* Let's try and fire this last - also defines what constitutes a bounce - */
|
342 |
-
|
343 |
setTimeout(function(){
|
344 |
var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
|
345 |
var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
|
346 |
-
var
|
|
|
|
|
|
|
|
|
347 |
|
348 |
var data = {
|
349 |
action: 'inbound_track_lead',
|
@@ -354,7 +358,8 @@ var _inboundPageTracking = (function(_inbound) {
|
|
354 |
post_type: inbound_settings.post_type,
|
355 |
current_url: window.location.href,
|
356 |
page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
|
357 |
-
|
|
|
358 |
json: '0'
|
359 |
};
|
360 |
|
@@ -365,7 +370,7 @@ var _inboundPageTracking = (function(_inbound) {
|
|
365 |
|
366 |
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, firePageCallback);
|
367 |
|
368 |
-
} ,
|
369 |
|
370 |
|
371 |
});
|
339 |
}
|
340 |
|
341 |
/* Let's try and fire this last - also defines what constitutes a bounce - */
|
342 |
+
document.addEventListener("DOMContentLoaded", function() {
|
343 |
setTimeout(function(){
|
344 |
var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
|
345 |
var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
|
346 |
+
var ctas_loaded = _inbound.totalStorage('wp_cta_loaded');
|
347 |
+
var ctas_impressions = _inbound.totalStorage('wp_cta_impressions');
|
348 |
+
|
349 |
+
/* now reset impressions */
|
350 |
+
_inbound.totalStorage('wp_cta_impressions' , {} );
|
351 |
|
352 |
var data = {
|
353 |
action: 'inbound_track_lead',
|
358 |
post_type: inbound_settings.post_type,
|
359 |
current_url: window.location.href,
|
360 |
page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
|
361 |
+
cta_impressions : JSON.stringify(ctas_impressions),
|
362 |
+
cta_history : JSON.stringify(ctas_loaded),
|
363 |
json: '0'
|
364 |
};
|
365 |
|
370 |
|
371 |
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, firePageCallback);
|
372 |
|
373 |
+
} , 200 );
|
374 |
|
375 |
|
376 |
});
|
shared/assets/js/frontend/analytics-src/analytics.utils.js
CHANGED
@@ -760,6 +760,95 @@ var _inboundUtils = (function(_inbound) {
|
|
760 |
googleTagManager = true;
|
761 |
}
|
762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
}
|
764 |
};
|
765 |
|
760 |
googleTagManager = true;
|
761 |
}
|
762 |
|
763 |
+
},
|
764 |
+
/**
|
765 |
+
* Caches user's search data in the browser until they can be saved to the database
|
766 |
+
*/
|
767 |
+
cacheSearchData: function(searchData, form) {
|
768 |
+
|
769 |
+
if(storageSupported){
|
770 |
+
//store the searches in the local storage
|
771 |
+
var stored = _inbound.totalStorage.getItem('inbound_search_storage');
|
772 |
+
if(stored){
|
773 |
+
//if there are stored searches, put the new one in the first index
|
774 |
+
stored.unshift(searchData);
|
775 |
+
_inbound.totalStorage.setItem('inbound_search_storage', stored);
|
776 |
+
}else{
|
777 |
+
//if there aren't any searches stored, save the current search
|
778 |
+
var store = [searchData];
|
779 |
+
_inbound.totalStorage.setItem('inbound_search_storage', store);
|
780 |
+
}
|
781 |
+
}else{
|
782 |
+
//if local storage is not possible, store the data in a cookie
|
783 |
+
var new_search = JSON.stringify(searchData),
|
784 |
+
stored_searches = this.readCookie('inbound_search_storage');
|
785 |
+
|
786 |
+
if(stored_searches){
|
787 |
+
//add the old searches to the new one
|
788 |
+
new_search += ('SPLIT-TOKEN' + stored_searches);
|
789 |
+
}
|
790 |
+
this.createCookie('inbound_search_storage', new_search, '180');
|
791 |
+
}
|
792 |
+
|
793 |
+
_inbound.Forms.releaseFormSubmit(form);
|
794 |
+
},
|
795 |
+
/**
|
796 |
+
* Stores search data to the database on page load.
|
797 |
+
* If successful, it erases the cached searches from the user's browser
|
798 |
+
*/
|
799 |
+
storeSearchData: function(){
|
800 |
+
|
801 |
+
/*if there isn't a lead id or the nonce isn't set, don't try to store the data*/
|
802 |
+
if(!inbound_settings.wp_lead_data.lead_id || !inbound_settings.wp_lead_data.lead_nonce){
|
803 |
+
return;
|
804 |
+
}
|
805 |
+
|
806 |
+
var dataToSend = [],
|
807 |
+
localStorageData = _inbound.totalStorage.getItem('inbound_search_storage'),
|
808 |
+
cookieStorageData = this.readCookie('inbound_search_storage');
|
809 |
+
|
810 |
+
/*if nothing is stored, exit*/
|
811 |
+
if(!localStorageData && !cookieStorageData){
|
812 |
+
return;
|
813 |
+
}
|
814 |
+
|
815 |
+
/*if set, add the cookie search data to the data to send*/
|
816 |
+
if(cookieStorageData){
|
817 |
+
cookieStorageData = cookieStorageData.split('SPLIT-TOKEN');
|
818 |
+
|
819 |
+
for(var i in cookieStorageData){
|
820 |
+
//console.log(cookieStorageData[i]);
|
821 |
+
dataToSend.push(JSON.parse(cookieStorageData[i]));
|
822 |
+
}
|
823 |
+
}
|
824 |
+
|
825 |
+
/*if set, add the locally stored data to the data to send*/
|
826 |
+
if(localStorageData){
|
827 |
+
dataToSend = dataToSend.concat(localStorageData);
|
828 |
+
}
|
829 |
+
|
830 |
+
dataToSend.sort(function(a, b){ return a.timestamp - b.timestamp; });
|
831 |
+
|
832 |
+
dataToSend = encodeURIComponent(JSON.stringify(dataToSend));
|
833 |
+
|
834 |
+
var package = {'action' : 'inbound_search_store', 'data' : dataToSend, 'nonce' : inbound_settings.wp_lead_data.lead_nonce, 'lead_id' : inbound_settings.wp_lead_data.lead_id };
|
835 |
+
|
836 |
+
callback = function(status){
|
837 |
+
if(status){ status = JSON.parse(status); }
|
838 |
+
|
839 |
+
if(status.success){
|
840 |
+
//log the success!
|
841 |
+
console.log(status.success);
|
842 |
+
//erase the stored data
|
843 |
+
_inbound.Utils.eraseCookie('inbound_search_storage');
|
844 |
+
_inbound.totalStorage.deleteItem('inbound_search_storage');
|
845 |
+
}
|
846 |
+
|
847 |
+
if(status.error){
|
848 |
+
console.log(status.error);
|
849 |
+
}
|
850 |
+
};
|
851 |
+
this.ajaxPost(inbound_settings.admin_url, package, callback);
|
852 |
}
|
853 |
};
|
854 |
|
shared/assets/js/frontend/analytics/inboundAnalytics.js
CHANGED
@@ -1295,6 +1295,95 @@ var _inboundUtils = (function(_inbound) {
|
|
1295 |
googleTagManager = true;
|
1296 |
}
|
1297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1298 |
}
|
1299 |
};
|
1300 |
|
@@ -1321,6 +1410,7 @@ var InboundForms = (function(_inbound) {
|
|
1321 |
no_match = [],
|
1322 |
rawParams = [],
|
1323 |
mappedParams = [],
|
|
|
1324 |
settings = _inbound.Settings;
|
1325 |
|
1326 |
var FieldMapArray = [
|
@@ -1346,6 +1436,7 @@ var InboundForms = (function(_inbound) {
|
|
1346 |
init: function() {
|
1347 |
_inbound.Forms.runFieldMappingFilters();
|
1348 |
_inbound.Forms.formTrackInit();
|
|
|
1349 |
},
|
1350 |
/**
|
1351 |
* This triggers the forms.field_map filter on the mapping array.
|
@@ -1408,6 +1499,32 @@ var InboundForms = (function(_inbound) {
|
|
1408 |
}
|
1409 |
}
|
1410 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1411 |
checkTrackStatus: function(form) {
|
1412 |
var ClassIs = form.getAttribute('class');
|
1413 |
if (ClassIs !== "" && ClassIs !== null) {
|
@@ -1422,6 +1539,24 @@ var InboundForms = (function(_inbound) {
|
|
1422 |
}
|
1423 |
}
|
1424 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1425 |
/* Loop through include/exclude items for tracking */
|
1426 |
loopClassSelectors: function(selectors, action) {
|
1427 |
for (var i = selectors.length - 1; i >= 0; i--) {
|
@@ -1558,12 +1693,23 @@ var InboundForms = (function(_inbound) {
|
|
1558 |
_inbound.Forms.saveFormData(event.target);
|
1559 |
document.body.style.cursor = "wait";
|
1560 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1561 |
/* attach form listeners */
|
1562 |
attachFormSubmitEvent: function(form) {
|
1563 |
utils.addListener(form, 'submit', this.formListener);
|
1564 |
var email_input = document.querySelector('.inbound-email');
|
1565 |
/* utils.addListener(email_input, 'blur', this.mailCheck); */
|
1566 |
},
|
|
|
|
|
|
|
|
|
1567 |
/* Ignore CC data */
|
1568 |
ignoreFieldByLabel: function(label) {
|
1569 |
var ignore_field = false;
|
@@ -1892,6 +2038,165 @@ var InboundForms = (function(_inbound) {
|
|
1892 |
_inbound.trigger('form_before_submission', formData);
|
1893 |
|
1894 |
utils.ajaxPost(inbound_settings.admin_url, formData, callback);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1895 |
},
|
1896 |
rememberInputValues: function(input) {
|
1897 |
var name = (input.name) ? "inbound_" + input.name : '';
|
@@ -2292,6 +2597,7 @@ var InboundForms = (function(_inbound) {
|
|
2292 |
return _inbound;
|
2293 |
|
2294 |
})(_inbound || {});
|
|
|
2295 |
/**
|
2296 |
* # Analytics Events
|
2297 |
*
|
@@ -2800,6 +3106,27 @@ var _inboundEvents = (function(_inbound) {
|
|
2800 |
fireEvent('form_after_submission', formData);
|
2801 |
|
2802 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2803 |
/*! Scrol depth https://github.com/robflaherty/jquery-scrolldepth/blob/master/jquery.scrolldepth.js */
|
2804 |
|
2805 |
analyticsError: function(MLHttpRequest, textStatus, errorThrown) {
|
@@ -3446,7 +3773,11 @@ var _inboundPageTracking = (function(_inbound) {
|
|
3446 |
setTimeout(function(){
|
3447 |
var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
|
3448 |
var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
|
3449 |
-
var
|
|
|
|
|
|
|
|
|
3450 |
|
3451 |
var data = {
|
3452 |
action: 'inbound_track_lead',
|
@@ -3457,7 +3788,8 @@ var _inboundPageTracking = (function(_inbound) {
|
|
3457 |
post_type: inbound_settings.post_type,
|
3458 |
current_url: window.location.href,
|
3459 |
page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
|
3460 |
-
|
|
|
3461 |
json: '0'
|
3462 |
};
|
3463 |
|
1295 |
googleTagManager = true;
|
1296 |
}
|
1297 |
|
1298 |
+
},
|
1299 |
+
/**
|
1300 |
+
* Caches user's search data in the browser until they can be saved to the database
|
1301 |
+
*/
|
1302 |
+
cacheSearchData: function(searchData, form) {
|
1303 |
+
|
1304 |
+
if(storageSupported){
|
1305 |
+
//store the searches in the local storage
|
1306 |
+
var stored = _inbound.totalStorage.getItem('inbound_search_storage');
|
1307 |
+
if(stored){
|
1308 |
+
//if there are stored searches, put the new one in the first index
|
1309 |
+
stored.unshift(searchData);
|
1310 |
+
_inbound.totalStorage.setItem('inbound_search_storage', stored);
|
1311 |
+
}else{
|
1312 |
+
//if there aren't any searches stored, save the current search
|
1313 |
+
var store = [searchData];
|
1314 |
+
_inbound.totalStorage.setItem('inbound_search_storage', store);
|
1315 |
+
}
|
1316 |
+
}else{
|
1317 |
+
//if local storage is not possible, store the data in a cookie
|
1318 |
+
var new_search = JSON.stringify(searchData),
|
1319 |
+
stored_searches = this.readCookie('inbound_search_storage');
|
1320 |
+
|
1321 |
+
if(stored_searches){
|
1322 |
+
//add the old searches to the new one
|
1323 |
+
new_search += ('SPLIT-TOKEN' + stored_searches);
|
1324 |
+
}
|
1325 |
+
this.createCookie('inbound_search_storage', new_search, '180');
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
_inbound.Forms.releaseFormSubmit(form);
|
1329 |
+
},
|
1330 |
+
/**
|
1331 |
+
* Stores search data to the database on page load.
|
1332 |
+
* If successful, it erases the cached searches from the user's browser
|
1333 |
+
*/
|
1334 |
+
storeSearchData: function(){
|
1335 |
+
|
1336 |
+
/*if there isn't a lead id or the nonce isn't set, don't try to store the data*/
|
1337 |
+
if(!inbound_settings.wp_lead_data.lead_id || !inbound_settings.wp_lead_data.lead_nonce){
|
1338 |
+
return;
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
var dataToSend = [],
|
1342 |
+
localStorageData = _inbound.totalStorage.getItem('inbound_search_storage'),
|
1343 |
+
cookieStorageData = this.readCookie('inbound_search_storage');
|
1344 |
+
|
1345 |
+
/*if nothing is stored, exit*/
|
1346 |
+
if(!localStorageData && !cookieStorageData){
|
1347 |
+
return;
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
/*if set, add the cookie search data to the data to send*/
|
1351 |
+
if(cookieStorageData){
|
1352 |
+
cookieStorageData = cookieStorageData.split('SPLIT-TOKEN');
|
1353 |
+
|
1354 |
+
for(var i in cookieStorageData){
|
1355 |
+
//console.log(cookieStorageData[i]);
|
1356 |
+
dataToSend.push(JSON.parse(cookieStorageData[i]));
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
/*if set, add the locally stored data to the data to send*/
|
1361 |
+
if(localStorageData){
|
1362 |
+
dataToSend = dataToSend.concat(localStorageData);
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
dataToSend.sort(function(a, b){ return a.timestamp - b.timestamp; });
|
1366 |
+
|
1367 |
+
dataToSend = encodeURIComponent(JSON.stringify(dataToSend));
|
1368 |
+
|
1369 |
+
var package = {'action' : 'inbound_search_store', 'data' : dataToSend, 'nonce' : inbound_settings.wp_lead_data.lead_nonce, 'lead_id' : inbound_settings.wp_lead_data.lead_id };
|
1370 |
+
|
1371 |
+
callback = function(status){
|
1372 |
+
if(status){ status = JSON.parse(status); }
|
1373 |
+
|
1374 |
+
if(status.success){
|
1375 |
+
//log the success!
|
1376 |
+
console.log(status.success);
|
1377 |
+
//erase the stored data
|
1378 |
+
_inbound.Utils.eraseCookie('inbound_search_storage');
|
1379 |
+
_inbound.totalStorage.deleteItem('inbound_search_storage');
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
if(status.error){
|
1383 |
+
console.log(status.error);
|
1384 |
+
}
|
1385 |
+
};
|
1386 |
+
this.ajaxPost(inbound_settings.admin_url, package, callback);
|
1387 |
}
|
1388 |
};
|
1389 |
|
1410 |
no_match = [],
|
1411 |
rawParams = [],
|
1412 |
mappedParams = [],
|
1413 |
+
callTracker = {},
|
1414 |
settings = _inbound.Settings;
|
1415 |
|
1416 |
var FieldMapArray = [
|
1436 |
init: function() {
|
1437 |
_inbound.Forms.runFieldMappingFilters();
|
1438 |
_inbound.Forms.formTrackInit();
|
1439 |
+
_inbound.Forms.searchTrackInit();
|
1440 |
},
|
1441 |
/**
|
1442 |
* This triggers the forms.field_map filter on the mapping array.
|
1499 |
}
|
1500 |
}
|
1501 |
},
|
1502 |
+
searchTrackInit: function(){
|
1503 |
+
|
1504 |
+
/* exit if searches aren't supposed to be tracked, or this function has already been called */
|
1505 |
+
if(inbound_settings.search_tracking == 'off' || callTracker['searchTrackInit']){
|
1506 |
+
return;
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
for (var i = 0; i < window.document.forms.length; i++) {
|
1510 |
+
var trackForm = false;
|
1511 |
+
var form = window.document.forms[i];
|
1512 |
+
/* process forms only once */
|
1513 |
+
if (!form.dataset.searchChecked) {
|
1514 |
+
form.dataset.searchChecked = true;
|
1515 |
+
trackForm = this.checkSearchTrackStatus(form);
|
1516 |
+
if (trackForm) {
|
1517 |
+
this.attachSearchFormSubmitEvent(form); /* attach form listener */
|
1518 |
+
}
|
1519 |
+
}
|
1520 |
+
}
|
1521 |
+
|
1522 |
+
/* store the search data on init */
|
1523 |
+
utils.storeSearchData();
|
1524 |
+
|
1525 |
+
/* log that this function has been called */
|
1526 |
+
callTracker['searchTrackInit'] = true;
|
1527 |
+
},
|
1528 |
checkTrackStatus: function(form) {
|
1529 |
var ClassIs = form.getAttribute('class');
|
1530 |
if (ClassIs !== "" && ClassIs !== null) {
|
1539 |
}
|
1540 |
}
|
1541 |
},
|
1542 |
+
checkSearchTrackStatus: function(form) {
|
1543 |
+
var ClassIs = form.getAttribute('class'),
|
1544 |
+
IdIs = form.getAttribute('id');
|
1545 |
+
if (ClassIs !== "" && ClassIs !== null) {
|
1546 |
+
if (ClassIs.toLowerCase().indexOf("search") > -1) {
|
1547 |
+
return true;
|
1548 |
+
}
|
1549 |
+
}
|
1550 |
+
if (IdIs !== "" && IdIs !== null) {
|
1551 |
+
if (IdIs.toLowerCase().indexOf("search") > -1) {
|
1552 |
+
return true;
|
1553 |
+
}
|
1554 |
+
}else{
|
1555 |
+
cb = function() { console.log(form); };
|
1556 |
+
_inbound.deBugger('searches', "This search form is not tracked. Please assign on in settings...", cb);
|
1557 |
+
return false;
|
1558 |
+
}
|
1559 |
+
},
|
1560 |
/* Loop through include/exclude items for tracking */
|
1561 |
loopClassSelectors: function(selectors, action) {
|
1562 |
for (var i = selectors.length - 1; i >= 0; i--) {
|
1693 |
_inbound.Forms.saveFormData(event.target);
|
1694 |
document.body.style.cursor = "wait";
|
1695 |
},
|
1696 |
+
/* prevent default submission temporarily */
|
1697 |
+
searchFormListener: function(event) {
|
1698 |
+
//console.log(event);
|
1699 |
+
event.preventDefault();
|
1700 |
+
_inbound.Forms.saveSearchData(event.target);
|
1701 |
+
//document.body.style.cursor = "wait";
|
1702 |
+
},
|
1703 |
/* attach form listeners */
|
1704 |
attachFormSubmitEvent: function(form) {
|
1705 |
utils.addListener(form, 'submit', this.formListener);
|
1706 |
var email_input = document.querySelector('.inbound-email');
|
1707 |
/* utils.addListener(email_input, 'blur', this.mailCheck); */
|
1708 |
},
|
1709 |
+
/* attach search form listener */
|
1710 |
+
attachSearchFormSubmitEvent: function(form) {
|
1711 |
+
utils.addListener(form, 'submit', this.searchFormListener);
|
1712 |
+
},
|
1713 |
/* Ignore CC data */
|
1714 |
ignoreFieldByLabel: function(label) {
|
1715 |
var ignore_field = false;
|
2038 |
_inbound.trigger('form_before_submission', formData);
|
2039 |
|
2040 |
utils.ajaxPost(inbound_settings.admin_url, formData, callback);
|
2041 |
+
},
|
2042 |
+
saveSearchData: function(form) {
|
2043 |
+
var inputsObject = inputsObject || {};
|
2044 |
+
for (var i = 0; i < form.elements.length; i++) {
|
2045 |
+
|
2046 |
+
//console.log(inputsObject);
|
2047 |
+
|
2048 |
+
formInput = form.elements[i];
|
2049 |
+
multiple = false;
|
2050 |
+
|
2051 |
+
if (formInput.name) {
|
2052 |
+
|
2053 |
+
if (formInput.dataset.ignoreFormField) {
|
2054 |
+
_inbound.deBugger('searches', 'ignore ' + formInput.name);
|
2055 |
+
continue;
|
2056 |
+
}
|
2057 |
+
|
2058 |
+
inputName = formInput.name.replace(/\[([^\[]*)\]/g, "%5B%5D$1");
|
2059 |
+
//inputName = inputName.replace(/-/g, "_");
|
2060 |
+
if (!inputsObject[inputName]) {
|
2061 |
+
inputsObject[inputName] = {};
|
2062 |
+
}
|
2063 |
+
if (formInput.type) {
|
2064 |
+
inputsObject[inputName]['type'] = formInput.type;
|
2065 |
+
|
2066 |
+
}
|
2067 |
+
if (!inputsObject[inputName]['name']) {
|
2068 |
+
inputsObject[inputName]['name'] = formInput.name;
|
2069 |
+
}
|
2070 |
+
if (formInput.dataset.mapFormField) {
|
2071 |
+
inputsObject[inputName]['map'] = formInput.dataset.mapFormField;
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
|
2075 |
+
switch (formInput.nodeName) {
|
2076 |
+
|
2077 |
+
case 'INPUT':
|
2078 |
+
value = this.getInputValue(formInput);
|
2079 |
+
|
2080 |
+
|
2081 |
+
if (value === false) {
|
2082 |
+
continue;
|
2083 |
+
}
|
2084 |
+
break;
|
2085 |
+
|
2086 |
+
case 'TEXTAREA':
|
2087 |
+
value = formInput.value;
|
2088 |
+
break;
|
2089 |
+
|
2090 |
+
case 'SELECT':
|
2091 |
+
if (formInput.multiple) {
|
2092 |
+
values = [];
|
2093 |
+
multiple = true;
|
2094 |
+
|
2095 |
+
for (var j = 0; j < formInput.length; j++) {
|
2096 |
+
if (formInput[j].selected) {
|
2097 |
+
values.push(encodeURIComponent(formInput[j].value));
|
2098 |
+
}
|
2099 |
+
}
|
2100 |
+
|
2101 |
+
} else {
|
2102 |
+
value = (formInput.value);
|
2103 |
+
}
|
2104 |
+
|
2105 |
+
break;
|
2106 |
+
}
|
2107 |
+
|
2108 |
+
_inbound.deBugger('searches', 'Input Value = ' + value);
|
2109 |
+
|
2110 |
+
|
2111 |
+
if (value) {
|
2112 |
+
/* inputsObject[inputName].push(multiple ? values.join(',') : encodeURIComponent(value)); */
|
2113 |
+
if (!inputsObject[inputName]['value']) {
|
2114 |
+
inputsObject[inputName]['value'] = [];
|
2115 |
+
}
|
2116 |
+
inputsObject[inputName]['value'].push(multiple ? values.join(',') : encodeURIComponent(value));
|
2117 |
+
var value = multiple ? values.join(',') : encodeURIComponent(value);
|
2118 |
+
|
2119 |
+
}
|
2120 |
+
|
2121 |
+
}
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
_inbound.deBugger('searches', inputsObject);
|
2125 |
+
|
2126 |
+
/* create an array of search fields //(not fully implemented) at the moment, it only maps the text in the "search" input types*/
|
2127 |
+
var searchQuery = [];
|
2128 |
+
for (var input in inputsObject) {
|
2129 |
+
var inputValue = inputsObject[input]['value'];
|
2130 |
+
var inputType = inputsObject[input]['type'];
|
2131 |
+
|
2132 |
+
/* Add custom hook here to look for additional values */
|
2133 |
+
if (typeof(inputValue) != "undefined" && inputValue != null && inputValue != "") {
|
2134 |
+
// This is for mapping all fields of a search form. The resulting string is processed
|
2135 |
+
// in inbound-pro\classes\admin\report-templates\report.lead-searches-and-comments.php
|
2136 |
+
// In the function print_action_popup()
|
2137 |
+
// searchQuery.push(input + '|value|' + inputsObject[input]['value'].join(','));
|
2138 |
+
|
2139 |
+
// get the search input value
|
2140 |
+
if(inputType == 'search'){
|
2141 |
+
searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
|
2142 |
+
}
|
2143 |
+
}
|
2144 |
+
}
|
2145 |
+
/* exit if there isn't a search query */
|
2146 |
+
if(!searchQuery[0]){
|
2147 |
+
return;
|
2148 |
+
}
|
2149 |
+
|
2150 |
+
var searchString = searchQuery.join('|field|');
|
2151 |
+
_inbound.deBugger('searches', "Stringified Search Form PARAMS: " + searchString);
|
2152 |
+
|
2153 |
+
/* Get Variation ID */
|
2154 |
+
if (typeof(landing_path_info) != "undefined") {
|
2155 |
+
var variation = landing_path_info.variation;
|
2156 |
+
} else if (typeof(cta_path_info) != "undefined") {
|
2157 |
+
var variation = cta_path_info.variation;
|
2158 |
+
} else {
|
2159 |
+
var variation = inbound_settings.variation_id;
|
2160 |
+
}
|
2161 |
+
var post_type = inbound_settings.post_type || 'page';
|
2162 |
+
var page_id = inbound_settings.post_id || 0;
|
2163 |
+
|
2164 |
+
var user_UID = utils.readCookie("wp_lead_uid");
|
2165 |
+
|
2166 |
+
/* get the user's email address if possible */
|
2167 |
+
if(inbound_settings.wp_lead_data.lead_email){
|
2168 |
+
email = inbound_settings.wp_lead_data.lead_email;
|
2169 |
+
}else if(utils.readCookie('inbound_wpleads_email_address')){
|
2170 |
+
email = utils.readCookie('inbound_wpleads_email_address');
|
2171 |
+
}else{
|
2172 |
+
email = '';
|
2173 |
+
}
|
2174 |
+
|
2175 |
+
/* Filter here for raw */
|
2176 |
+
searchData = {
|
2177 |
+
'email': email,
|
2178 |
+
'search_data': searchString,
|
2179 |
+
'user_UID': user_UID,
|
2180 |
+
'post_type': post_type,
|
2181 |
+
'page_id': page_id,
|
2182 |
+
'variation': variation,
|
2183 |
+
'source': utils.readCookie("inbound_referral_site"),
|
2184 |
+
'ip_address': inbound_settings.ip_address,
|
2185 |
+
'timestamp': Math.floor((new Date).getTime()/1000),
|
2186 |
+
};
|
2187 |
+
|
2188 |
+
/* filter data before caching it in the user's browser */
|
2189 |
+
_inbound.trigger('search_before_caching', searchData);
|
2190 |
+
|
2191 |
+
/* cache search data */
|
2192 |
+
if(inbound_settings.wp_lead_data.lead_id){
|
2193 |
+
searchData['lead_id'] = inbound_settings.wp_lead_data.lead_id;
|
2194 |
+
utils.cacheSearchData(searchData, form)
|
2195 |
+
}else{
|
2196 |
+
utils.cacheSearchData(searchData, form);
|
2197 |
+
}
|
2198 |
+
|
2199 |
+
|
2200 |
},
|
2201 |
rememberInputValues: function(input) {
|
2202 |
var name = (input.name) ? "inbound_" + input.name : '';
|
2597 |
return _inbound;
|
2598 |
|
2599 |
})(_inbound || {});
|
2600 |
+
|
2601 |
/**
|
2602 |
* # Analytics Events
|
2603 |
*
|
3106 |
fireEvent('form_after_submission', formData);
|
3107 |
|
3108 |
},
|
3109 |
+
/**
|
3110 |
+
* `search_before_caching` is triggered before the search is stored in the user's browser.
|
3111 |
+
* If a lead ID is set, the search data will be saved to the server when the next page loads.
|
3112 |
+
* You can filter the data here or send it to third party services
|
3113 |
+
*
|
3114 |
+
* ```js
|
3115 |
+
* // Usage:
|
3116 |
+
*
|
3117 |
+
* // Adding the callback
|
3118 |
+
* function search_before_caching_function( data ) {
|
3119 |
+
* var data = data || {};
|
3120 |
+
* // filter search data
|
3121 |
+
* };
|
3122 |
+
*
|
3123 |
+
* // Hook the function up the the `search_before_caching` event
|
3124 |
+
* _inbound.add_action( 'search_before_caching', search_before_caching_function, 10 );
|
3125 |
+
* ```
|
3126 |
+
*/
|
3127 |
+
search_before_caching: function(searchData) {
|
3128 |
+
fireEvent('search_before_caching', searchData);
|
3129 |
+
},
|
3130 |
/*! Scrol depth https://github.com/robflaherty/jquery-scrolldepth/blob/master/jquery.scrolldepth.js */
|
3131 |
|
3132 |
analyticsError: function(MLHttpRequest, textStatus, errorThrown) {
|
3773 |
setTimeout(function(){
|
3774 |
var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
|
3775 |
var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
|
3776 |
+
var ctas_loaded = _inbound.totalStorage('wp_cta_loaded');
|
3777 |
+
var ctas_impressions = _inbound.totalStorage('wp_cta_impressions');
|
3778 |
+
|
3779 |
+
/* now reset impressions */
|
3780 |
+
_inbound.totalStorage('wp_cta_impressions' , {} );
|
3781 |
|
3782 |
var data = {
|
3783 |
action: 'inbound_track_lead',
|
3788 |
post_type: inbound_settings.post_type,
|
3789 |
current_url: window.location.href,
|
3790 |
page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
|
3791 |
+
cta_impressions : JSON.stringify(ctas_impressions),
|
3792 |
+
cta_history : JSON.stringify(ctas_loaded),
|
3793 |
json: '0'
|
3794 |
};
|
3795 |
|
shared/assets/js/frontend/analytics/inboundAnalytics.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
|
2 |
-
function inboundFormNoRedirect(){if(null==window.frames.frameElement)var 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("undefined"!=typeof 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)var 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("undefined"!=typeof e){var t=e.form,n=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),o=jQuery(e).css("background"),i=jQuery(e).css("color"),a=jQuery(e).css("height"),r=e.getElementsByClassName("inbound-form-spinner");(0==n.length||"IA=="==n[0].value)&&(jQuery(r).remove(),jQuery(e).prepend('<div id="redir-check"><i class="fa fa-check-square" aria-hidden="true" style="background='+o+"; color="+i+"; font-size:calc("+a+' * .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(){},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/)&&(r=r.split("-"),a=r[1]),i="true"===_inbound.Utils.readCookie("inbound_debug")?!0:!1,o="true"===_inbound.Utils.readCookie("inbound_debug_"+e)?!0:!1,(o||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){var t=function(){function e(e,t,n,o){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("actions",e,t,n,o)),d}function t(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&u("actions",t,e),d}function n(e,t){return"string"==typeof e&&r("actions",e,t),d}function o(e,t,n){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("filters",e,t,n)),d}function i(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?u("filters",t,e):d}function a(e,t){return"string"==typeof e&&r("filters",e,t),d}function r(e,t,n,o){if(c[e][t])if(n){var i,a=c[e][t];if(o)for(i=a.length;i--;){var r=a[i];r.callback===n&&r.context===o&&a.splice(i,1)}else for(i=a.length;i--;)a[i].callback===n&&a.splice(i,1)}else c[e][t]=[]}function s(e,t,n,o,i){var a={callback:n,priority:o,context:i},r=c[e][t];r?(r.push(a),r=l(r)):r=[a],c[e][t]=r}function l(e){for(var t,n,o,i=1,a=e.length;a>i;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 u(e,t,n){var o=c[e][t];if(!o)return"filters"===e?n[0]:!1;var i=0,a=o.length;if("filters"===e)for(;a>i;i++)n[0]=o[i].callback.apply(o[i].context,n);else for(;a>i;i++)o[i].callback.apply(o[i].context,n);return"filters"===e?n[0]:!0}var d={removeFilter:a,applyFilters:i,addFilter:o,removeAction:n,doAction:t,addAction:e},c={actions:{},filters:{}};return d};return e.hooks=new t,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,("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/$/,"")),i={api_host:o,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(n){this.CustomEvent=function(e,t){function n(n,i){var a=document.createEvent(e);return null!==n?o.call(a,n,(i||(i=t)).bubbles,i.cancelable,i.detail):a.initCustomEvent=o,a}function o(t,n,o,i){this["init"+e](t,n,o,i),"detail"in this||(this.detail=i)}return n}(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(),t.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(var 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(){var 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="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof ls||"undefined"==typeof window.JSON?!1:!0}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}function n(t){return{name:t,size:e(localStorage[t])}}function o(e){return e.size=t(e.size).toFixed(2)+" MB",e}var i=Object.keys(localStorage).map(n).map(o);console.table(i)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=10>t?"0":"",o=e.getFullYear(),i=e.getHours(),a=10>i?"0":"",r=e.getMinutes(),s=10>r?"0":"",l=e.getSeconds(),u=10>l?"0":"",d=e.getMonth()+1,c=10>d?"0":"",m=o+"/"+c+d+"/"+n+t+" "+a+i+":"+s+r+":"+u+l;return m},SetSessionTimeout:function(){var e=(this.readCookie("lead_session_expire"),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;e>o;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){var n;if("classList"in document.documentElement)var 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(o){}return e},ajaxSendData:function(e,t,n,o){var i=this.ajaxPolyFill();setTimeout(function(){i.open(n,e,!0),i.onreadystatechange=function(){4==i.readyState&&t(i.responseText)},"POST"==n&&i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.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,o){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=i.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(o),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 setTimeout(d,50),void 0}u("poll")};if("complete"==i.readyState)t.call(e,"lazy");else{if(i.createEventObject&&a.doScroll){try{o=!e.frameElement}catch(c){}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,0>=u?(clearTimeout(a),a=null,r=l,i=e.apply(n,o)):a||(a=setTimeout(s,u)),i}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)}},e}(_inbound||{}),InboundForms=function(e){var t=!1,n=e.Utils,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()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,n){if(t&&console){var e=e||!1;e&&"string"==typeof e&&console.log(e),n&&n instanceof Function&&n()}},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=!1,n=window.document.forms[e];n.dataset.formProcessed||(n.dataset.formProcessed=!0,t=this.checkTrackStatus(n),t&&(this.attachFormSubmitEvent(n),this.initFormMapping(n)))}},checkTrackStatus:function(t){var n=t.getAttribute("class");return""!==n&&null!==n?n.toLowerCase().indexOf("wpl-track-me")>-1?!0:n.toLowerCase().indexOf("inbound-track")>-1?!0:(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1):void 0},loopClassSelectors:function(t,o){for(var i=t.length-1;i>=0;i--){var a=n.trim(t[i]);-1===a.indexOf("#")&&-1===a.indexOf(".")&&(a="#"+a),a=document.querySelector(a),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(t){var a=t.id||!1,r=t.name||!1,s=this.getInputLabel(t);if(s){var u=this.ignoreFieldByLabel(s[0].innerText);if(u)return t.dataset.ignoreFormField=!0,!1}for(i=0;i<l.length;i++){var d=!1,c=l[i],m=n.trim(c),f=m.replace(/ /g,"_");r&&r.toLowerCase().indexOf(m)>-1?(d=!0,e.deBugger("forms","Found matching name attribute for -> "+m)):a&&a.toLowerCase().indexOf(m)>-1?(d=!0,e.deBugger("forms","Found matching ID attribute for ->"+m)):s?s[0].innerText.toLowerCase().indexOf(m)>-1&&(d=!0,e.deBugger("forms","Found matching sibling label for -> "+m)):o.push(m),d&&(this.addDataAttr(t,f),this.removeArrayItem(l,m),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},attachFormSubmitEvent:function(e){n.addListener(e,"submit",this.formListener);document.querySelector(".inbound-email")},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):!1},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;("visa"==e.toLowerCase()||"mastercard"==e.toLowerCase()||"american express"==e.toLowerCase()||"amex"==e.toLowerCase()||"discover"==e.toLowerCase())&&(t=!0);var n=new RegExp("/^[0-9]+$/");if(n.test(e)){var o=e.replace(" ","");this.isInt(o)&&o.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",n.removeClass("wpl-track-me",e),n.removeListener(e,"submit",this.formListener);var t=e.getAttribute("class");return""!==t&&null!==t&&-1!=t.toLowerCase().indexOf("wpcf7-form")?(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),void 0)},saveFormData:function(t){for(var o=o||{},i=0;i<t.elements.length;i++)if(formInput=t.elements[i],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","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(l=this.getInputValue(formInput),l===!1)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){o[inputName].value||(o[inputName].value=[]),o[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",o);for(var u in o){var d=o[u].value,c=o[u].map;if("undefined"!=typeof d&&null!=d&&""!=d&&a.push(u+"="+o[u].value.join(",")),"undefined"!=typeof c&&null!=c&&o[u].value&&(r.push(c+"="+o[u].value.join(",")),"email"===u))var m=o[u].value.join(",")}var f=a.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=r.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g);var m=n.getParameterVal("email",g)||n.readCookie("wp_lead_email");m||(m=n.getParameterVal("wpleads_email_address",g));var p=n.getParameterVal("name",g),v=n.getParameterVal("first_name",g),h=n.getParameterVal("last_name",g);if(!h&&v){var _=decodeURI(v).split(" ");_.length>0&&(v=_[0],h=_[1])}if(p&&!h&&!v){var _=decodeURI(p).split(" ");_.length>0&&(v=_[0],h=_[1])}p=v&&h?v+" "+h:p,v||(v=""),h||(h=""),e.deBugger("forms","fName = "+v),e.deBugger("forms","lName = "+h),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{},w=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),k=!1;if(0==w.length||"IA=="==w[0].value)var k=!0;var S=t.querySelectorAll('input[value][type="hidden"][name="inbound_form_id"]');S=S.length>0?S[0].value:0;if("undefined"!=typeof landing_path_info)var C=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)var 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:v,last_name:h,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:n.readCookie("inbound_referral_site"),inbound_submitted:k,inbound_form_id:S,inbound_nonce:inbound_settings.ajax_nonce,event:t},callback=function(o){e.deBugger("forms","Lead Created with ID: "+o),o=parseInt(o,10),formData.leadID=o,o&&(n.createCookie("wp_lead_id",o),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(t)},e.trigger("form_before_submission",formData),n.ajaxPost(inbound_settings.admin_url,formData,callback)},rememberInputValues:function(t){var o=(t.name?"inbound_"+t.name:"",t.type?t.type:"text");return"submit"===o||"hidden"===o||"file"===o||"password"===o||t.dataset.ignoreFormField?!1:(n.addListener(t,"change",function(t){if(t.target.name){if("checkbox"!==o)var i=t.target.value;else for(var a=[],r=document.querySelectorAll('input[name="'+t.target.name+'"]'),s=0;s<r.length;s++){var l=r[s].checked;l&&a.push(r[s].value),i=a.join(",")}inputData={name:t.target.name,node:t.target.nodeName.toLowerCase(),type:o,value:i,mapping:t.target.dataset.mapFormField},e.trigger("form_input_change",inputData),n.createCookie("inbound_"+t.target.name,encodeURIComponent(i))}}),void 0)},fillInputValues:function(e){var t=e.name?"inbound_"+e.name:"",o=e.type?e.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o)return!1;if(n.readCookie(t)&&"comment"!=t)if(value=decodeURIComponent(n.readCookie(t)),"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:!1},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:!1},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&&(n.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(t){var o=document.querySelector(".email_suggestion");o&&n.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\">"+t.full+"</b></i>?</span>",e.parentNode.insertBefore(i,e.nextSibling);var a=document.getElementById("email_correction");n.addListener(a,"click",function(){e.value=a.innerHTML,a.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},"undefined"==typeof 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>i&&(a=i,r=t[s])}return o>=a&&null!==r?r:!1},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,r=5;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 s=0;r>s;s++){if(n+s<e.length&&e.charAt(n+s)==t.charAt(n)){o=s;break}if(n+s<t.length&&e.charAt(n)==t.charAt(n+s)){i=s;break}}}n++}return(e.length+t.length)/2-a},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(var n=0;n<t.length;n++)if(""===t[n])return!1;var o=t.pop(),i=o.split("."),a="";if(0===i.length)return!1;if(1==i.length)a=i[0];else{for(var n=1;n<i.length;n++)a+=i[n]+".";i.length>=2&&(a=a.substring(0,a.length-1))}return{topLevelDomain:a,domain:o,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||{},i.bubbles=i.bubbles||!0,i.cancelable=i.cancelable||!0,o=e.apply_filters("filter_"+t,o);!window.ActiveXObject&&"ActiveXObject"in window;if("function"==typeof CustomEvent)var a=new CustomEvent(t,{detail:o,bubbles:i.bubbles,cancelable:i.cancelable});else{var a=document.createEvent("Event");a.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(){var e={opt1:!0},n={data:"xyxy"};t("analytics_ready",n,e)},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){var n={clock:e,leadData:InboundLeadData};t("session_heartbeat",n)},page_visit:function(e){t("page_view",e)},page_first_visit:function(){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);var o=function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")};e.deBugger("pages",status,o)},tab_hidden:function(){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){var o=function(){console.log(n)};e.deBugger("forms","inputData change. Data=",o),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)},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,o="_inbound";if("localStorage"in window)try{n="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof n||"undefined"==typeof window.JSON?!1:!0,window.localStorage.setItem(o,"1"),window.localStorage.removeItem(o)}catch(i){t=!1}e.totalStorage=function(t,n){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"undefined"!=typeof t?this.setItem(e,t):this.getItem(e)},setItem:function(o,i){if(!t)try{return e.Utils.createCookie(o,i),i}catch(a){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 r=JSON.stringify(i);return n.setItem(o,r),this.parseResult(r)},getItem:function(o){if(!t)try{return this.parseResult(e.Utils.readCookie(o))}catch(i){return null}var a=n.getItem(o);return this.parseResult(a)},deleteItem:function(o){if(!t)try{return e.Utils.eraseCookie(o,null),!0}catch(i){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("="),l=s[0];o.push({key:l,value:this.parseResult(e.Utils.readCookie(l))})}}catch(u){return null}return o},parseResult:function(e){var t;try{t=JSON.parse(e),"undefined"==typeof t&&(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")),o=t.readCookie("lead_session_expire");o||(e.deBugger("leads","expired vistor. Run Processes"),n&&e.LeadsAPI.getAllLeadData())},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.totalStorage("inbound_lead_data"),o=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:t},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)},n?(e.LeadsAPI.setGlobalLeadData(n),e.deBugger("lead","Set Global Lead Data from Localstorage"),o||(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)
|
3 |
-
},getLeadLists:function(){var t=e.Utils.readCookie("wp_lead_id"),n={action:"wpl_check_lists",wp_lead_id:t},
|
1 |
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
|
2 |
+
function inboundFormNoRedirect(){if(null==window.frames.frameElement)var 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("undefined"!=typeof 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)var 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("undefined"!=typeof e){var t=e.form,n=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),a=jQuery(e).css("background"),i=jQuery(e).css("color"),o=jQuery(e).css("height"),r=e.getElementsByClassName("inbound-form-spinner");(0==n.length||"IA=="==n[0].value)&&(jQuery(r).remove(),jQuery(e).prepend('<div id="redir-check"><i class="fa fa-check-square" aria-hidden="true" style="background='+a+"; color="+i+"; font-size:calc("+o+' * .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,a={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a},debug:function(){},deBugger:function(e,t,n){if(console){var a,i,o,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(r=r.split("-"),o=r[1]),i="true"===_inbound.Utils.readCookie("inbound_debug")?!0:!1,a="true"===_inbound.Utils.readCookie("inbound_debug_"+e)?!0:!1,(a||s||i)&&(t&&"string"==typeof t&&(i||"all"===o?console.log('logAll "'+e+'" =>',t):a?console.log('log "'+e+'" =>',t):e===o&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},a=n.extend(t,e);return n.Settings=a||{},n}(_inboundOptions),_inboundHooks=function(e){var t=function(){function e(e,t,n,a){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("actions",e,t,n,a)),d}function t(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&u("actions",t,e),d}function n(e,t){return"string"==typeof e&&r("actions",e,t),d}function a(e,t,n){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("filters",e,t,n)),d}function i(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?u("filters",t,e):d}function o(e,t){return"string"==typeof e&&r("filters",e,t),d}function r(e,t,n,a){if(c[e][t])if(n){var i,o=c[e][t];if(a)for(i=o.length;i--;){var r=o[i];r.callback===n&&r.context===a&&o.splice(i,1)}else for(i=o.length;i--;)o[i].callback===n&&o.splice(i,1)}else c[e][t]=[]}function s(e,t,n,a,i){var o={callback:n,priority:a,context:i},r=c[e][t];r?(r.push(o),r=l(r)):r=[o],c[e][t]=r}function l(e){for(var t,n,a,i=1,o=e.length;o>i;i++){for(t=e[i],n=i;(a=e[n-1])&&a.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function u(e,t,n){var a=c[e][t];if(!a)return"filters"===e?n[0]:!1;var i=0,o=a.length;if("filters"===e)for(;o>i;i++)n[0]=a[i].callback.apply(a[i].context,n);else for(;o>i;i++)a[i].callback.apply(a[i].context,n);return"filters"===e?n[0]:!0}var d={removeFilter:o,applyFilters:i,addFilter:a,removeAction:n,doAction:t,addAction:e},c={actions:{},filters:{}};return d};return e.hooks=new t,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,a=(Object.prototype.toString,("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/$/,"")),i={api_host:a,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(n){this.CustomEvent=function(e,t){function n(n,i){var o=document.createEvent(e);return null!==n?a.call(o,n,(i||(i=t)).bubbles,i.cancelable,i.detail):o.initCustomEvent=a,o}function a(t,n,a,i){this["init"+e](t,n,a,i),"detail"in this||(this.detail=i)}return n}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),a=[];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(),t.style.removeAttribute("x-qsa"),a.push(t);return document._qsa=null,a}),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=[],a=0;a<t.rangeCount;a++)n[a]=t.getRangeAt(a);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(var a=0;a<n.length;a++)t.addRange(n[a]);return e})},createCookie:function(e,t,n){var a="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),a="; expires="+i.toGMTString()}document.cookie=e+"="+t+a+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),a=0;a<n.length;a++){for(var i=n[a];" "===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(";"),a=0;a<n.length;a++){var i=n[a].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," ")},a=window.location.search.substring(1),i=/([^&=]+)=?([^&]*)/g;e=i.exec(a);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var o=e[1].indexOf("["),r=e[1].slice(o+1,e[1].indexOf("]",o)),s=t(e[1].slice(0,o));"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 a in n)if("action"!=a)if("object"==typeof n[a])for(var i in n[a])this.createCookie(i,n[a][i],30);else this.createCookie(a,n[a],30);if(t){var o=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(o,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){var 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="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof ls||"undefined"==typeof window.JSON?!1:!0}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}function n(t){return{name:t,size:e(localStorage[t])}}function a(e){return e.size=t(e.size).toFixed(2)+" MB",e}var i=Object.keys(localStorage).map(n).map(a);console.table(i)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=10>t?"0":"",a=e.getFullYear(),i=e.getHours(),o=10>i?"0":"",r=e.getMinutes(),s=10>r?"0":"",l=e.getSeconds(),u=10>l?"0":"",d=e.getMonth()+1,c=10>d?"0":"",m=a+"/"+c+d+"/"+n+t+" "+o+i+":"+s+r+":"+u+l;return m},SetSessionTimeout:function(){var e=(this.readCookie("lead_session_expire"),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",a=e.Utils.readCookie("inbound_referral_site"),i=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),a||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 a=0;e>a;a++)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 a in e)n[a]=e[a];for(var a in t)n[a]=t[a];return n},hasClass:function(e,t){var n;if("classList"in document.documentElement)var 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(a){}return e},ajaxSendData:function(e,t,n,a){var i=this.ajaxPolyFill();setTimeout(function(){i.open(n,e,!0),i.onreadystatechange=function(){4==i.readyState&&t(i.responseText)},"POST"==n&&i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.send(a)},100)},ajaxGet:function(e,t,n,a){var i=[];for(var o in t)i.push(encodeURIComponent(o)+"="+encodeURIComponent(t[o]));this.ajaxSendData(e+"?"+i.join("&"),n,"GET",null,a)},ajaxPost:function(e,t,n,a){var i=[];for(var o in t)i.push(encodeURIComponent(o)+"="+encodeURIComponent(t[o]));this.ajaxSendData(e,n,"POST",i.join("&"),a)},sendEvent:function(e,t,a){t=t||{},async=!0;var o=getCookie();if(o){var r;for(r in o)t[r]=o[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=i.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(a),self},domReady:function(e,t){var n=!1,a=!0,i=e.document,o=i.documentElement,r=i.addEventListener?"addEventListener":"attachEvent",s=i.addEventListener?"removeEventListener":"detachEvent",l=i.addEventListener?"":"on",u=function(a){("readystatechange"!=a.type||"complete"==i.readyState)&&(("load"==a.type?e:i)[s](l+a.type,u,!1),!n&&(n=!0)&&t.call(e,a.type||a))},d=function(){try{o.doScroll("left")}catch(e){return setTimeout(d,50),void 0}u("poll")};if("complete"==i.readyState)t.call(e,"lazy");else{if(i.createEventObject&&o.doScroll){try{a=!e.frameElement}catch(c){}a&&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,a,i,o=null,r=0,s=function(){r=new Date,o=null,i=e.apply(n,a)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,a=arguments,0>=u?(clearTimeout(o),o=null,r=l,i=e.apply(n,a)):o||(o=setTimeout(s,u)),i}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)},cacheSearchData:function(n,a){if(t){var i=e.totalStorage.getItem("inbound_search_storage");if(i)i.unshift(n),e.totalStorage.setItem("inbound_search_storage",i);else{var o=[n];e.totalStorage.setItem("inbound_search_storage",o)}}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(a)},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"),a=this.readCookie("inbound_search_storage");if(n||a){if(a){a=a.split("SPLIT-TOKEN");for(var i in a)t.push(JSON.parse(a[i]))}n&&(t=t.concat(n)),t.sort(function(e,t){return e.timestamp-t.timestamp}),t=encodeURIComponent(JSON.stringify(t));var o={action:"inbound_search_store",data: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,o,callback)}}}},e}(_inbound||{}),InboundForms=function(e){var t=!1,n=e.Utils,a=[],o=[],r=[],s={},l=e.Settings,u=["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(){u=e.hooks.applyFilters("forms.field_map",u)},debug:function(e,n){if(t&&console){var e=e||!1;e&&"string"==typeof e&&console.log(e),n&&n instanceof Function&&n()}},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=!1,n=window.document.forms[e];n.dataset.formProcessed||(n.dataset.formProcessed=!0,t=this.checkTrackStatus(n),t&&(this.attachFormSubmitEvent(n),this.initFormMapping(n)))}},searchTrackInit:function(){if("off"!=inbound_settings.search_tracking&&!s.searchTrackInit){for(var e=0;e<window.document.forms.length;e++){var t=!1,a=window.document.forms[e];a.dataset.searchChecked||(a.dataset.searchChecked=!0,t=this.checkSearchTrackStatus(a),t&&this.attachSearchFormSubmitEvent(a))}n.storeSearchData(),s.searchTrackInit=!0}},checkTrackStatus:function(t){var n=t.getAttribute("class");return""!==n&&null!==n?n.toLowerCase().indexOf("wpl-track-me")>-1?!0:n.toLowerCase().indexOf("inbound-track")>-1?!0:(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1):void 0},checkSearchTrackStatus:function(t){var n=t.getAttribute("class"),a=t.getAttribute("id");return""!==n&&null!==n&&n.toLowerCase().indexOf("search")>-1?!0:""===a||null===a?(cb=function(){console.log(t)},e.deBugger("searches","This search form is not tracked. Please assign on in settings...",cb),!1):a.toLowerCase().indexOf("search")>-1?!0:void 0},loopClassSelectors:function(t,a){for(var i=t.length-1;i>=0;i--){var o=n.trim(t[i]);-1===o.indexOf("#")&&-1===o.indexOf(".")&&(o="#"+o),o=document.querySelector(o),o&&("add"===a?(e.Utils.addClass("wpl-track-me",o),e.Utils.addClass("inbound-track",o)):(e.Utils.removeClass("wpl-track-me",o),e.Utils.removeClass("inbound-track",o)))}},initFormMapping:function(t){for(var n=[],a=0;a<t.elements.length;a++)formInput=t.elements[a],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),l.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(t){var o=t.id||!1,r=t.name||!1,s=this.getInputLabel(t);if(s){var l=this.ignoreFieldByLabel(s[0].innerText);if(l)return t.dataset.ignoreFormField=!0,!1}for(i=0;i<u.length;i++){var d=!1,c=u[i],m=n.trim(c),f=m.replace(/ /g,"_");r&&r.toLowerCase().indexOf(m)>-1?(d=!0,e.deBugger("forms","Found matching name attribute for -> "+m)):o&&o.toLowerCase().indexOf(m)>-1?(d=!0,e.deBugger("forms","Found matching ID attribute for ->"+m)):s?s[0].innerText.toLowerCase().indexOf(m)>-1&&(d=!0,e.deBugger("forms","Found matching sibling label for -> "+m)):a.push(m),d&&(this.addDataAttr(t,f),this.removeArrayItem(u,m),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){n.addListener(e,"submit",this.formListener);document.querySelector(".inbound-email")},attachSearchFormSubmitEvent:function(e){n.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):!1},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;("visa"==e.toLowerCase()||"mastercard"==e.toLowerCase()||"american express"==e.toLowerCase()||"amex"==e.toLowerCase()||"discover"==e.toLowerCase())&&(t=!0);var n=new RegExp("/^[0-9]+$/");if(n.test(e)){var a=e.replace(" ","");this.isInt(a)&&a.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",n.removeClass("wpl-track-me",e),n.removeListener(e,"submit",this.formListener);var t=e.getAttribute("class");return""!==t&&null!==t&&-1!=t.toLowerCase().indexOf("wpcf7-form")?(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),void 0)},saveFormData:function(t){for(var a=a||{},i=0;i<t.elements.length;i++)if(formInput=t.elements[i],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),a[inputName]||(a[inputName]={}),formInput.type&&(a[inputName].type=formInput.type),a[inputName].name||(a[inputName].name=formInput.name),formInput.dataset.mapFormField&&(a[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(l=this.getInputValue(formInput),l===!1)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){a[inputName].value||(a[inputName].value=[]),a[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",a);for(var u in a){var d=a[u].value,c=a[u].map;if("undefined"!=typeof d&&null!=d&&""!=d&&o.push(u+"="+a[u].value.join(",")),"undefined"!=typeof c&&null!=c&&a[u].value&&(r.push(c+"="+a[u].value.join(",")),"email"===u))var m=a[u].value.join(",")}var f=o.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=r.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g);var m=n.getParameterVal("email",g)||n.readCookie("wp_lead_email");m||(m=n.getParameterVal("wpleads_email_address",g));var p=n.getParameterVal("name",g),h=n.getParameterVal("first_name",g),v=n.getParameterVal("last_name",g);if(!v&&h){var _=decodeURI(h).split(" ");_.length>0&&(h=_[0],v=_[1])}if(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=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),k=!1;if(0==w.length||"IA=="==w[0].value)var k=!0;var S=t.querySelectorAll('input[value][type="hidden"][name="inbound_form_id"]');S=S.length>0?S[0].value:0;if("undefined"!=typeof landing_path_info)var C=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)var 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:n.readCookie("inbound_referral_site"),inbound_submitted:k,inbound_form_id:S,inbound_nonce:inbound_settings.ajax_nonce,event:t},callback=function(a){e.deBugger("forms","Lead Created with ID: "+a),a=parseInt(a,10),formData.leadID=a,a&&(n.createCookie("wp_lead_id",a),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(t)},e.trigger("form_before_submission",formData),n.ajaxPost(inbound_settings.admin_url,formData,callback)},saveSearchData:function(t){for(var a=a||{},i=0;i<t.elements.length;i++)if(formInput=t.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"),a[inputName]||(a[inputName]={}),formInput.type&&(a[inputName].type=formInput.type),a[inputName].name||(a[inputName].name=formInput.name),formInput.dataset.mapFormField&&(a[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(r=this.getInputValue(formInput),r===!1)continue;break;case"TEXTAREA":r=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var o=0;o<formInput.length;o++)formInput[o].selected&&values.push(encodeURIComponent(formInput[o].value))}else r=formInput.value}if(e.deBugger("searches","Input Value = "+r),r){a[inputName].value||(a[inputName].value=[]),a[inputName].value.push(multiple?values.join(","):encodeURIComponent(r));var r=multiple?values.join(","):encodeURIComponent(r)}}e.deBugger("searches",a);var s=[];for(var l in a){var u=a[l].value,d=a[l].type;"undefined"!=typeof u&&null!=u&&""!=u&&"search"==d&&s.push("search_text|value|"+a[l].value)}if(s[0]){var c=s.join("|field|");if(e.deBugger("searches","Stringified Search Form PARAMS: "+c),"undefined"!=typeof landing_path_info)var m=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)var 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=n.readCookie("wp_lead_uid");email=inbound_settings.wp_lead_data.lead_email?inbound_settings.wp_lead_data.lead_email:n.readCookie("inbound_wpleads_email_address")?n.readCookie("inbound_wpleads_email_address"):"",searchData={email:email,search_data:c,user_UID:p,post_type:f,page_id:g,variation:m,source:n.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,n.cacheSearchData(searchData,t)):n.cacheSearchData(searchData,t)}},rememberInputValues:function(t){var a=(t.name?"inbound_"+t.name:"",t.type?t.type:"text");return"submit"===a||"hidden"===a||"file"===a||"password"===a||t.dataset.ignoreFormField?!1:(n.addListener(t,"change",function(t){if(t.target.name){if("checkbox"!==a)var i=t.target.value;else for(var o=[],r=document.querySelectorAll('input[name="'+t.target.name+'"]'),s=0;s<r.length;s++){var l=r[s].checked;l&&o.push(r[s].value),i=o.join(",")}inputData={name:t.target.name,node:t.target.nodeName.toLowerCase(),type:a,value:i,mapping:t.target.dataset.mapFormField},e.trigger("form_input_change",inputData),n.createCookie("inbound_"+t.target.name,encodeURIComponent(i))}}),void 0)},fillInputValues:function(e){var t=e.name?"inbound_"+e.name:"",a=e.type?e.type:"text";if("submit"===a||"hidden"===a||"file"===a||"password"===a)return!1;if(n.readCookie(t)&&"comment"!=t)if(value=decodeURIComponent(n.readCookie(t)),"checkbox"===a||"radio"===a)for(var i=value.split(","),o=0;o<i.length;o++)e.value.indexOf(i[o])>-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:!1},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),a=n.length-1;a>=0;a--)e.dataset.mapFormField||(n[a].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=[],a=t.length-1;a>=0;a--)"label"===t[a].nodeName.toLowerCase()&&n.push(t[a]);return n.length>0&&n.length<2?n:!1},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&&(n.addListener(e,"blur",this.mailCheck),d.run({email:document.querySelector(".inbound-email").value,suggested:function(t){var a=document.querySelector(".email_suggestion");a&&n.removeElement(a);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\">"+t.full+"</b></i>?</span>",e.parentNode.insertBefore(i,e.nextSibling);var o=document.getElementById("email_correction");n.addListener(o,"click",function(){e.value=o.innerHTML,o.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},"undefined"==typeof d)var d={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||d.defaultDomains,e.topLevelDomains=e.topLevelDomains||d.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||d.sift3Distance;var t=function(e){return e},n=e.suggested||t,a=e.empty||t,i=d.suggest(d.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return i?n(i):a()},suggest:function(e,t,n,a){e=e.toLowerCase();var i=this.splitEmail(e),o=this.findClosestDomain(i.domain,t,a,this.domainThreshold);if(o){if(o!=i.domain)return{address:i.address,domain:o,full:i.address+"@"+o}}else{var r=this.findClosestDomain(i.topLevelDomain,n,a,this.topLevelThreshold);if(i.domain&&r&&r!=i.topLevelDomain){var s=i.domain;return o=s.substring(0,s.lastIndexOf(i.topLevelDomain))+r,{address:i.address,domain:o,full:i.address+"@"+o}}}return!1},findClosestDomain:function(e,t,n,a){a=a||this.topLevelThreshold;var i,o=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]),o>i&&(o=i,r=t[s])}return a>=o&&null!==r?r:!1},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,a=0,i=0,o=0,r=5;n+a<e.length&&n+i<t.length;){if(e.charAt(n+a)==t.charAt(n+i))o++;else{a=0,i=0;for(var s=0;r>s;s++){if(n+s<e.length&&e.charAt(n+s)==t.charAt(n)){a=s;break}if(n+s<t.length&&e.charAt(n)==t.charAt(n+s)){i=s;break}}}n++}return(e.length+t.length)/2-o},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(var n=0;n<t.length;n++)if(""===t[n])return!1;var a=t.pop(),i=a.split("."),o="";if(0===i.length)return!1;if(1==i.length)o=i[0];else{for(var n=1;n<i.length;n++)o+=i[n]+".";i.length>=2&&(o=o.substring(0,o.length-1))}return{topLevelDomain:o,domain:a,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,a,i){var a=a||{};i=i||{},i.bubbles=i.bubbles||!0,i.cancelable=i.cancelable||!0,a=e.apply_filters("filter_"+t,a);!window.ActiveXObject&&"ActiveXObject"in window;if("function"==typeof CustomEvent)var o=new CustomEvent(t,{detail:a,bubbles:i.bubbles,cancelable:i.cancelable});else{var o=document.createEvent("Event");o.initEvent(t,!0,!0)}window.dispatchEvent(o),e.do_action(t,a),n(t,a)}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(){var e={opt1:!0},n={data:"xyxy"};t("analytics_ready",n,e)
|
3 |
+
},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){var n={clock:e,leadData:InboundLeadData};t("session_heartbeat",n)},page_visit:function(e){t("page_view",e)},page_first_visit:function(){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);var a=function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")};e.deBugger("pages",status,a)},tab_hidden:function(){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){var a=function(){console.log(n)};e.deBugger("forms","inputData change. Data=",a),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 a=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(a),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,a="_inbound";if("localStorage"in window)try{n="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof n||"undefined"==typeof window.JSON?!1:!0,window.localStorage.setItem(a,"1"),window.localStorage.removeItem(a)}catch(i){t=!1}e.totalStorage=function(t,n){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"undefined"!=typeof t?this.setItem(e,t):this.getItem(e)},setItem:function(a,i){if(!t)try{return e.Utils.createCookie(a,i),i}catch(o){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 r=JSON.stringify(i);return n.setItem(a,r),this.parseResult(r)},getItem:function(a){if(!t)try{return this.parseResult(e.Utils.readCookie(a))}catch(i){return null}var o=n.getItem(a);return this.parseResult(o)},deleteItem:function(a){if(!t)try{return e.Utils.eraseCookie(a,null),!0}catch(i){return!1}return n.removeItem(a),!0},getAll:function(){var a=[];if(t)for(var i in n)i.length&&a.push({key:i,value:this.parseResult(n.getItem(i))});else try{for(var o=document.cookie.split(";"),r=0;r<o.length;r++){var s=o[r].split("="),l=s[0];a.push({key:l,value:this.parseResult(e.Utils.readCookie(l))})}}catch(u){return null}return a},parseResult:function(e){var t;try{t=JSON.parse(e),"undefined"==typeof t&&(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")),a=t.readCookie("lead_session_expire");a||(e.deBugger("leads","expired vistor. Run Processes"),n&&e.LeadsAPI.getAllLeadData())},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.totalStorage("inbound_lead_data"),a=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:t},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var a=new Date;a.setTime(a.getTime()+18e5);var i=e.Utils.addDays(a,3);e.Utils.createCookie("lead_data_expire",!0,i)},n?(e.LeadsAPI.setGlobalLeadData(n),e.deBugger("lead","Set Global Lead Data from Localstorage"),a||(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=e.Utils.readCookie("wp_lead_id"),n={action:"wpl_check_lists",wp_lead_id:t},a=function(){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")};e.Utils.ajaxPost(inbound_settings.admin_url,n,a)}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,a=!1,i=!1,o=!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(a){return"page_views"!==f?!1:(this.CheckTimeOut(),a=a||{},t=parseInt(a.reportInterval,10)||10,n=parseInt(a.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(),void 0)},setIdle:function(t){var t=t||"No Movement",n="Session IDLE. Activity Timeout due to "+t;e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n,a;"undefined"!=typeof document.hidden?(t="hidden",a="visibilitychange",n="visibilityState"):"undefined"!=typeof document.mozHidden?(t="mozHidden",a="mozvisibilitychange",n="mozVisibilityState"):"undefined"!=typeof document.msHidden?(t="msHidden",a="msvisibilitychange",n="msVisibilityState"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",a="webkitvisibilitychange",n="webkitVisibilityState");var i=document[t];e.Utils.addListener(document,a,function(){i!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),i=document[t])})},clock:function(){r+=1;var n=r/60,a="Total time spent on Page in this Session: "+n.toFixed(2)+" min";if(e.deBugger("pages",a),r>0&&r%t===0){var i=new Date;i.setTime(i.getTime()+18e5),c.createCookie("lead_session",r,i),e.trigger("session_heartbeat",r)}},inactiveClock:function(){s+=1;var t=(1800-s)/60,n="Time until Session Timeout: "+t.toFixed(2)+" min";e.deBugger("pages",n),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(),o=!0},turnOn:function(){o=!1},startSession:function(){new Date;a=!0,l=setInterval(e.PageTracking.clock,1e3);var t=c.readCookie("lead_session");if(t)e.trigger("session_active");else{e.trigger("session_start");var n=new Date;n.setTime(n.getTime()+18e5),e.Utils.createCookie("lead_session",1,n)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){o||(a||e.PageTracking.startSession(),i&&e.PageTracking.restartClock(),clearTimeout(d),d=setTimeout(e.PageTracking.setIdle,1e3*n+100),"undefined"!=typeof t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){var t=e.Utils.checkLocalStorage();if(t){var n=localStorage.getItem(f),a=JSON.parse(n);return a}},isRevisit:function(e){var t=!1,e=e||{},n=e[p];return"undefined"!=typeof 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,a=this.isRevisit(g);if(a){var i=g[p].length-1,o=g[p][i],r=Math.abs(new Date(o).getTime()-new Date(m).getTime());n=r>h,n?(t="Timeout Happened. Page view fired",this.triggerPageView(a)):(time_left=.001*Math.abs(h-r),t=h/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(a);e.deBugger("pages",t)},storePageView:function(){("off"!=inbound_settings.page_tracking||"landing-page"==inbound_settings.post_type)&&jQuery(document).ready(function(){setTimeout(function(){var t=e.Utils.readCookie("wp_lead_id")?e.Utils.readCookie("wp_lead_id"):"",n=e.Utils.readCookie("wp_lead_uid")?e.Utils.readCookie("wp_lead_uid"):"",a=e.totalStorage("wp_cta_loaded"),i=e.totalStorage("wp_cta_impressions");e.totalStorage("wp_cta_impressions",{});var o={action:"inbound_track_lead",wp_lead_uid:n,wp_lead_id:t,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(i),cta_history:JSON.stringify(a),json:"0"},r=function(){};e.Utils.ajaxPost(inbound_settings.admin_url,o,r)},400)})}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
|
shared/classes/class.ajax.php
CHANGED
@@ -85,7 +85,7 @@ if (!class_exists('Inbound_Ajax')) {
|
|
85 |
}
|
86 |
|
87 |
/* record CTA impressions */
|
88 |
-
$cta_impressions = ( isset($_POST['
|
89 |
|
90 |
foreach ( $cta_impressions as $cta_id => $vid ) {
|
91 |
do_action('wp_cta_record_impression', (int) $cta_id, (int) $vid );
|
85 |
}
|
86 |
|
87 |
/* record CTA impressions */
|
88 |
+
$cta_impressions = ( isset($_POST['cta_impressions']) ) ? json_decode(stripslashes($_POST['cta_impressions']),true) : array();
|
89 |
|
90 |
foreach ( $cta_impressions as $cta_id => $vid ) {
|
91 |
do_action('wp_cta_record_impression', (int) $cta_id, (int) $vid );
|
shared/classes/class.confirm-double-optin.php
CHANGED
@@ -40,14 +40,13 @@ if(!class_exists('Inbound_Confirm_Double_Optin')){
|
|
40 |
$lead_lists = Inbound_Leads::get_lead_lists_as_array();
|
41 |
|
42 |
/* decode token */
|
43 |
-
$params =
|
44 |
-
|
45 |
|
46 |
if ( !isset( $params['lead_id'] ) ) {
|
47 |
return;
|
48 |
}
|
49 |
|
50 |
-
self::confirm_being_added_to_lists($params
|
51 |
}
|
52 |
|
53 |
|
@@ -98,8 +97,8 @@ if(!class_exists('Inbound_Confirm_Double_Optin')){
|
|
98 |
$params['list_ids'] = explode( ',' , $params['list_ids']);
|
99 |
}
|
100 |
$args = array_merge( $params , $_GET );
|
101 |
-
$token =
|
102 |
-
|
103 |
if(!defined('INBOUND_PRO_CURRENT_VERSION')){
|
104 |
$double_optin_page_id = get_option('list-double-optin-page-id', '');
|
105 |
}else{
|
@@ -117,28 +116,6 @@ if(!class_exists('Inbound_Confirm_Double_Optin')){
|
|
117 |
return add_query_arg( array( 'token'=>$token , 'inbound-action' => 'confirm' ) , $base_url );
|
118 |
}
|
119 |
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Encodes data into a confirm token
|
123 |
-
* @param ARRAY $params contains: lead_id (INT ), list_ids (MIXED), email_id (INT)
|
124 |
-
* @return INT $token
|
125 |
-
*/
|
126 |
-
public static function encode_confirm_token( $params ) {
|
127 |
-
unset($params['doing_wp_cron']);
|
128 |
-
$json = json_encode($params);
|
129 |
-
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
|
130 |
-
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
|
131 |
-
$encrypted_string =
|
132 |
-
base64_encode(
|
133 |
-
trim(
|
134 |
-
mcrypt_encrypt(
|
135 |
-
MCRYPT_RIJNDAEL_256, substr( SECURE_AUTH_KEY , 0 , 16 ) , $json, MCRYPT_MODE_ECB, $iv
|
136 |
-
)
|
137 |
-
)
|
138 |
-
);
|
139 |
-
$decode_test = self::decode_confirm_token($encrypted_string);
|
140 |
-
return str_replace(array('+', '/', '='), array('-', '_', '^'), $encrypted_string);
|
141 |
-
}
|
142 |
|
143 |
|
144 |
/**
|
40 |
$lead_lists = Inbound_Leads::get_lead_lists_as_array();
|
41 |
|
42 |
/* decode token */
|
43 |
+
$params = Inbound_API::get_args_from_token( sanitize_text_field($_GET['token'] ));
|
|
|
44 |
|
45 |
if ( !isset( $params['lead_id'] ) ) {
|
46 |
return;
|
47 |
}
|
48 |
|
49 |
+
self::confirm_being_added_to_lists($params);
|
50 |
}
|
51 |
|
52 |
|
97 |
$params['list_ids'] = explode( ',' , $params['list_ids']);
|
98 |
}
|
99 |
$args = array_merge( $params , $_GET );
|
100 |
+
$token = Inbound_API::analytics_get_tracking_code( $args );
|
101 |
+
|
102 |
if(!defined('INBOUND_PRO_CURRENT_VERSION')){
|
103 |
$double_optin_page_id = get_option('list-double-optin-page-id', '');
|
104 |
}else{
|
116 |
return add_query_arg( array( 'token'=>$token , 'inbound-action' => 'confirm' ) , $base_url );
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
/**
|
shared/classes/class.database-routines.php
CHANGED
@@ -47,6 +47,14 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
|
|
47 |
'callback' => array( __CLASS__ , 'alter_events_table_1_0_5')
|
48 |
);
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
/* alter automation queue table */
|
51 |
self::$routines['automation-queue-table-1'] = array(
|
52 |
'id' => 'automation-queue-table-1',
|
@@ -131,10 +139,14 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
|
|
131 |
$table_name = $wpdb->prefix . "inbound_page_views";
|
132 |
|
133 |
/* add ip field if does not exist */
|
134 |
-
|
135 |
-
$wpdb->
|
136 |
-
|
137 |
-
$
|
|
|
|
|
|
|
|
|
138 |
|
139 |
}
|
140 |
|
@@ -149,9 +161,19 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
|
|
149 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
150 |
$table_name = $wpdb->prefix . "inbound_events";
|
151 |
|
152 |
-
$wpdb->
|
153 |
-
|
154 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
}
|
157 |
|
@@ -166,9 +188,34 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
|
|
166 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
167 |
$table_name = $wpdb->prefix . "inbound_events";
|
168 |
|
169 |
-
$wpdb->
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
/**
|
@@ -202,8 +249,11 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
|
|
202 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
203 |
$table_name = $wpdb->prefix . "inbound_automation_queue";
|
204 |
|
205 |
-
$wpdb->
|
206 |
|
|
|
|
|
|
|
207 |
}
|
208 |
}
|
209 |
|
47 |
'callback' => array( __CLASS__ , 'alter_events_table_1_0_5')
|
48 |
);
|
49 |
|
50 |
+
/* alter events table */
|
51 |
+
self::$routines['events-table-3'] = array(
|
52 |
+
'id' => 'events-table-3',
|
53 |
+
'scope' => 'shared',
|
54 |
+
'introduced' => '1.0.8',
|
55 |
+
'callback' => array( __CLASS__ , 'alter_events_table_1_0_8')
|
56 |
+
);
|
57 |
+
|
58 |
/* alter automation queue table */
|
59 |
self::$routines['automation-queue-table-1'] = array(
|
60 |
'id' => 'automation-queue-table-1',
|
139 |
$table_name = $wpdb->prefix . "inbound_page_views";
|
140 |
|
141 |
/* add ip field if does not exist */
|
142 |
+
|
143 |
+
$col_check = $wpdb->get_row("SELECT * FROM " . $table_name);
|
144 |
+
|
145 |
+
if(!isset($col_check->ip)) {
|
146 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `ip` VARCHAR(45) NOT NULL");
|
147 |
+
} else {
|
148 |
+
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `ip` VARCHAR(45)" );
|
149 |
+
}
|
150 |
|
151 |
}
|
152 |
|
161 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
162 |
$table_name = $wpdb->prefix . "inbound_events";
|
163 |
|
164 |
+
$col_check = $wpdb->get_row("SELECT * FROM " . $table_name);
|
165 |
+
|
166 |
+
if(!isset($col_check->funnel)) {
|
167 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `funnel` text NOT NULL");
|
168 |
+
}
|
169 |
+
|
170 |
+
if(!isset($col_check->source)) {
|
171 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `source` text NOT NULL");
|
172 |
+
}
|
173 |
+
|
174 |
+
if(!isset($col_check->list_id)) {
|
175 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `list_id` mediumint(20) NOT NULL");
|
176 |
+
}
|
177 |
|
178 |
}
|
179 |
|
188 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
189 |
$table_name = $wpdb->prefix . "inbound_events";
|
190 |
|
191 |
+
$col_check = $wpdb->get_row("SELECT * FROM " . $table_name);
|
192 |
+
|
193 |
+
if(!isset($col_check->rule_id)) {
|
194 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `rule_id` mediumint(20) NOT NULL");
|
195 |
+
}
|
196 |
+
|
197 |
+
if(!isset($col_check->job_id)) {
|
198 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `job_id` mediumint(20) NOT NULL");
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
/**
|
204 |
+
* @migration-type: alter inbound_events table
|
205 |
+
* @mirgration: adds columns list_id funnel, and source to events table
|
206 |
+
*/
|
207 |
+
public static function alter_events_table_1_0_8() {
|
208 |
+
|
209 |
+
global $wpdb;
|
210 |
+
|
211 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
212 |
+
$table_name = $wpdb->prefix . "inbound_events";
|
213 |
+
|
214 |
+
$col_check = $wpdb->get_row("SELECT * FROM " . $table_name);
|
215 |
|
216 |
+
if(!isset($col_check->comment_id)) {
|
217 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `comment_id` mediumint(20) NOT NULL");
|
218 |
+
}
|
219 |
}
|
220 |
|
221 |
/**
|
249 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
250 |
$table_name = $wpdb->prefix . "inbound_automation_queue";
|
251 |
|
252 |
+
$col_check = $wpdb->get_row("SELECT * FROM " . $table_name);
|
253 |
|
254 |
+
if(!isset($col_check->lead_id)) {
|
255 |
+
$wpdb->get_results("ALTER TABLE {$table_name} ADD `lead_id` mediumint(20) NOT NULL");
|
256 |
+
}
|
257 |
}
|
258 |
}
|
259 |
|
shared/classes/class.events.php
CHANGED
@@ -49,6 +49,12 @@ class Inbound_Events {
|
|
49 |
global $wpdb;
|
50 |
|
51 |
$table_name = $wpdb->prefix . "inbound_events";
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
$charset_collate = '';
|
53 |
|
54 |
if ( ! empty( $wpdb->charset ) ) {
|
@@ -58,7 +64,7 @@ class Inbound_Events {
|
|
58 |
$charset_collate .= " COLLATE {$wpdb->collate}";
|
59 |
}
|
60 |
|
61 |
-
$sql = "CREATE TABLE
|
62 |
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
|
63 |
`event_name` varchar(255) NOT NULL,
|
64 |
`page_id` mediumint(20) NOT NULL,
|
@@ -70,6 +76,7 @@ class Inbound_Events {
|
|
70 |
`job_id` mediumint(20) NOT NULL,
|
71 |
`list_id` mediumint(20) NOT NULL,
|
72 |
`lead_id` mediumint(20) NOT NULL,
|
|
|
73 |
`lead_uid` varchar(255) NOT NULL,
|
74 |
`session_id` varchar(255) NOT NULL,
|
75 |
`event_details` text NOT NULL,
|
@@ -81,7 +88,7 @@ class Inbound_Events {
|
|
81 |
) $charset_collate;";
|
82 |
|
83 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
84 |
-
dbDelta( $sql );
|
85 |
|
86 |
}
|
87 |
|
@@ -217,7 +224,7 @@ class Inbound_Events {
|
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
-
* Stores inbound
|
221 |
* @param $args
|
222 |
*/
|
223 |
public static function store_list_add_event( $lead_id , $list_id ){
|
@@ -249,6 +256,30 @@ class Inbound_Events {
|
|
249 |
self::store_event($args);
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
/**
|
253 |
* Add event to inbound_events table
|
254 |
* @param $args
|
@@ -277,6 +308,7 @@ class Inbound_Events {
|
|
277 |
'lead_id' => ( isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : '' ),
|
278 |
'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
|
279 |
'session_id' => ( isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : session_id() ),
|
|
|
280 |
'event_name' => $args['event_name'],
|
281 |
'event_details' => '',
|
282 |
'datetime' => $wordpress_date_time,
|
@@ -351,6 +383,10 @@ class Inbound_Events {
|
|
351 |
case "Unknown column 'funnel' in 'field list'":
|
352 |
self::create_events_table();
|
353 |
break;
|
|
|
|
|
|
|
|
|
354 |
}
|
355 |
}
|
356 |
|
@@ -457,6 +493,7 @@ class Inbound_Events {
|
|
457 |
'lead_id' => ( isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : '' ),
|
458 |
'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
|
459 |
'session_id' => '',
|
|
|
460 |
'event_name' => $args['event_name'],
|
461 |
'event_details' => '',
|
462 |
//'datetime' => (isset($args['wordpress_date_time'],
|
@@ -933,6 +970,10 @@ class Inbound_Events {
|
|
933 |
if (isset($params['limit'])) {
|
934 |
$query .= ' LIMIT '.$params['limit'];;
|
935 |
}
|
|
|
|
|
|
|
|
|
936 |
|
937 |
$results = $wpdb->get_results( $query , ARRAY_A );
|
938 |
|
@@ -962,6 +1003,12 @@ class Inbound_Events {
|
|
962 |
case 'sparkpost_delivery':
|
963 |
return ($plural) ? __('SparkPost Deliveries' , 'inbound-pro') : __('SparkPost Delivery' , 'inbound-pro');
|
964 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
965 |
}
|
966 |
|
967 |
return apply_filters('inbound-events/event-label' , $event_name , $plural );
|
@@ -1410,7 +1457,43 @@ class Inbound_Events {
|
|
1410 |
/* return null if nothing there */
|
1411 |
return ($count) ? $count : 0;
|
1412 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1414 |
public static function isJson($string) {
|
1415 |
json_decode($string);
|
1416 |
return (json_last_error() == JSON_ERROR_NONE);
|
49 |
global $wpdb;
|
50 |
|
51 |
$table_name = $wpdb->prefix . "inbound_events";
|
52 |
+
|
53 |
+
/* if table already created then bail */
|
54 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
|
58 |
$charset_collate = '';
|
59 |
|
60 |
if ( ! empty( $wpdb->charset ) ) {
|
64 |
$charset_collate .= " COLLATE {$wpdb->collate}";
|
65 |
}
|
66 |
|
67 |
+
$sql = "CREATE TABLE $table_name (
|
68 |
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
|
69 |
`event_name` varchar(255) NOT NULL,
|
70 |
`page_id` mediumint(20) NOT NULL,
|
76 |
`job_id` mediumint(20) NOT NULL,
|
77 |
`list_id` mediumint(20) NOT NULL,
|
78 |
`lead_id` mediumint(20) NOT NULL,
|
79 |
+
`comment_id` mediumint(20) NOT NULL,
|
80 |
`lead_uid` varchar(255) NOT NULL,
|
81 |
`session_id` varchar(255) NOT NULL,
|
82 |
`event_details` text NOT NULL,
|
88 |
) $charset_collate;";
|
89 |
|
90 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
91 |
+
$results = dbDelta( $sql );
|
92 |
|
93 |
}
|
94 |
|
224 |
}
|
225 |
|
226 |
/**
|
227 |
+
* Stores inbound lead list addition event(s) into events table
|
228 |
* @param $args
|
229 |
*/
|
230 |
public static function store_list_add_event( $lead_id , $list_id ){
|
256 |
self::store_event($args);
|
257 |
}
|
258 |
|
259 |
+
/**
|
260 |
+
* Stores search made events into the events table
|
261 |
+
* @param $args
|
262 |
+
*/
|
263 |
+
public static function store_search_event( $args ){
|
264 |
+
global $wp_query;
|
265 |
+
|
266 |
+
$args['event_name'] = 'search_made';
|
267 |
+
|
268 |
+
self::store_event($args);
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Stores comment made events into the events table
|
273 |
+
* @param $args
|
274 |
+
*/
|
275 |
+
public static function store_comment_event( $args ){
|
276 |
+
global $wp_query;
|
277 |
+
|
278 |
+
$args['event_name'] = 'comment_made';
|
279 |
+
|
280 |
+
self::store_event($args);
|
281 |
+
}
|
282 |
+
|
283 |
/**
|
284 |
* Add event to inbound_events table
|
285 |
* @param $args
|
308 |
'lead_id' => ( isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : '' ),
|
309 |
'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
|
310 |
'session_id' => ( isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : session_id() ),
|
311 |
+
'comment_id' => '',
|
312 |
'event_name' => $args['event_name'],
|
313 |
'event_details' => '',
|
314 |
'datetime' => $wordpress_date_time,
|
383 |
case "Unknown column 'funnel' in 'field list'":
|
384 |
self::create_events_table();
|
385 |
break;
|
386 |
+
|
387 |
+
case "Unknown column 'comment_id' in 'field list'":
|
388 |
+
self::create_events_table();
|
389 |
+
break;
|
390 |
}
|
391 |
}
|
392 |
|
493 |
'lead_id' => ( isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : '' ),
|
494 |
'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
|
495 |
'session_id' => '',
|
496 |
+
'comment_id' => '',
|
497 |
'event_name' => $args['event_name'],
|
498 |
'event_details' => '',
|
499 |
//'datetime' => (isset($args['wordpress_date_time'],
|
970 |
if (isset($params['limit'])) {
|
971 |
$query .= ' LIMIT '.$params['limit'];;
|
972 |
}
|
973 |
+
|
974 |
+
if (isset($params['offset']) && $params['offset']) {
|
975 |
+
$query .= ' OFFSET '.$params['offset'].' ';
|
976 |
+
}
|
977 |
|
978 |
$results = $wpdb->get_results( $query , ARRAY_A );
|
979 |
|
1003 |
case 'sparkpost_delivery':
|
1004 |
return ($plural) ? __('SparkPost Deliveries' , 'inbound-pro') : __('SparkPost Delivery' , 'inbound-pro');
|
1005 |
break;
|
1006 |
+
case 'search_made':
|
1007 |
+
return ($plural) ? __('Searches Made' , 'inbound-pro') : __('Search Made' , 'inbound-pro');
|
1008 |
+
break;
|
1009 |
+
case 'comment_made':
|
1010 |
+
return ($plural) ? __('Comments Made' , 'inbound-pro') : __('Comment Made' , 'inbound-pro');
|
1011 |
+
break;
|
1012 |
}
|
1013 |
|
1014 |
return apply_filters('inbound-events/event-label' , $event_name , $plural );
|
1457 |
/* return null if nothing there */
|
1458 |
return ($count) ? $count : 0;
|
1459 |
}
|
1460 |
+
|
1461 |
+
/**
|
1462 |
+
* Checks to see if a comment has already been logged in the events table
|
1463 |
+
* @param $comment_id
|
1464 |
+
*/
|
1465 |
+
public static function comment_exists($comment_id){
|
1466 |
+
global $wpdb;
|
1467 |
+
|
1468 |
+
$table_name = $wpdb->prefix . "inbound_events";
|
1469 |
+
|
1470 |
+
$comment_row_id = $wpdb->get_var(
|
1471 |
+
$wpdb->prepare(
|
1472 |
+
"SELECT `id` FROM {$table_name} WHERE `comment_id` = %d",
|
1473 |
+
$comment_id
|
1474 |
+
)
|
1475 |
+
);
|
1476 |
+
|
1477 |
+
return $comment_row_id;
|
1478 |
+
}
|
1479 |
|
1480 |
+
/**
|
1481 |
+
* Removes a comment from the events database
|
1482 |
+
* @param $comment_id
|
1483 |
+
*/
|
1484 |
+
public static function remove_comment_event($comment_id){
|
1485 |
+
global $wpdb;
|
1486 |
+
|
1487 |
+
$table_name = $wpdb->prefix . "inbound_events";
|
1488 |
+
|
1489 |
+
$wpdb->query(
|
1490 |
+
$wpdb->prepare(
|
1491 |
+
"DELETE FROM {$table_name} WHERE `comment_id` = %d",
|
1492 |
+
$comment_id
|
1493 |
+
)
|
1494 |
+
);
|
1495 |
+
}
|
1496 |
+
|
1497 |
public static function isJson($string) {
|
1498 |
json_decode($string);
|
1499 |
return (json_last_error() == JSON_ERROR_NONE);
|
shared/classes/class.form.php
CHANGED
@@ -265,19 +265,19 @@ if (!class_exists('Inbound_Forms')) {
|
|
265 |
$years = self::get_date_selectons('years');
|
266 |
|
267 |
$form .= '<div class="dateSelector">';
|
268 |
-
$form .= ' <select id="formletMonth" name="' . $field_name . '[month]" >';
|
269 |
foreach ($months as $key => $value) {
|
270 |
($m == $key) ? $sel = 'selected="selected"' : $sel = '';
|
271 |
$form .= '<option value="' . $key . '" ' . $sel . '>' . $value . '</option>';
|
272 |
}
|
273 |
$form .= ' </select>';
|
274 |
-
$form .= ' <select id="formletDays" name="' . $field_name . '[day]" >';
|
275 |
foreach ($days as $key => $value) {
|
276 |
($d == $key) ? $sel = 'selected="selected"' : $sel = '';
|
277 |
$form .= '<option value="' . $key . '" ' . $sel . '>' . $value . '</option>';
|
278 |
}
|
279 |
$form .= ' </select>';
|
280 |
-
$form .= ' <select id="formletYears" name="' . $field_name . '[year]" >';
|
281 |
foreach ($years as $key => $value) {
|
282 |
($y == $key) ? $sel = 'selected="selected"' : $sel = '';
|
283 |
$form .= '<option value="' . $key . '" ' . $sel . '>' . $value . '</option>';
|
@@ -285,32 +285,43 @@ if (!class_exists('Inbound_Forms')) {
|
|
285 |
$form .= ' </select>';
|
286 |
$form .= '</div>';
|
287 |
$form .= '<script>
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
|
292 |
-
|
293 |
|
294 |
-
|
295 |
-
|
296 |
|
297 |
-
|
298 |
-
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
|
305 |
-
/* build new option set */
|
306 |
-
for (var i = 1; i <= days_in_month; i++) {
|
307 |
-
jQuery("#formletDays").append(jQuery("<option></option>").attr("value", i).text(i));
|
308 |
-
}
|
309 |
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
</script>';
|
315 |
|
316 |
} else if ($type === 'date') {
|
@@ -622,7 +633,6 @@ if (!class_exists('Inbound_Forms')) {
|
|
622 |
/* TODO remove this */
|
623 |
?>
|
624 |
<script type="text/javascript">
|
625 |
-
_inbound.add_action( 'form_before_submission', inbound_additional_checks, 9);
|
626 |
|
627 |
function inbound_additional_checks( data ) {
|
628 |
/* make sure event is defined */
|
@@ -631,17 +641,17 @@ if (!class_exists('Inbound_Forms')) {
|
|
631 |
event.target = data.event;
|
632 |
}
|
633 |
|
634 |
-
|
635 |
var checks = jQuery(event.target).find('.checkbox-required');
|
636 |
for(var a = 0; a < checks.length; a++){
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
}
|
643 |
|
644 |
-
|
645 |
if(!jQuery(this).prop("required")){
|
646 |
} else if (!jQuery(this).val()) {
|
647 |
alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro'); ?>");
|
@@ -697,6 +707,10 @@ if (!class_exists('Inbound_Forms')) {
|
|
697 |
|
698 |
/* Adding helpful listeners - may need to move all this into the analytics engine */
|
699 |
jQuery(document).ready(function($){
|
|
|
|
|
|
|
|
|
700 |
/* remove br tags */
|
701 |
jQuery("#inbound_form_submit br").remove();
|
702 |
|
265 |
$years = self::get_date_selectons('years');
|
266 |
|
267 |
$form .= '<div class="dateSelector">';
|
268 |
+
$form .= ' <select id="formletMonth" class="formletMonth" name="' . $field_name . '[month]" >';
|
269 |
foreach ($months as $key => $value) {
|
270 |
($m == $key) ? $sel = 'selected="selected"' : $sel = '';
|
271 |
$form .= '<option value="' . $key . '" ' . $sel . '>' . $value . '</option>';
|
272 |
}
|
273 |
$form .= ' </select>';
|
274 |
+
$form .= ' <select id="formletDays" class="formletDays" name="' . $field_name . '[day]" >';
|
275 |
foreach ($days as $key => $value) {
|
276 |
($d == $key) ? $sel = 'selected="selected"' : $sel = '';
|
277 |
$form .= '<option value="' . $key . '" ' . $sel . '>' . $value . '</option>';
|
278 |
}
|
279 |
$form .= ' </select>';
|
280 |
+
$form .= ' <select id="formletYears" class="formletYears" name="' . $field_name . '[year]" >';
|
281 |
foreach ($years as $key => $value) {
|
282 |
($y == $key) ? $sel = 'selected="selected"' : $sel = '';
|
283 |
$form .= '<option value="' . $key . '" ' . $sel . '>' . $value . '</option>';
|
285 |
$form .= ' </select>';
|
286 |
$form .= '</div>';
|
287 |
$form .= '<script>
|
288 |
+
if (typeof inbf_daysInMonth != "function") {
|
289 |
+
|
290 |
+
function inbf_minTwoDigits(n) {
|
291 |
+
return (n < 10 ? \'0\' : \'\') + n;
|
292 |
+
}
|
293 |
+
|
294 |
+
function inbf_daysInMonth(month,year) {
|
295 |
+
return new Date(year, month, 0).getDate();
|
296 |
+
}
|
297 |
|
298 |
+
jQuery("body").on("change", ".formletMonth, .formletYears" ,function() {
|
299 |
|
300 |
+
/* get current selected day */
|
301 |
+
var selected_date = jQuery(this).parent().find( "#formletDays" ).find(":selected").val();
|
302 |
|
303 |
+
/* remove day options */
|
304 |
+
jQuery(this).parent().find( "#formletDays" ).find("option").remove();
|
305 |
|
306 |
+
/* get more supportive variables */
|
307 |
+
var month = jQuery(this).parent().find("#formletMonth option:selected").val();
|
308 |
+
var year = jQuery(this).parent().find("#formletYears option:selected").val();
|
309 |
+
var days_in_month = inbf_daysInMonth(month,year);
|
310 |
|
|
|
|
|
|
|
|
|
311 |
|
312 |
+
/* build new option set */
|
313 |
+
for (var i = 1; i <= days_in_month; i++) {
|
314 |
+
jQuery(this).parent().find( ".formletDays" ).append(jQuery("<option></option>").attr("value", i).text(inbf_minTwoDigits(i)));
|
315 |
+
}
|
316 |
|
317 |
+
/* set date to original selection */
|
318 |
+
jQuery(this).parent().find(".formletDays option[value="+selected_date+"]").prop("selected", true)
|
319 |
+
});
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
/* trigger update to set day value correctly */
|
324 |
+
jQuery(".formletYears:last-child").trigger("change");
|
325 |
</script>';
|
326 |
|
327 |
} else if ($type === 'date') {
|
633 |
/* TODO remove this */
|
634 |
?>
|
635 |
<script type="text/javascript">
|
|
|
636 |
|
637 |
function inbound_additional_checks( data ) {
|
638 |
/* make sure event is defined */
|
641 |
event.target = data.event;
|
642 |
}
|
643 |
|
644 |
+
/*make sure all of this form's required checkboxes are checked*/
|
645 |
var checks = jQuery(event.target).find('.checkbox-required');
|
646 |
for(var a = 0; a < checks.length; a++){
|
647 |
+
if( checks[a] && jQuery(checks[a]).find('input[type=checkbox]:checked').length==0){
|
648 |
+
jQuery(jQuery(checks[a]).find('input')).focus();
|
649 |
+
alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro') ; ?> ");
|
650 |
+
throw new Error("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro') ; ?>");
|
651 |
+
}
|
652 |
}
|
653 |
|
654 |
+
jQuery(this).find("input").each(function(){
|
655 |
if(!jQuery(this).prop("required")){
|
656 |
} else if (!jQuery(this).val()) {
|
657 |
alert("<?php _e('Oops! Looks like you have not filled out all of the required fields!', 'inbound-pro'); ?>");
|
707 |
|
708 |
/* Adding helpful listeners - may need to move all this into the analytics engine */
|
709 |
jQuery(document).ready(function($){
|
710 |
+
|
711 |
+
/* add checkbox requirement checks */
|
712 |
+
_inbound.add_action( 'form_before_submission', inbound_additional_checks, 9);
|
713 |
+
|
714 |
/* remove br tags */
|
715 |
jQuery("#inbound_form_submit br").remove();
|
716 |
|
shared/classes/class.inbound-api.php
CHANGED
@@ -493,7 +493,7 @@ if (!class_exists('Inbound_API')) {
|
|
493 |
* @since 1.5.1
|
494 |
* @param array $args Arguments to override defaults
|
495 |
* @return array $dates
|
496 |
-
|
497 |
public static function get_dates( $args = array() ) {
|
498 |
$dates = array();
|
499 |
|
@@ -527,21 +527,21 @@ if (!class_exists('Inbound_API')) {
|
|
527 |
$dates['m_start'] = date( 'n', $current_time );
|
528 |
$dates['m_end'] = date( 'n', $current_time );
|
529 |
$dates['year'] = date( 'Y', $current_time );
|
530 |
-
|
531 |
|
532 |
case 'last_month' :
|
533 |
$dates['day'] = null;
|
534 |
$dates['m_start'] = date( 'n', $current_time ) == 1 ? 12 : date( 'n', $current_time ) - 1;
|
535 |
$dates['m_end'] = $dates['m_start'];
|
536 |
$dates['year'] = date( 'n', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
|
537 |
-
|
538 |
|
539 |
case 'today' :
|
540 |
$dates['day'] = date( 'd', $current_time );
|
541 |
$dates['m_start'] = date( 'n', $current_time );
|
542 |
$dates['m_end'] = date( 'n', $current_time );
|
543 |
$dates['year'] = date( 'Y', $current_time );
|
544 |
-
|
545 |
|
546 |
case 'yesterday' :
|
547 |
$month = date( 'n', $current_time ) == 1 && date( 'd', $current_time ) == 1 ? 12 : date( 'n', $current_time );
|
@@ -551,7 +551,7 @@ if (!class_exists('Inbound_API')) {
|
|
551 |
$dates['m_start'] = $month;
|
552 |
$dates['m_end'] = $month;
|
553 |
$dates['year'] = $month == 1 && date( 'd', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
|
554 |
-
|
555 |
|
556 |
case 'this_quarter' :
|
557 |
$month_now = date( 'n', $current_time );
|
@@ -583,7 +583,7 @@ if (!class_exists('Inbound_API')) {
|
|
583 |
$dates['year'] = date( 'Y', $current_time );
|
584 |
|
585 |
}
|
586 |
-
|
587 |
|
588 |
case 'last_quarter' :
|
589 |
$month_now = date( 'n', $current_time );
|
@@ -615,21 +615,21 @@ if (!class_exists('Inbound_API')) {
|
|
615 |
$dates['year'] = date( 'Y', $current_time );
|
616 |
|
617 |
}
|
618 |
-
|
619 |
|
620 |
case 'this_year' :
|
621 |
$dates['day'] = null;
|
622 |
$dates['m_start'] = null;
|
623 |
$dates['m_end'] = null;
|
624 |
$dates['year'] = date( 'Y', $current_time );
|
625 |
-
|
626 |
|
627 |
case 'last_year' :
|
628 |
$dates['day'] = null;
|
629 |
$dates['m_start'] = null;
|
630 |
$dates['m_end'] = null;
|
631 |
$dates['year'] = date( 'Y', $current_time ) - 1;
|
632 |
-
|
633 |
|
634 |
endswitch;
|
635 |
}
|
@@ -877,7 +877,7 @@ if (!class_exists('Inbound_API')) {
|
|
877 |
public static function prepare_lead_results( $results ) {
|
878 |
|
879 |
if ( !$results->have_posts() ) {
|
880 |
-
|
881 |
}
|
882 |
|
883 |
$leads = array();
|
@@ -1148,10 +1148,10 @@ if (!class_exists('Inbound_API')) {
|
|
1148 |
}
|
1149 |
|
1150 |
/**
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
public static function leads_get_id_from_email( $email ) {
|
1156 |
|
1157 |
self::validate_parameter( $email, 'email', 'string' );
|
@@ -1208,10 +1208,10 @@ if (!class_exists('Inbound_API')) {
|
|
1208 |
}
|
1209 |
|
1210 |
/**
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
public static function lists_update( $params = array() ) {
|
1216 |
|
1217 |
|
@@ -1252,8 +1252,8 @@ if (!class_exists('Inbound_API')) {
|
|
1252 |
}
|
1253 |
|
1254 |
/**
|
1255 |
-
|
1256 |
-
|
1257 |
public static function lists_delete( $params = array() ) {
|
1258 |
|
1259 |
|
@@ -1273,8 +1273,8 @@ if (!class_exists('Inbound_API')) {
|
|
1273 |
}
|
1274 |
|
1275 |
/**
|
1276 |
-
|
1277 |
-
|
1278 |
public static function fieldmap_get() {
|
1279 |
$lead_fields = Leads_Field_Map::build_map_array();
|
1280 |
array_shift($lead_fields);
|
@@ -1282,18 +1282,18 @@ if (!class_exists('Inbound_API')) {
|
|
1282 |
}
|
1283 |
|
1284 |
/**
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
public static function generate_token( $min = 7, $max = 11 ) {
|
1289 |
$length = mt_rand( $min, $max );
|
1290 |
return substr(str_shuffle("0123456789iloveinboundnow"), 0, $length);
|
1291 |
}
|
1292 |
|
1293 |
/**
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
public static function analytics_get_tracking_code( $args = array() ) {
|
1298 |
global $wpdb;
|
1299 |
|
@@ -1302,7 +1302,7 @@ if (!class_exists('Inbound_API')) {
|
|
1302 |
/* check args to see if token already exists */
|
1303 |
$results = $wpdb->get_results("SELECT * FROM $table_name WHERE args = '".serialize( $args )."' LIMIT 1", ARRAY_A );
|
1304 |
if ($results) {
|
1305 |
-
return
|
1306 |
}
|
1307 |
|
1308 |
$token = self::generate_token();
|
@@ -1316,12 +1316,12 @@ if (!class_exists('Inbound_API')) {
|
|
1316 |
);
|
1317 |
|
1318 |
/* return tracked link */
|
1319 |
-
return
|
1320 |
}
|
1321 |
|
1322 |
/**
|
1323 |
-
|
1324 |
-
|
1325 |
public static function analytics_track_links( $params = array() ) {
|
1326 |
|
1327 |
/* Merge POST & GET & @param vars into array variable */
|
@@ -1361,9 +1361,11 @@ if (!class_exists('Inbound_API')) {
|
|
1361 |
$args = array_merge( $args, $params['custom_data'] );
|
1362 |
}
|
1363 |
|
|
|
|
|
1364 |
|
1365 |
/* get tracked link */
|
1366 |
-
$tracked_link =
|
1367 |
|
1368 |
return array( 'url' => $tracked_link );
|
1369 |
}
|
493 |
* @since 1.5.1
|
494 |
* @param array $args Arguments to override defaults
|
495 |
* @return array $dates
|
496 |
+
*/
|
497 |
public static function get_dates( $args = array() ) {
|
498 |
$dates = array();
|
499 |
|
527 |
$dates['m_start'] = date( 'n', $current_time );
|
528 |
$dates['m_end'] = date( 'n', $current_time );
|
529 |
$dates['year'] = date( 'Y', $current_time );
|
530 |
+
break;
|
531 |
|
532 |
case 'last_month' :
|
533 |
$dates['day'] = null;
|
534 |
$dates['m_start'] = date( 'n', $current_time ) == 1 ? 12 : date( 'n', $current_time ) - 1;
|
535 |
$dates['m_end'] = $dates['m_start'];
|
536 |
$dates['year'] = date( 'n', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
|
537 |
+
break;
|
538 |
|
539 |
case 'today' :
|
540 |
$dates['day'] = date( 'd', $current_time );
|
541 |
$dates['m_start'] = date( 'n', $current_time );
|
542 |
$dates['m_end'] = date( 'n', $current_time );
|
543 |
$dates['year'] = date( 'Y', $current_time );
|
544 |
+
break;
|
545 |
|
546 |
case 'yesterday' :
|
547 |
$month = date( 'n', $current_time ) == 1 && date( 'd', $current_time ) == 1 ? 12 : date( 'n', $current_time );
|
551 |
$dates['m_start'] = $month;
|
552 |
$dates['m_end'] = $month;
|
553 |
$dates['year'] = $month == 1 && date( 'd', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
|
554 |
+
break;
|
555 |
|
556 |
case 'this_quarter' :
|
557 |
$month_now = date( 'n', $current_time );
|
583 |
$dates['year'] = date( 'Y', $current_time );
|
584 |
|
585 |
}
|
586 |
+
break;
|
587 |
|
588 |
case 'last_quarter' :
|
589 |
$month_now = date( 'n', $current_time );
|
615 |
$dates['year'] = date( 'Y', $current_time );
|
616 |
|
617 |
}
|
618 |
+
break;
|
619 |
|
620 |
case 'this_year' :
|
621 |
$dates['day'] = null;
|
622 |
$dates['m_start'] = null;
|
623 |
$dates['m_end'] = null;
|
624 |
$dates['year'] = date( 'Y', $current_time );
|
625 |
+
break;
|
626 |
|
627 |
case 'last_year' :
|
628 |
$dates['day'] = null;
|
629 |
$dates['m_start'] = null;
|
630 |
$dates['m_end'] = null;
|
631 |
$dates['year'] = date( 'Y', $current_time ) - 1;
|
632 |
+
break;
|
633 |
|
634 |
endswitch;
|
635 |
}
|
877 |
public static function prepare_lead_results( $results ) {
|
878 |
|
879 |
if ( !$results->have_posts() ) {
|
880 |
+
return null;
|
881 |
}
|
882 |
|
883 |
$leads = array();
|
1148 |
}
|
1149 |
|
1150 |
/**
|
1151 |
+
* Get lead ID from lead email address
|
1152 |
+
* @param STRING $email lead email address
|
1153 |
+
* @return INT $id
|
1154 |
+
*/
|
1155 |
public static function leads_get_id_from_email( $email ) {
|
1156 |
|
1157 |
self::validate_parameter( $email, 'email', 'string' );
|
1208 |
}
|
1209 |
|
1210 |
/**
|
1211 |
+
* Updates a list's data
|
1212 |
+
* @global OBJECT $Inbound_Leads class Inbound_Leads
|
1213 |
+
* @return ARRAY
|
1214 |
+
*/
|
1215 |
public static function lists_update( $params = array() ) {
|
1216 |
|
1217 |
|
1252 |
}
|
1253 |
|
1254 |
/**
|
1255 |
+
* Deletes a lead list
|
1256 |
+
*/
|
1257 |
public static function lists_delete( $params = array() ) {
|
1258 |
|
1259 |
|
1273 |
}
|
1274 |
|
1275 |
/**
|
1276 |
+
* Gets an array of mappable lead meta keys with their labels
|
1277 |
+
*/
|
1278 |
public static function fieldmap_get() {
|
1279 |
$lead_fields = Leads_Field_Map::build_map_array();
|
1280 |
array_shift($lead_fields);
|
1282 |
}
|
1283 |
|
1284 |
/**
|
1285 |
+
* Generates random token
|
1286 |
+
* @param length
|
1287 |
+
*/
|
1288 |
public static function generate_token( $min = 7, $max = 11 ) {
|
1289 |
$length = mt_rand( $min, $max );
|
1290 |
return substr(str_shuffle("0123456789iloveinboundnow"), 0, $length);
|
1291 |
}
|
1292 |
|
1293 |
/**
|
1294 |
+
* Stores tracked link data into wp_inbound_tracked_links table
|
1295 |
+
* @param ARRAY $args passed arguments
|
1296 |
+
*/
|
1297 |
public static function analytics_get_tracking_code( $args = array() ) {
|
1298 |
global $wpdb;
|
1299 |
|
1302 |
/* check args to see if token already exists */
|
1303 |
$results = $wpdb->get_results("SELECT * FROM $table_name WHERE args = '".serialize( $args )."' LIMIT 1", ARRAY_A );
|
1304 |
if ($results) {
|
1305 |
+
return $results[0]['token'];
|
1306 |
}
|
1307 |
|
1308 |
$token = self::generate_token();
|
1316 |
);
|
1317 |
|
1318 |
/* return tracked link */
|
1319 |
+
return $token;
|
1320 |
}
|
1321 |
|
1322 |
/**
|
1323 |
+
* Generate tracked link
|
1324 |
+
*/
|
1325 |
public static function analytics_track_links( $params = array() ) {
|
1326 |
|
1327 |
/* Merge POST & GET & @param vars into array variable */
|
1361 |
$args = array_merge( $args, $params['custom_data'] );
|
1362 |
}
|
1363 |
|
1364 |
+
/* get token args */
|
1365 |
+
$token = self::analytics_get_tracking_code( $args );
|
1366 |
|
1367 |
/* get tracked link */
|
1368 |
+
$tracked_link = get_site_url( get_current_blog_id(), self::$tracking_endpoint . '/' . $token );
|
1369 |
|
1370 |
return array( 'url' => $tracked_link );
|
1371 |
}
|
shared/classes/class.lead-storage.php
CHANGED
@@ -64,13 +64,10 @@ if (!class_exists('LeadStorage')) {
|
|
64 |
|
65 |
$lead['email'] = str_replace("%40", "@", self::check_val('email', $args));
|
66 |
$lead['email'] = str_replace("%2B", "+", $lead['email']);
|
67 |
-
$lead['name'] = str_replace("%20", " ", self::check_val('full_name', $args));
|
68 |
-
$lead['first_name'] = str_replace("%20", "", self::check_val('first_name', $args));
|
69 |
-
$lead['last_name'] = str_replace("%20", "", self::check_val('last_name', $args));
|
70 |
$lead['page_id'] = self::check_val('page_id', $args);
|
71 |
$lead['page_views'] = self::check_val('page_views', $args);
|
72 |
$lead['raw_params'] = self::check_val('raw_params', $args);
|
73 |
-
|
74 |
$lead['mapped_params'] = self::check_val('mapped_params', $args);
|
75 |
$lead['url_params'] = self::check_val('url_params', $args);
|
76 |
$lead['variation'] = self::check_val('variation', $args);
|
@@ -79,7 +76,6 @@ if (!class_exists('LeadStorage')) {
|
|
79 |
$lead['ip_address'] = self::lookup_ip_address();
|
80 |
|
81 |
|
82 |
-
|
83 |
if($lead['raw_params']){
|
84 |
parse_str($lead['raw_params'], $raw_params);
|
85 |
} else {
|
@@ -92,9 +88,11 @@ if (!class_exists('LeadStorage')) {
|
|
92 |
$mappedData = array();
|
93 |
}
|
94 |
|
|
|
95 |
$mappedData = self::improve_mapping($mappedData, $lead , $args);
|
96 |
$lead = array_merge($lead ,$mappedData);
|
97 |
|
|
|
98 |
/* prepate lead lists */
|
99 |
$lead['lead_lists'] = (isset($args['lead_lists'])) ? $args['lead_lists'] : null;
|
100 |
if ( !$lead['lead_lists'] && array_key_exists('inbound_form_lists', $mappedData) ) {
|
@@ -264,7 +262,6 @@ if (!class_exists('LeadStorage')) {
|
|
264 |
/* store raw form data */
|
265 |
self::store_raw_form_data($lead);
|
266 |
|
267 |
-
|
268 |
/* look for form_id and set it into main array */
|
269 |
if (isset($args['form_id'])) {
|
270 |
$lead['form_id'] = $args['form_id'];
|
@@ -274,9 +271,10 @@ if (!class_exists('LeadStorage')) {
|
|
274 |
}
|
275 |
|
276 |
/* look for an inbound_form_id and set it into main array */
|
277 |
-
if (isset($
|
278 |
-
$lead['
|
279 |
-
$lead['
|
|
|
280 |
}
|
281 |
|
282 |
|
@@ -613,44 +611,47 @@ if (!class_exists('LeadStorage')) {
|
|
613 |
*/
|
614 |
static function improve_lead_name( $lead ) {
|
615 |
/* */
|
616 |
-
$lead['
|
|
|
|
|
617 |
|
618 |
/* do not let names with 'false' pass */
|
619 |
-
if ( !empty($lead['
|
620 |
-
$lead['
|
621 |
}
|
622 |
-
|
623 |
-
|
|
|
624 |
}
|
625 |
|
626 |
/* if last name empty and full name present */
|
627 |
-
if ( empty($lead['
|
628 |
-
$parts = explode(' ', $lead['
|
629 |
|
630 |
/* Set first name */
|
631 |
-
$lead['
|
632 |
|
633 |
/* Set last name */
|
634 |
if (isset($parts[1])) {
|
635 |
-
$lead['
|
636 |
}
|
637 |
}
|
638 |
/* if last name empty and first name present */
|
639 |
-
else if (empty($lead['
|
640 |
-
$parts = explode(' ', $lead['
|
641 |
|
642 |
/* Set First Name */
|
643 |
-
$lead['
|
644 |
|
645 |
/* Set Last Name */
|
646 |
if (isset($parts[1])) {
|
647 |
-
$lead['
|
648 |
}
|
649 |
}
|
650 |
|
651 |
/* set full name */
|
652 |
-
if (!$lead['
|
653 |
-
$lead['
|
654 |
}
|
655 |
|
656 |
return $lead;
|
@@ -670,21 +671,7 @@ if (!class_exists('LeadStorage')) {
|
|
670 |
}
|
671 |
}
|
672 |
|
673 |
-
|
674 |
-
$newMap = array();
|
675 |
-
foreach ($mappedData as $key=>$value) {
|
676 |
-
$key = str_replace('wpleads_','',$key);
|
677 |
-
$newMap[$key] = $value;
|
678 |
-
}
|
679 |
-
|
680 |
-
/* Set names if not mapped */
|
681 |
-
$newMap['first_name'] = (!isset($newMap['first_name'])) ? $lead['first_name'] : $newMap['first_name'];
|
682 |
-
$newMap['last_name'] = (!isset($newMap['last_name'])) ? $lead['last_name'] : $newMap['last_name'];
|
683 |
-
|
684 |
-
/* improve mapped names */
|
685 |
-
$newMap = self::improve_lead_name( $newMap );
|
686 |
-
|
687 |
-
return $newMap;
|
688 |
}
|
689 |
|
690 |
/**
|
64 |
|
65 |
$lead['email'] = str_replace("%40", "@", self::check_val('email', $args));
|
66 |
$lead['email'] = str_replace("%2B", "+", $lead['email']);
|
|
|
|
|
|
|
67 |
$lead['page_id'] = self::check_val('page_id', $args);
|
68 |
$lead['page_views'] = self::check_val('page_views', $args);
|
69 |
$lead['raw_params'] = self::check_val('raw_params', $args);
|
70 |
+
$lead['inbound_form_id'] = self::check_val('inbound_form_id', $args);
|
71 |
$lead['mapped_params'] = self::check_val('mapped_params', $args);
|
72 |
$lead['url_params'] = self::check_val('url_params', $args);
|
73 |
$lead['variation'] = self::check_val('variation', $args);
|
76 |
$lead['ip_address'] = self::lookup_ip_address();
|
77 |
|
78 |
|
|
|
79 |
if($lead['raw_params']){
|
80 |
parse_str($lead['raw_params'], $raw_params);
|
81 |
} else {
|
88 |
$mappedData = array();
|
89 |
}
|
90 |
|
91 |
+
|
92 |
$mappedData = self::improve_mapping($mappedData, $lead , $args);
|
93 |
$lead = array_merge($lead ,$mappedData);
|
94 |
|
95 |
+
|
96 |
/* prepate lead lists */
|
97 |
$lead['lead_lists'] = (isset($args['lead_lists'])) ? $args['lead_lists'] : null;
|
98 |
if ( !$lead['lead_lists'] && array_key_exists('inbound_form_lists', $mappedData) ) {
|
262 |
/* store raw form data */
|
263 |
self::store_raw_form_data($lead);
|
264 |
|
|
|
265 |
/* look for form_id and set it into main array */
|
266 |
if (isset($args['form_id'])) {
|
267 |
$lead['form_id'] = $args['form_id'];
|
271 |
}
|
272 |
|
273 |
/* look for an inbound_form_id and set it into main array */
|
274 |
+
if (isset($args['inbound_form_id'])) {
|
275 |
+
$lead['inbound_form_id'] = $args['inbound_form_id'];
|
276 |
+
$lead['form_id'] = (isset($args['inbound_form_id'])) ? $args['inbound_form_id'] : 0;
|
277 |
+
$lead['form_name'] = (isset($args['inbound_form_n'])) ? $args['inbound_form_n'] : '';
|
278 |
}
|
279 |
|
280 |
|
611 |
*/
|
612 |
static function improve_lead_name( $lead ) {
|
613 |
/* */
|
614 |
+
$lead['wpleads_name'] = (isset($lead['wpleads_name'])) ? $lead['wpleads_name'] : '';
|
615 |
+
$lead['wpleads_first_name'] = (isset($lead['wpleads_first_name'])) ? $lead['wpleads_first_name'] : '';
|
616 |
+
$lead['wpleads_last_name'] = (isset($lead['wpleads_last_name'])) ? $lead['wpleads_last_name'] : '';
|
617 |
|
618 |
/* do not let names with 'false' pass */
|
619 |
+
if ( !empty($lead['wpleads_name']) && $lead['name'] == 'false' ) {
|
620 |
+
$lead['wpleads_name'] = '';
|
621 |
}
|
622 |
+
|
623 |
+
if ( !empty($lead['wpleads_first_name']) && $lead['wpleads_first_name'] == 'false' ) {
|
624 |
+
$lead['wpleads_first_name'] = '';
|
625 |
}
|
626 |
|
627 |
/* if last name empty and full name present */
|
628 |
+
if ( empty($lead['wpleads_last_name']) && $lead['wpleads_name'] ) {
|
629 |
+
$parts = explode(' ', $lead['wpleads_name']);
|
630 |
|
631 |
/* Set first name */
|
632 |
+
$lead['wpleads_first_name'] = trim($parts[0]);
|
633 |
|
634 |
/* Set last name */
|
635 |
if (isset($parts[1])) {
|
636 |
+
$lead['wpleads_last_name'] = trim($parts[1]);
|
637 |
}
|
638 |
}
|
639 |
/* if last name empty and first name present */
|
640 |
+
else if (empty($lead['wpleads_last_name']) && $lead['wpleads_first_name'] ) {
|
641 |
+
$parts = explode(' ', $lead['wpleads_first_name']);
|
642 |
|
643 |
/* Set First Name */
|
644 |
+
$lead['wpleads_first_name'] = trim($parts[0]);
|
645 |
|
646 |
/* Set Last Name */
|
647 |
if (isset($parts[1])) {
|
648 |
+
$lead['wpleads_last_name'] = trim($parts[1]);
|
649 |
}
|
650 |
}
|
651 |
|
652 |
/* set full name */
|
653 |
+
if (!$lead['wpleads_name'] && $lead['wpleads_first_name'] && $lead['wpleads_last_name'] ) {
|
654 |
+
$lead['wpleads_name'] = $lead['wpleads_first_name'] .' '. $lead['wpleads_last_name'];
|
655 |
}
|
656 |
|
657 |
return $lead;
|
671 |
}
|
672 |
}
|
673 |
|
674 |
+
return $mappedData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
}
|
676 |
|
677 |
/**
|
shared/classes/class.list-double-optin.php
CHANGED
@@ -181,7 +181,7 @@ if (!class_exists('Inbound_List_Double_Optin')) {
|
|
181 |
?>
|
182 |
<script>
|
183 |
jQuery(document).ready(function(){
|
184 |
-
jQuery('input#submit').on('click', function(){
|
185 |
var settingData = {};
|
186 |
var id = "<?php echo $list->term_id; ?>";
|
187 |
/*get the value of all inboundnow lead list options*/
|
@@ -350,11 +350,6 @@ if (!class_exists('Inbound_List_Double_Optin')) {
|
|
350 |
jQuery('.double-optin-enabled').css({'display': 'none'});
|
351 |
} else {
|
352 |
jQuery('.double-optin-enabled').css({'display': 'table-row'});
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
}
|
359 |
});
|
360 |
|
@@ -369,24 +364,11 @@ if (!class_exists('Inbound_List_Double_Optin')) {
|
|
369 |
}
|
370 |
});
|
371 |
|
372 |
-
/*if the email template to send has changed*/
|
373 |
-
jQuery('#double_optin_email_template').on('change', function () {
|
374 |
-
|
375 |
-
/* show default template settings */
|
376 |
-
if (jQuery('#double_optin_email_template').val() == 'default-email-template') {
|
377 |
-
jQuery('.default-email-setting').css({'display': 'table-row'});
|
378 |
-
} else {
|
379 |
-
jQuery('.default-email-setting').css({'display': 'none'});
|
380 |
-
}
|
381 |
-
});
|
382 |
-
|
383 |
/*trigger a refresh of the email inputs just after the page is loaded*/
|
384 |
setTimeout(function () {
|
385 |
-
jQuery('#double_optin_email_template').trigger('change');
|
386 |
jQuery('#double_optin_toggle').trigger('change');
|
387 |
-
|
388 |
-
|
389 |
-
}, 350);
|
390 |
|
391 |
});
|
392 |
</script>
|
181 |
?>
|
182 |
<script>
|
183 |
jQuery(document).ready(function(){
|
184 |
+
jQuery('input#submit, .edit-tag-actions .button').on('click', function(){
|
185 |
var settingData = {};
|
186 |
var id = "<?php echo $list->term_id; ?>";
|
187 |
/*get the value of all inboundnow lead list options*/
|
350 |
jQuery('.double-optin-enabled').css({'display': 'none'});
|
351 |
} else {
|
352 |
jQuery('.double-optin-enabled').css({'display': 'table-row'});
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
});
|
355 |
|
364 |
}
|
365 |
});
|
366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
/*trigger a refresh of the email inputs just after the page is loaded*/
|
368 |
setTimeout(function () {
|
|
|
369 |
jQuery('#double_optin_toggle').trigger('change');
|
370 |
+
jQuery('#double_optin_email_template').trigger('change');
|
371 |
+
}, 240);
|
|
|
372 |
|
373 |
});
|
374 |
</script>
|
shared/classes/class.load-assets.php
CHANGED
@@ -160,6 +160,7 @@ if (!class_exists('Inbound_Asset_Loader')) {
|
|
160 |
$lead_data_array['lead_id'] = ($lead_id) ? $lead_id : null;
|
161 |
$lead_data_array['lead_email'] = ($lead_email) ? $lead_email : null;
|
162 |
$lead_data_array['lead_uid'] = ($lead_uid) ? $lead_uid : null;
|
|
|
163 |
$time = current_time( 'timestamp', 0 ); /* Current wordpress time from settings */
|
164 |
$wordpress_date_time = date("Y/m/d G:i:s", $time);
|
165 |
|
160 |
$lead_data_array['lead_id'] = ($lead_id) ? $lead_id : null;
|
161 |
$lead_data_array['lead_email'] = ($lead_email) ? $lead_email : null;
|
162 |
$lead_data_array['lead_uid'] = ($lead_uid) ? $lead_uid : null;
|
163 |
+
$lead_data_array['lead_nonce'] = ($lead_id) ? wp_create_nonce('inbound_lead_' . $lead_id . '_nonce') : null;
|
164 |
$time = current_time( 'timestamp', 0 ); /* Current wordpress time from settings */
|
165 |
$wordpress_date_time = date("Y/m/d G:i:s", $time);
|
166 |
|
shared/classes/class.load-shared.php
CHANGED
@@ -37,7 +37,7 @@ if (!class_exists('Inbound_Load_Shared')) {
|
|
37 |
*/
|
38 |
public static function load_constants() {
|
39 |
define('INBOUNDNOW_SHARED', 'loaded' );
|
40 |
-
define('INBOUNDNOW_SHARED_DBRV', '1.0.
|
41 |
define('INBOUNDNOW_SHARED_PATH', self::get_shared_path() );
|
42 |
define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath() );
|
43 |
define('INBOUNDNOW_SHARED_FILE', self::get_shared_file() );
|
37 |
*/
|
38 |
public static function load_constants() {
|
39 |
define('INBOUNDNOW_SHARED', 'loaded' );
|
40 |
+
define('INBOUNDNOW_SHARED_DBRV', '1.0.8' );
|
41 |
define('INBOUNDNOW_SHARED_PATH', self::get_shared_path() );
|
42 |
define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath() );
|
43 |
define('INBOUNDNOW_SHARED_FILE', self::get_shared_file() );
|
shared/classes/class.post-type.wp-lead.php
CHANGED
@@ -98,6 +98,7 @@ if ( !class_exists('Inbound_Leads') ) {
|
|
98 |
$role->add_cap( 'edit_others_leads' );
|
99 |
$role->add_cap( 'edit_published_leads' );
|
100 |
$role->add_cap( 'publish_leads' );
|
|
|
101 |
$role->add_cap( 'delete_others_leads' );
|
102 |
$role->add_cap( 'delete_private_leads' );
|
103 |
$role->add_cap( 'delete_published_leads' );
|
98 |
$role->add_cap( 'edit_others_leads' );
|
99 |
$role->add_cap( 'edit_published_leads' );
|
100 |
$role->add_cap( 'publish_leads' );
|
101 |
+
$role->add_cap( 'delete_leads' );
|
102 |
$role->add_cap( 'delete_others_leads' );
|
103 |
$role->add_cap( 'delete_private_leads' );
|
104 |
$role->add_cap( 'delete_published_leads' );
|
shared/classes/class.shortcodes.cookie-values.php
CHANGED
@@ -22,6 +22,7 @@ if ( !class_exists( 'Inbound_Shortcodes_Cookies' ) ) {
|
|
22 |
*/
|
23 |
public static function get_cookie( $atts ) {
|
24 |
|
|
|
25 |
$value = ( isset($_COOKIE[ $atts['name'] ]) ) ? $_COOKIE[ $atts['name'] ] : '';
|
26 |
|
27 |
return $value;
|
22 |
*/
|
23 |
public static function get_cookie( $atts ) {
|
24 |
|
25 |
+
|
26 |
$value = ( isset($_COOKIE[ $atts['name'] ]) ) ? $_COOKIE[ $atts['name'] ] : '';
|
27 |
|
28 |
return $value;
|
shared/docs/shared/assets/js/frontend/analytics-src/analytics.events.md
ADDED
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
<!-- Start 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 |
+
Author: David Wells <david@inboundnow.com>
|
10 |
+
|
11 |
+
Version: 0.0.1
|
12 |
+
[in]: http://www.inboundnow.com/
|
13 |
+
|
14 |
+
# Event Usage
|
15 |
+
|
16 |
+
Events are triggered throughout the visitors path through the site.
|
17 |
+
You can hook into these custom actions and filters much like WordPress Core
|
18 |
+
|
19 |
+
See below for examples
|
20 |
+
|
21 |
+
Adding Custom Actions
|
22 |
+
------------------
|
23 |
+
You can hook into custom events throughout analytics. See the full list of available [events below](#all-events)
|
24 |
+
|
25 |
+
`
|
26 |
+
_inbound.add_action( 'action_name', callback, priority );
|
27 |
+
`
|
28 |
+
|
29 |
+
```js
|
30 |
+
// example:
|
31 |
+
|
32 |
+
// Add custom function to `page_visit` event
|
33 |
+
_inbound.add_action( 'page_visit', callback, 10 );
|
34 |
+
|
35 |
+
// add custom callback to trigger when `page_visit` fires
|
36 |
+
function callback(pageData){
|
37 |
+
var pageData = pageData || {};
|
38 |
+
// run callback on 'page_visit' trigger
|
39 |
+
alert(pageData.title);
|
40 |
+
}
|
41 |
+
```
|
42 |
+
|
43 |
+
### Params:
|
44 |
+
|
45 |
+
* **string** *action_name* Name of the event trigger
|
46 |
+
* **function** *callback* function to trigger when event happens
|
47 |
+
* **int** *priority* Order to trigger the event in
|
48 |
+
|
49 |
+
Removing Custom Actions
|
50 |
+
------------------
|
51 |
+
You can hook into custom events throughout analytics. See the full list of available [events below](#all-events)
|
52 |
+
|
53 |
+
`
|
54 |
+
_inbound.remove_action( 'action_name');
|
55 |
+
`
|
56 |
+
|
57 |
+
```js
|
58 |
+
// example:
|
59 |
+
|
60 |
+
_inbound.remove_action( 'page_visit');
|
61 |
+
// all 'page_visit' actions have been deregistered
|
62 |
+
```
|
63 |
+
|
64 |
+
### Params:
|
65 |
+
|
66 |
+
* **string** *action_name* Name of the event trigger
|
67 |
+
|
68 |
+
# Event List
|
69 |
+
|
70 |
+
Events are triggered throughout the visitors journey through the site
|
71 |
+
|
72 |
+
## analytics_ready()
|
73 |
+
|
74 |
+
Triggers when analyics has finished loading
|
75 |
+
|
76 |
+
## url_parameters()
|
77 |
+
|
78 |
+
Triggers when the browser url params are parsed. You can perform custom actions
|
79 |
+
if specific url params exist.
|
80 |
+
|
81 |
+
```js
|
82 |
+
// Usage:
|
83 |
+
|
84 |
+
// Add function to 'url_parameters' event
|
85 |
+
_inbound.add_action( 'url_parameters', url_parameters_func_example, 10);
|
86 |
+
|
87 |
+
function url_parameters_func_example(urlParams) {
|
88 |
+
var urlParams = urlParams || {};
|
89 |
+
for( var param in urlParams ) {
|
90 |
+
var key = param;
|
91 |
+
var value = urlParams[param];
|
92 |
+
}
|
93 |
+
// All URL Params
|
94 |
+
alert(JSON.stringify(urlParams));
|
95 |
+
|
96 |
+
// Check if URL parameter `utm_source` exists and matches value
|
97 |
+
if(urlParams.utm_source === "twitter") {
|
98 |
+
alert('This person is from twitter!');
|
99 |
+
}
|
100 |
+
}
|
101 |
+
```
|
102 |
+
|
103 |
+
## session_start()
|
104 |
+
|
105 |
+
Triggers when session starts
|
106 |
+
|
107 |
+
```js
|
108 |
+
// Usage:
|
109 |
+
|
110 |
+
// Add function to 'session_start' event
|
111 |
+
_inbound.add_action( 'session_start', session_start_func_example, 10);
|
112 |
+
|
113 |
+
function session_start_func_example(data) {
|
114 |
+
var data = data || {};
|
115 |
+
// session start. Do something for new visitor
|
116 |
+
}
|
117 |
+
```
|
118 |
+
|
119 |
+
## session_end()
|
120 |
+
|
121 |
+
Triggers when visitor session goes idle for more than 30 minutes.
|
122 |
+
|
123 |
+
```js
|
124 |
+
// Usage:
|
125 |
+
|
126 |
+
// Add function to 'session_end' event
|
127 |
+
_inbound.add_action( 'session_end', session_end_func_example, 10);
|
128 |
+
|
129 |
+
function session_end_func_example(data) {
|
130 |
+
var data = data || {};
|
131 |
+
// Do something when session ends
|
132 |
+
alert("Hey! It's been 30 minutes... where did you go?");
|
133 |
+
}
|
134 |
+
```
|
135 |
+
|
136 |
+
## session_active()
|
137 |
+
|
138 |
+
Triggers if active session is detected
|
139 |
+
|
140 |
+
```js
|
141 |
+
// Usage:
|
142 |
+
|
143 |
+
// Add function to 'session_active' event
|
144 |
+
_inbound.add_action( 'session_active', session_active_func_example, 10);
|
145 |
+
|
146 |
+
function session_active_func_example(data) {
|
147 |
+
var data = data || {};
|
148 |
+
// session active
|
149 |
+
}
|
150 |
+
```
|
151 |
+
|
152 |
+
## session_idle()
|
153 |
+
|
154 |
+
Triggers when visitor session goes idle. Idling occurs after 60 seconds of
|
155 |
+
inactivity or when the visitor switches browser tabs
|
156 |
+
|
157 |
+
```js
|
158 |
+
// Usage:
|
159 |
+
|
160 |
+
// Add function to 'session_idle' event
|
161 |
+
_inbound.add_action( 'session_idle', session_idle_func_example, 10);
|
162 |
+
|
163 |
+
function session_idle_func_example(data) {
|
164 |
+
var data = data || {};
|
165 |
+
// Do something when session idles
|
166 |
+
alert('Here is a special offer for you!');
|
167 |
+
}
|
168 |
+
```
|
169 |
+
|
170 |
+
## session_resume()
|
171 |
+
|
172 |
+
Triggers when session is already active and gets resumed
|
173 |
+
|
174 |
+
```js
|
175 |
+
// Usage:
|
176 |
+
|
177 |
+
// Add function to 'session_resume' event
|
178 |
+
_inbound.add_action( 'session_resume', session_resume_func_example, 10);
|
179 |
+
|
180 |
+
function session_resume_func_example(data) {
|
181 |
+
var data = data || {};
|
182 |
+
// Session exists and is being resumed
|
183 |
+
}
|
184 |
+
```
|
185 |
+
|
186 |
+
## session_heartbeat()
|
187 |
+
|
188 |
+
Session emitter. Runs every 10 seconds. This is a useful function for
|
189 |
+
pinging third party services
|
190 |
+
|
191 |
+
```js
|
192 |
+
// Usage:
|
193 |
+
|
194 |
+
// Add session_heartbeat_func_example function to 'session_heartbeat' event
|
195 |
+
_inbound.add_action( 'session_heartbeat', session_heartbeat_func_example, 10);
|
196 |
+
|
197 |
+
function session_heartbeat_func_example(data) {
|
198 |
+
var data = data || {};
|
199 |
+
// Do something with every 10 seconds
|
200 |
+
}
|
201 |
+
```
|
202 |
+
|
203 |
+
## page_visit()
|
204 |
+
|
205 |
+
Triggers Every Page View
|
206 |
+
|
207 |
+
```js
|
208 |
+
// Usage:
|
209 |
+
|
210 |
+
// Add function to 'page_visit' event
|
211 |
+
_inbound.add_action( 'page_visit', page_visit_func_example, 10);
|
212 |
+
|
213 |
+
function session_idle_func_example(pageData) {
|
214 |
+
var pageData = pageData || {};
|
215 |
+
if( pageData.view_count > 8 ){
|
216 |
+
alert('Wow you have been to this page more than 8 times.');
|
217 |
+
}
|
218 |
+
}
|
219 |
+
```
|
220 |
+
|
221 |
+
## page_first_visit()
|
222 |
+
|
223 |
+
Triggers If the visitor has never seen the page before
|
224 |
+
|
225 |
+
```js
|
226 |
+
// Usage:
|
227 |
+
|
228 |
+
// Add function to 'page_first_visit' event
|
229 |
+
_inbound.add_action( 'page_first_visit', page_first_visit_func_example, 10);
|
230 |
+
|
231 |
+
function page_first_visit_func_example(pageData) {
|
232 |
+
var pageData = pageData || {};
|
233 |
+
alert('Welcome to this page! Its the first time you have seen it')
|
234 |
+
}
|
235 |
+
```
|
236 |
+
|
237 |
+
## page_revisit()
|
238 |
+
|
239 |
+
Triggers If the visitor has seen the page before
|
240 |
+
|
241 |
+
```js
|
242 |
+
// Usage:
|
243 |
+
|
244 |
+
// Add function to 'page_revisit' event
|
245 |
+
_inbound.add_action( 'page_revisit', page_revisit_func_example, 10);
|
246 |
+
|
247 |
+
function page_revisit_func_example(pageData) {
|
248 |
+
var pageData = pageData || {};
|
249 |
+
alert('Welcome back to this page!');
|
250 |
+
// Show visitor special content/offer
|
251 |
+
}
|
252 |
+
```
|
253 |
+
|
254 |
+
## tab_hidden()
|
255 |
+
|
256 |
+
`tab_hidden` is triggered when the visitor switches browser tabs
|
257 |
+
|
258 |
+
```js
|
259 |
+
// Usage:
|
260 |
+
|
261 |
+
// Adding the callback
|
262 |
+
function tab_hidden_function( data ) {
|
263 |
+
alert('The Tab is Hidden');
|
264 |
+
};
|
265 |
+
|
266 |
+
// Hook the function up the the `tab_hidden` event
|
267 |
+
_inbound.add_action( 'tab_hidden', tab_hidden_function, 10 );
|
268 |
+
```
|
269 |
+
|
270 |
+
## tab_visible()
|
271 |
+
|
272 |
+
`tab_visible` is triggered when the visitor switches back to the sites tab
|
273 |
+
|
274 |
+
```js
|
275 |
+
// Usage:
|
276 |
+
|
277 |
+
// Adding the callback
|
278 |
+
function tab_visible_function( data ) {
|
279 |
+
alert('Welcome back to this tab!');
|
280 |
+
// trigger popup or offer special discount etc.
|
281 |
+
};
|
282 |
+
|
283 |
+
// Hook the function up the the `tab_visible` event
|
284 |
+
_inbound.add_action( 'tab_visible', tab_visible_function, 10 );
|
285 |
+
```
|
286 |
+
|
287 |
+
## tab_mouseout()
|
288 |
+
|
289 |
+
`tab_mouseout` is triggered when the visitor mouses out of the browser window.
|
290 |
+
This is especially useful for exit popups
|
291 |
+
|
292 |
+
```js
|
293 |
+
// Usage:
|
294 |
+
|
295 |
+
// Adding the callback
|
296 |
+
function tab_mouseout_function( data ) {
|
297 |
+
alert("Wait don't Go");
|
298 |
+
// trigger popup or offer special discount etc.
|
299 |
+
};
|
300 |
+
|
301 |
+
// Hook the function up the the `tab_mouseout` event
|
302 |
+
_inbound.add_action( 'tab_mouseout', tab_mouseout_function, 10 );
|
303 |
+
```
|
304 |
+
|
305 |
+
## form_input_change()
|
306 |
+
|
307 |
+
`form_input_change` is triggered when tracked form inputs change
|
308 |
+
You can use this to add additional validation or set conditional triggers
|
309 |
+
|
310 |
+
```js
|
311 |
+
// Usage:
|
312 |
+
|
313 |
+
```
|
314 |
+
|
315 |
+
## form_before_submission()
|
316 |
+
|
317 |
+
`form_before_submission` is triggered before the form is submitted to the server.
|
318 |
+
You can filter the data here or send it to third party services
|
319 |
+
|
320 |
+
```js
|
321 |
+
// Usage:
|
322 |
+
|
323 |
+
// Adding the callback
|
324 |
+
function form_before_submission_function( data ) {
|
325 |
+
var data = data || {};
|
326 |
+
// filter form data
|
327 |
+
};
|
328 |
+
|
329 |
+
// Hook the function up the the `form_before_submission` event
|
330 |
+
_inbound.add_action( 'form_before_submission', form_before_submission_function, 10 );
|
331 |
+
```
|
332 |
+
|
333 |
+
## form_after_submission()
|
334 |
+
|
335 |
+
`form_after_submission` is triggered after the form is submitted to the server.
|
336 |
+
You can filter the data here or send it to third party services
|
337 |
+
|
338 |
+
```js
|
339 |
+
// Usage:
|
340 |
+
|
341 |
+
// Adding the callback
|
342 |
+
function form_after_submission_function( data ) {
|
343 |
+
var data = data || {};
|
344 |
+
// filter form data
|
345 |
+
};
|
346 |
+
|
347 |
+
// Hook the function up the the `form_after_submission` event
|
348 |
+
_inbound.add_action( 'form_after_submission', form_after_submission_function, 10 );
|
349 |
+
```
|
350 |
+
|
351 |
+
## search_before_caching()
|
352 |
+
|
353 |
+
`search_before_caching` is triggered before the search is stored in the user's browser.
|
354 |
+
If a lead ID is set, the search data will be saved to the server when the next page loads.
|
355 |
+
You can filter the data here or send it to third party services
|
356 |
+
|
357 |
+
```js
|
358 |
+
// Usage:
|
359 |
+
|
360 |
+
// Adding the callback
|
361 |
+
function search_before_caching_function( data ) {
|
362 |
+
var data = data || {};
|
363 |
+
// filter search data
|
364 |
+
};
|
365 |
+
|
366 |
+
// Hook the function up the the `search_before_caching` event
|
367 |
+
_inbound.add_action( 'search_before_caching', search_before_caching_function, 10 );
|
368 |
+
```
|
369 |
+
|
370 |
+
button == the button that was clicked, form == the form that button belongs to, formRedirectUrl == the link that the form redirects to, if set
|
371 |
+
|
372 |
+
Get the button...
|
373 |
+
|
374 |
+
## if()
|
375 |
+
|
376 |
+
If not an iframe
|
377 |
+
|
378 |
+
If it is an iframe
|
379 |
+
|
380 |
+
## if()
|
381 |
+
|
382 |
+
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
|
383 |
+
|
384 |
+
## if()
|
385 |
+
|
386 |
+
If not an iframe
|
387 |
+
|
388 |
+
If it is an iframe
|
389 |
+
|
390 |
+
<!-- End shared\assets\js\frontend\analytics-src\analytics.events.js -->
|
391 |
+
|
shared/shortcodes/inbound-shortcodes.php
CHANGED
@@ -71,14 +71,17 @@ class Inbound_Shortcodes {
|
|
71 |
wp_enqueue_script('inbound-shortcodes', INBOUNDNOW_SHARED_URLPATH . 'shortcodes/js/shortcodes.js', array( 'jquery', 'jquery-cookie' ), '1', true);
|
72 |
$form_id = (isset($_GET['post']) && is_int( $_GET['post'] )) ? $_GET['post'] : '';
|
73 |
wp_localize_script( 'inbound-shortcodes', 'inbound_shortcodes', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) , 'adminurl' => admin_url(), 'inbound_shortcode_nonce' => wp_create_nonce('inbound-shortcode-nonce') , 'form_id' => $form_id ) );
|
74 |
-
if ( !wp_script_is( 'select2', 'registered' ) ) {
|
|
|
75 |
wp_dequeue_script('selectjs');
|
76 |
wp_dequeue_script('select2');
|
77 |
wp_dequeue_script('jquery-select2');
|
78 |
-
|
|
|
|
|
79 |
wp_enqueue_style('select2', INBOUNDNOW_SHARED_URLPATH . 'assets/includes/Select2/select2.min.css' , array() , false , false);
|
80 |
|
81 |
-
}
|
82 |
}
|
83 |
|
84 |
// Forms CPT only
|
71 |
wp_enqueue_script('inbound-shortcodes', INBOUNDNOW_SHARED_URLPATH . 'shortcodes/js/shortcodes.js', array( 'jquery', 'jquery-cookie' ), '1', true);
|
72 |
$form_id = (isset($_GET['post']) && is_int( $_GET['post'] )) ? $_GET['post'] : '';
|
73 |
wp_localize_script( 'inbound-shortcodes', 'inbound_shortcodes', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) , 'adminurl' => admin_url(), 'inbound_shortcode_nonce' => wp_create_nonce('inbound-shortcode-nonce') , 'form_id' => $form_id ) );
|
74 |
+
//if ( !wp_script_is( 'select2', 'registered' ) ) {
|
75 |
+
wp_deregister_script('select2');
|
76 |
wp_dequeue_script('selectjs');
|
77 |
wp_dequeue_script('select2');
|
78 |
wp_dequeue_script('jquery-select2');
|
79 |
+
wp_register_script('select2', INBOUNDNOW_SHARED_URLPATH . 'assets/includes/Select2/select2.full.min.js', array( 'jquery' ) , false , false );
|
80 |
+
wp_enqueue_script('select2' );
|
81 |
+
wp_dequeue_style('select2');
|
82 |
wp_enqueue_style('select2', INBOUNDNOW_SHARED_URLPATH . 'assets/includes/Select2/select2.min.css' , array() , false , false);
|
83 |
|
84 |
+
//}
|
85 |
}
|
86 |
|
87 |
// Forms CPT only
|
shared/shortcodes/js/shortcodes.js
CHANGED
@@ -97,6 +97,9 @@ var InboundShortcodes = {
|
|
97 |
row_output = row_output.replace(re, val);
|
98 |
}
|
99 |
else {
|
|
|
|
|
|
|
100 |
row_output = row_output.replace(re, input.val().replace(/"/g, "'"));
|
101 |
}
|
102 |
//console.log(newoutput);
|
97 |
row_output = row_output.replace(re, val);
|
98 |
}
|
99 |
else {
|
100 |
+
if (input.val() == null ) {
|
101 |
+
input.val('');
|
102 |
+
}
|
103 |
row_output = row_output.replace(re, input.val().replace(/"/g, "'"));
|
104 |
}
|
105 |
//console.log(newoutput);
|