WordPress Landing Pages - Version 2.6.2

Version Description

  • Improving support for conversion recording through tracked links. There are still some issues with link based conversion tracking and non-default templates. See support for assistance.
Download this release

Release Info

Developer adbox
Plugin Icon 128x128 WordPress Landing Pages
Version 2.6.2
Comparing to
See all releases

Code changes from version 2.6.1 to 2.6.2

classes/class.landing-pages.php CHANGED
@@ -311,6 +311,17 @@ class Landing_Pages_Template_Switcher {
311
return $args;
312
}
313
314
/**
315
* Remove all base css from the current active wordpress theme in landing pages
316
* currently removes all css from wp_head and re-enqueues the admin bar css.
311
return $args;
312
}
313
314
+ /**
315
+ * Utility method for loading popular 3rd party assets into Landing Page
316
+ */
317
+ public static function load_misc_plugin_support() {
318
+ /* WP Featherlight */
319
+ if (class_exists('WP_Featherlight_Scripts')) {
320
+ $wpfl = new WP_Featherlight_Scripts(plugin_dir_url( 'wp-featherlight' ) , '');
321
+ $wpfl->load_css();
322
+ }
323
+ }
324
+
325
/**
326
* Remove all base css from the current active wordpress theme in landing pages
327
* currently removes all css from wp_head and re-enqueues the admin bar css.
classes/class.metaboxes.php CHANGED
@@ -805,6 +805,7 @@ href='?post=<?php echo $post->ID; ?>&action=edit&action-variation-id=<?php echo
805
806
$cats = explode(',', $data['info']['category']);
807
foreach ($cats as $key => $cat) {
808
$cat = ($cat) ? trim($cat) : '';
809
$cat = str_replace(' ', '-', $cat);
810
$cats[$key] = trim(strtolower($cat));
805
806
$cats = explode(',', $data['info']['category']);
807
foreach ($cats as $key => $cat) {
808
+ $cat = (is_array($cat)) ? implode(',',$cat) : $cat;
809
$cat = ($cat) ? trim($cat) : '';
810
$cat = str_replace(' ', '-', $cat);
811
$cats[$key] = trim(strtolower($cat));
classes/class.post-type.landing-page.php CHANGED
@@ -172,7 +172,7 @@ class Landing_Pages_Post_Type {
172
"cb" => "<input type=\"checkbox\" />",
173
"thumbnail-lander" => __("Preview", 'inbound-pro'),
174
"title" => __("Landing Page Title", 'inbound-pro'),
175
- "stats" => __("Variation Testing Stats", 'inbound-pro'),
176
"impressions" => __("Total<br>Visits", 'inbound-pro'),
177
"actions" => __("Total<br>Conversions", 'inbound-pro'),
178
"cr" => __("Total<br>Conversion Rate", 'inbound-pro')
172
"cb" => "<input type=\"checkbox\" />",
173
"thumbnail-lander" => __("Preview", 'inbound-pro'),
174
"title" => __("Landing Page Title", 'inbound-pro'),
175
+ "stats" => __("Split Testing Results", 'inbound-pro'),
176
"impressions" => __("Total<br>Visits", 'inbound-pro'),
177
"actions" => __("Total<br>Conversions", 'inbound-pro'),
178
"cr" => __("Total<br>Conversion Rate", 'inbound-pro')
classes/{class.statistics.php → class.split-testing-stats.php} RENAMED
@@ -1,12 +1,12 @@
1
<?php
2
3
/**
4
- * Class addsa impressions/conversions counter box to all post types that are not a landing page. This feature is disabled for Inbound Pro users.
5
* @package LandingPages
6
* @subpackage Tracking
7
*/
8
9
- class Landing_Pages_Stats {
10
11
/**
12
* Initiate class
@@ -20,10 +20,13 @@ class Landing_Pages_Stats {
20
*/
21
public static function load_hooks() {
22
23
- /* records page impression */
24
add_action( 'lp_record_impression' , array( __CLASS__ , 'record_impression' ) , 10, 3);
25
26
- /* record landing page conversion */
27
add_filter( 'inboundnow_store_lead_pre_filter_data' , array( __CLASS__ , 'record_conversion' ) ,10,1);
28
29
}
@@ -55,14 +58,14 @@ class Landing_Pages_Stats {
55
}
56
/* If Non Landing Page Post Type */
57
else {
58
- $impressions = Landing_Pages_Stats::get_impressions_count( $post_id );
59
$impressions++;
60
- Landing_Pages_Stats::set_impressions_count( $post_id, $impressions );
61
}
62
}
63
64
/**
65
- * Listens for new lead creation events and if the lead converted on a landing page then capture the conversion
66
* @param $data
67
*/
68
public static function record_conversion($data) {
@@ -71,11 +74,6 @@ class Landing_Pages_Stats {
71
return $data;
72
}
73
74
- $post = get_post( $data['page_id'] );
75
- if ($post) {
76
- $data['post_type'] = $post->post_type;
77
- }
78
-
79
/* this filter is used by Inbound Pro to check if visitor's ip is on a not track list */
80
$do_not_track = apply_filters('inbound_analytics_stop_track' , false );
81
@@ -83,17 +81,22 @@ class Landing_Pages_Stats {
83
return $data;
84
}
85
86
- /* increment conversions for landing pages */
87
- if( isset($data['post_type']) && $data['post_type'] === 'landing-page' ) {
88
- $conversions = Landing_Pages_Variations::get_conversions( $data['page_id'] , $data['variation'] );
89
$conversions++;
90
- Landing_Pages_Variations::set_conversions_count( $data['page_id'] , $data['variation'] , $conversions );
91
}
92
/* increment conversions for non landing pages */
93
else {
94
- $conversions = Landing_Pages_Stats::get_conversions_count( $data['page_id'] );
95
$conversions++;
96
- Landing_Pages_Stats::set_conversions_count( $data['page_id'] , $conversions );
97
}
98
99
return $data;
@@ -177,8 +180,8 @@ class Landing_Pages_Stats {
177
*/
178
public static function get_conversion_rate( $post_id ) {
179
180
- $impressions = Landing_Pages_Stats::get_impressions_count( $post_id );
181
- $conversions = Landing_Pages_Stats::get_conversions_count( $post_id );
182
183
if ($impressions > 0) {
184
$conversion_rate = $conversions / $impressions;
@@ -210,4 +213,4 @@ class Landing_Pages_Stats {
210
}
211
212
213
- new Landing_Pages_Stats;
1
<?php
2
3
/**
4
+ * Class contains methods related to split testing statistics
5
* @package LandingPages
6
* @subpackage Tracking
7
*/
8
9
+ class Landing_Pages_Split_Testing_Stats {
10
11
/**
12
* Initiate class
20
*/
21
public static function load_hooks() {
22
23
+ /* adds page impression to split testing statistics */
24
add_action( 'lp_record_impression' , array( __CLASS__ , 'record_impression' ) , 10, 3);
25
26
+ /* adds landing page conversion to split testing statistics */
27
+ add_action( 'inbound_track_link', array(__CLASS__, 'record_conversion'));
28
+
29
+ /* adds landing page conversion to split testing statistics */
30
add_filter( 'inboundnow_store_lead_pre_filter_data' , array( __CLASS__ , 'record_conversion' ) ,10,1);
31
32
}
58
}
59
/* If Non Landing Page Post Type */
60
else {
61
+ $impressions = Landing_Pages_Split_Testing_Stats::get_impressions_count( $post_id );
62
$impressions++;
63
+ Landing_Pages_Split_Testing_Stats::set_impressions_count( $post_id, $impressions );
64
}
65
}
66
67
/**
68
+ * Records lead creation events and link click events as split testing conversion
69
* @param $data
70
*/
71
public static function record_conversion($data) {
74
return $data;
75
}
76
77
/* this filter is used by Inbound Pro to check if visitor's ip is on a not track list */
78
$do_not_track = apply_filters('inbound_analytics_stop_track' , false );
79
81
return $data;
82
}
83
84
+ $post_type = get_post_type($data['page_id']);
85
+ $data['vid'] = (isset($data['vid'])) ? $data['vid'] : 0;
86
+ $data['vid'] = (isset($data['variation'])) ? $data['variation'] : $data['vid'];
87
+
88
+ if (current_filter() == 'inbound_track_link' && $post_type != 'landing-page' ) {
89
+ return;
90
+ } else if ($post_type === 'landing-page' ) {
91
+ $conversions = Landing_Pages_Variations::get_conversions( $data['page_id'] , $data['vid'] );
92
$conversions++;
93
+ Landing_Pages_Variations::set_conversions_count( $data['page_id'] , $data['vid'] , $conversions );
94
}
95
/* increment conversions for non landing pages */
96
else {
97
+ $conversions = Landing_Pages_Split_Testing_Stats::get_conversions_count( $data['page_id'] );
98
$conversions++;
99
+ Landing_Pages_Split_Testing_Stats::set_conversions_count( $data['page_id'] , $conversions );
100
}
101
102
return $data;
180
*/
181
public static function get_conversion_rate( $post_id ) {
182
183
+ $impressions = Landing_Pages_Split_Testing_Stats::get_impressions_count( $post_id );
184
+ $conversions = Landing_Pages_Split_Testing_Stats::get_conversions_count( $post_id );
185
186
if ($impressions > 0) {
187
$conversion_rate = $conversions / $impressions;
213
}
214
215
216
+ new Landing_Pages_Split_Testing_Stats;
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.6.1
7
Author: Inbound Now
8
Author URI: http://www.inboundnow.com/
9
@@ -41,7 +41,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
41
*/
42
private static function load_constants() {
43
44
- define('LANDINGPAGES_CURRENT_VERSION', '2.6.1' );
45
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
46
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
47
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
@@ -72,7 +72,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
72
include_once( LANDINGPAGES_PATH . 'classes/class.template-management.php');
73
include_once( LANDINGPAGES_PATH . 'classes/class.wp-list-table.templates.php');
74
include_once( LANDINGPAGES_PATH . 'classes/class.admin-menus.php');
75
- include_once( LANDINGPAGES_PATH . 'classes/class.statistics.php');
76
include_once( LANDINGPAGES_PATH . 'classes/class.admin-notices.php');
77
include_once( LANDINGPAGES_PATH . 'classes/class.row-actions.php');
78
include_once( LANDINGPAGES_PATH . 'classes/class.welcome.php');
@@ -96,7 +96,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
96
include_once( LANDINGPAGES_PATH . 'classes/class.variations.php');
97
include_once( LANDINGPAGES_PATH . 'classes/class.acf-integration.php');
98
include_once( LANDINGPAGES_PATH . 'classes/class.postmeta.php');
99
- include_once( LANDINGPAGES_PATH . 'classes/class.statistics.php');
100
include_once( LANDINGPAGES_PATH . 'classes/class.post-type.landing-page.php');
101
include_once( LANDINGPAGES_PATH . 'modules/module.utils.php');
102
include_once( LANDINGPAGES_PATH . 'classes/class.sidebars.php');
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.6.2
7
Author: Inbound Now
8
Author URI: http://www.inboundnow.com/
9
41
*/
42
private static function load_constants() {
43
44
+ define('LANDINGPAGES_CURRENT_VERSION', '2.6.2' );
45
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
46
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
47
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
72
include_once( LANDINGPAGES_PATH . 'classes/class.template-management.php');
73
include_once( LANDINGPAGES_PATH . 'classes/class.wp-list-table.templates.php');
74
include_once( LANDINGPAGES_PATH . 'classes/class.admin-menus.php');
75
+ include_once( LANDINGPAGES_PATH . 'classes/class.split-testing-stats.php');
76
include_once( LANDINGPAGES_PATH . 'classes/class.admin-notices.php');
77
include_once( LANDINGPAGES_PATH . 'classes/class.row-actions.php');
78
include_once( LANDINGPAGES_PATH . 'classes/class.welcome.php');
96
include_once( LANDINGPAGES_PATH . 'classes/class.variations.php');
97
include_once( LANDINGPAGES_PATH . 'classes/class.acf-integration.php');
98
include_once( LANDINGPAGES_PATH . 'classes/class.postmeta.php');
99
+ include_once( LANDINGPAGES_PATH . 'classes/class.split-testing-stats.php');
100
include_once( LANDINGPAGES_PATH . 'classes/class.post-type.landing-page.php');
101
include_once( LANDINGPAGES_PATH . 'modules/module.utils.php');
102
include_once( LANDINGPAGES_PATH . 'classes/class.sidebars.php');
modules/module.redirect-ab-testing.php CHANGED
@@ -17,7 +17,7 @@ if (file_exists('./../../../../wp-load.php')) {
17
18
/**
19
* Class LP_Variation_Rotation provides an external WP instance set of classes for controlling landing page rotation memory
20
- * @package Landing Pages
21
* @subpackage Variations
22
*/
23
17
18
/**
19
* Class LP_Variation_Rotation provides an external WP instance set of classes for controlling landing page rotation memory
20
+ * @package LandingPages
21
* @subpackage Variations
22
*/
23
modules/module.utils.php CHANGED
@@ -33,6 +33,7 @@ if (!function_exists('inbound_qtrans_disable')) {
33
34
35
36
/**
37
* Add namespaces for legacy classes to try and prevent fatals
38
*/
33
34
35
36
+
37
/**
38
* Add namespaces for legacy classes to try and prevent fatals
39
*/
readme.txt CHANGED
@@ -7,7 +7,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
8
Requires at least: 3.8
9
Tested up to: 4.8.1
10
- Stable Tag: 2.6.1
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.
@@ -61,7 +61,7 @@ Landing Pages plugin ships with only small selection of responsive landing page
61
62
Landing Pages plugin also offers the ability to use your current selected theme as a template which open the door to <a href="http://docs.inboundnow.com/guide/default-wp-themes/">further customizations</a>.
63
64
- We also offer a guide for using <a href="https://github.com/inboundnow/landing-pages/blob/develop/shared/docs/how.to.create.landing.page.templates.using.ACF.md">Advanced Custom Fields to build your own template.</a>
65
66
== Installation ==
67
@@ -85,6 +85,9 @@ We also offer a guide for using <a href="https://github.com/inboundnow/landing-p
85
86
== Changelog ==
87
88
= 2.6.1 =
89
* Ensuring Google UTM parameters are not removed from Landing Page URL
90
* Responsive design improvements to Simple Two Column Responsive landing page.
7
Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
8
Requires at least: 3.8
9
Tested up to: 4.8.1
10
+ Stable Tag: 2.6.2
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.
61
62
Landing Pages plugin also offers the ability to use your current selected theme as a template which open the door to <a href="http://docs.inboundnow.com/guide/default-wp-themes/">further customizations</a>.
63
64
+ We also offer a guide for using <a href="https://github.com/inboundnow/inbound-pro/blob/develop/core/shared/docs/how.to.create.landing.page.templates.using.ACF.md">Advanced Custom Fields to build your own template.</a>
65
66
== Installation ==
67
85
86
== Changelog ==
87
88
+ = 2.6.2 =
89
+ * Improving support for conversion recording through tracked links. There are still some issues with link based conversion tracking and non-default templates. See support for assistance.
90
+
91
= 2.6.1 =
92
* Ensuring Google UTM parameters are not removed from Landing Page URL
93
* Responsive design improvements to Simple Two Column Responsive landing page.
shared/assets/js/frontend/analytics-src/analytics.forms.js CHANGED
@@ -736,6 +736,7 @@ var InboundForms = (function(_inbound) {
736
for (var input in inputsObject) {
737
var inputValue = inputsObject[input]['value'];
738
var inputType = inputsObject[input]['type'];
739
740
/* Add custom hook here to look for additional values */
741
if (typeof(inputValue) != "undefined" && inputValue != null && inputValue != "") {
@@ -747,12 +748,14 @@ var InboundForms = (function(_inbound) {
747
// get the search input value
748
if(inputType == 'search'){
749
searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
750
}
751
}
752
}
753
/* exit if there isn't a search query */
754
if(!searchQuery[0]){
755
- return;
756
}
757
758
var searchString = searchQuery.join('|field|');
736
for (var input in inputsObject) {
737
var inputValue = inputsObject[input]['value'];
738
var inputType = inputsObject[input]['type'];
739
+ var inputName = inputsObject[input]['name'];
740
741
/* Add custom hook here to look for additional values */
742
if (typeof(inputValue) != "undefined" && inputValue != null && inputValue != "") {
748
// get the search input value
749
if(inputType == 'search'){
750
searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
751
+ } else if (inputName == 's'){
752
+ searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
753
}
754
}
755
}
756
/* exit if there isn't a search query */
757
if(!searchQuery[0]){
758
+ _inbound.Forms.releaseFormSubmit(form);
759
}
760
761
var searchString = searchQuery.join('|field|');
shared/assets/js/frontend/analytics-src/analytics.hooks.js CHANGED
@@ -402,4 +402,4 @@ var _inboundHooks = (function (_inbound) {
402
403
return _inbound;
404
405
- })(_inbound || {});
402
403
return _inbound;
404
405
+ })(_inbound || {});
shared/assets/js/frontend/analytics-src/analytics.init.js CHANGED
@@ -128,4 +128,4 @@ var _inbound = (function(options) {
128
129
return Analytics;
130
131
- })(_inboundOptions);
128
129
return Analytics;
130
131
+ })(_inboundOptions);
shared/assets/js/frontend/analytics-src/analytics.page.js CHANGED
@@ -299,9 +299,15 @@ var _inboundPageTracking = (function(_inbound) {
299
300
_inbound.totalStorage(lsType, Pages);
301
302
- this.storePageView();
303
-
304
- },
305
CheckTimeOut: function() {
306
307
var pageRevisit = this.isRevisit(Pages),
@@ -333,51 +339,45 @@ var _inboundPageTracking = (function(_inbound) {
333
_inbound.deBugger('pages', status);
334
},
335
storePageView: function() {
336
- var stored = false;
337
338
/* ignore if page tracking off and page is not a landing page */
339
if ( inbound_settings.page_tracking == 'off' && inbound_settings.post_type != 'landing-page' ) {
340
return;
341
}
342
343
- /* Let's try and fire this last - also defines what constitutes a bounce - */
344
- document.onreadystatechange = function(){
345
-
346
- if(document.readyState !== 'loading' && stored === false){
347
- setTimeout(function(){
348
- var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
349
- var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
350
- var ctas_loaded = _inbound.totalStorage('wp_cta_loaded');
351
- var ctas_impressions = _inbound.totalStorage('wp_cta_impressions');
352
- stored = true;
353
-
354
- /* now reset impressions */
355
- _inbound.totalStorage('wp_cta_impressions' , {} );
356
-
357
- var data = {
358
- action: 'inbound_track_lead',
359
- wp_lead_uid: lead_uid,
360
- wp_lead_id: leadID,
361
- page_id: inbound_settings.post_id,
362
- variation_id: inbound_settings.variation_id,
363
- post_type: inbound_settings.post_type,
364
- current_url: window.location.href,
365
- page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
366
- cta_impressions : JSON.stringify(ctas_impressions),
367
- cta_history : JSON.stringify(ctas_loaded),
368
- json: '0'
369
- };
370
-
371
- var firePageCallback = function(leadID) {
372
- //_inbound.Events.page_view_saved(leadID);
373
- };
374
- //_inbound.Utils.doAjax(data, firePageCallback);
375
-
376
- _inbound.Utils.ajaxPost(inbound_settings.admin_url, data, firePageCallback);
377
-
378
- } , 200 );
379
- }
380
- }
381
}
382
/*! GA functions
383
function log_event(category, action, label) {
299
300
_inbound.totalStorage(lsType, Pages);
301
302
+ /* Let's try and fire this last - also defines what constitutes a bounce - */
303
+ var stored = false;
304
+ document.onreadystatechange = function () {
305
+ if (document.readyState !== 'loading' && stored === false) {
306
+ _inbound.PageTracking.storePageView();
307
+ }
308
+ }
309
+ }
310
+ ,
311
CheckTimeOut: function() {
312
313
var pageRevisit = this.isRevisit(Pages),
339
_inbound.deBugger('pages', status);
340
},
341
storePageView: function() {
342
343
/* ignore if page tracking off and page is not a landing page */
344
if ( inbound_settings.page_tracking == 'off' && inbound_settings.post_type != 'landing-page' ) {
345
return;
346
}
347
348
+ setTimeout(function(){
349
+ var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
350
+ var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
351
+ var ctas_loaded = _inbound.totalStorage('wp_cta_loaded');
352
+ var ctas_impressions = _inbound.totalStorage('wp_cta_impressions');
353
+ stored = true;
354
+
355
+ /* now reset impressions */
356
+ _inbound.totalStorage('wp_cta_impressions' , {} );
357
+
358
+ var data = {
359
+ action: 'inbound_track_lead',
360
+ wp_lead_uid: lead_uid,
361
+ wp_lead_id: leadID,
362
+ page_id: inbound_settings.post_id,
363
+ variation_id: inbound_settings.variation_id,
364
+ post_type: inbound_settings.post_type,
365
+ current_url: window.location.href,
366
+ page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
367
+ cta_impressions : JSON.stringify(ctas_impressions),
368
+ cta_history : JSON.stringify(ctas_loaded),
369
+ json: '0'
370
+ };
371
+
372
+ var firePageCallback = function(leadID) {
373
+ //_inbound.Events.page_view_saved(leadID);
374
+ };
375
+ //_inbound.Utils.doAjax(data, firePageCallback);
376
+
377
+ _inbound.Utils.ajaxPost(inbound_settings.admin_url, data, firePageCallback);
378
+
379
+ } , 200 );
380
+
381
}
382
/*! GA functions
383
function log_event(category, action, label) {
shared/assets/js/frontend/analytics/inboundAnalytics.js CHANGED
@@ -130,6 +130,7 @@ var _inbound = (function(options) {
130
return Analytics;
131
132
})(_inboundOptions);
133
/**
134
* # Hooks & Filters
135
*
@@ -535,6 +536,7 @@ var _inboundHooks = (function (_inbound) {
535
return _inbound;
536
537
})(_inbound || {});
538
/**
539
* # _inbound UTILS
540
*
@@ -2132,6 +2134,7 @@ var InboundForms = (function(_inbound) {
2132
for (var input in inputsObject) {
2133
var inputValue = inputsObject[input]['value'];
2134
var inputType = inputsObject[input]['type'];
2135
2136
/* Add custom hook here to look for additional values */
2137
if (typeof(inputValue) != "undefined" && inputValue != null && inputValue != "") {
@@ -2143,12 +2146,14 @@ var InboundForms = (function(_inbound) {
2143
// get the search input value
2144
if(inputType == 'search'){
2145
searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
2146
}
2147
}
2148
}
2149
/* exit if there isn't a search query */
2150
if(!searchQuery[0]){
2151
- return;
2152
}
2153
2154
var searchString = searchQuery.join('|field|');
@@ -3402,7 +3407,7 @@ var _inboundLeadsAPI = (function(_inbound) {
3402
_inbound.LeadsAPI.setGlobalLeadData(leadData);
3403
_inbound.deBugger('lead', 'Set Global Lead Data from Localstorage');
3404
3405
- if (!leadDataExpire) {
3406
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
3407
//console.log('Set Global Lead Data from Localstorage');
3408
_inbound.deBugger('lead', 'localized data old. Pull new from DB');
@@ -3734,9 +3739,15 @@ var _inboundPageTracking = (function(_inbound) {
3734
3735
_inbound.totalStorage(lsType, Pages);
3736
3737
- this.storePageView();
3738
-
3739
- },
3740
CheckTimeOut: function() {
3741
3742
var pageRevisit = this.isRevisit(Pages),
@@ -3768,51 +3779,45 @@ var _inboundPageTracking = (function(_inbound) {
3768
_inbound.deBugger('pages', status);
3769
},
3770
storePageView: function() {
3771
- var stored = false;
3772
3773
/* ignore if page tracking off and page is not a landing page */
3774
if ( inbound_settings.page_tracking == 'off' && inbound_settings.post_type != 'landing-page' ) {
3775
return;
3776
}
3777
3778
- /* Let's try and fire this last - also defines what constitutes a bounce - */
3779
- document.onreadystatechange = function(){
3780
-
3781
- if(document.readyState !== 'loading' && stored === false){
3782
- setTimeout(function(){
3783
- var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
3784
- var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
3785
- var ctas_loaded = _inbound.totalStorage('wp_cta_loaded');
3786
- var ctas_impressions = _inbound.totalStorage('wp_cta_impressions');
3787
- stored = true;
3788
-
3789
- /* now reset impressions */
3790
- _inbound.totalStorage('wp_cta_impressions' , {} );
3791
-
3792
- var data = {
3793
- action: 'inbound_track_lead',
3794
- wp_lead_uid: lead_uid,
3795
- wp_lead_id: leadID,
3796
- page_id: inbound_settings.post_id,
3797
- variation_id: inbound_settings.variation_id,
3798
- post_type: inbound_settings.post_type,
3799
- current_url: window.location.href,
3800
- page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
3801
- cta_impressions : JSON.stringify(ctas_impressions),
3802
- cta_history : JSON.stringify(ctas_loaded),
3803
- json: '0'
3804
- };
3805
3806
- var firePageCallback = function(leadID) {
3807
- //_inbound.Events.page_view_saved(leadID);
3808
- };
3809
- //_inbound.Utils.doAjax(data, firePageCallback);
3810
3811
- _inbound.Utils.ajaxPost(inbound_settings.admin_url, data, firePageCallback);
3812
3813
- } , 200 );
3814
- }
3815
- }
3816
}
3817
/*! GA functions
3818
function log_event(category, action, label) {
130
return Analytics;
131
132
})(_inboundOptions);
133
+
134
/**
135
* # Hooks & Filters
136
*
536
return _inbound;
537
538
})(_inbound || {});
539
+
540
/**
541
* # _inbound UTILS
542
*
2134
for (var input in inputsObject) {
2135
var inputValue = inputsObject[input]['value'];
2136
var inputType = inputsObject[input]['type'];
2137
+ var inputName = inputsObject[input]['name'];
2138
2139
/* Add custom hook here to look for additional values */
2140
if (typeof(inputValue) != "undefined" && inputValue != null && inputValue != "") {
2146
// get the search input value
2147
if(inputType == 'search'){
2148
searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
2149
+ } else if (inputName == 's'){
2150
+ searchQuery.push('search_text' + '|value|' + inputsObject[input]['value']);
2151
}
2152
}
2153
}
2154
/* exit if there isn't a search query */
2155
if(!searchQuery[0]){
2156
+ _inbound.Forms.releaseFormSubmit(form);
2157
}
2158
2159
var searchString = searchQuery.join('|field|');
3407
_inbound.LeadsAPI.setGlobalLeadData(leadData);
3408
_inbound.deBugger('lead', 'Set Global Lead Data from Localstorage');
3409
3410
+ if (!leadDataExpire) {
3411
_inbound.Utils.ajaxPost(inbound_settings.admin_url, data, success);
3412
//console.log('Set Global Lead Data from Localstorage');
3413
_inbound.deBugger('lead', 'localized data old. Pull new from DB');
3739
3740
_inbound.totalStorage(lsType, Pages);
3741
3742
+ /* Let's try and fire this last - also defines what constitutes a bounce - */
3743
+ var stored = false;
3744
+ document.onreadystatechange = function () {
3745
+ if (document.readyState !== 'loading' && stored === false) {
3746
+ _inbound.PageTracking.storePageView();
3747
+ }
3748
+ }
3749
+ }
3750
+ ,
3751
CheckTimeOut: function() {
3752
3753
var pageRevisit = this.isRevisit(Pages),
3779
_inbound.deBugger('pages', status);
3780
},
3781
storePageView: function() {
3782
3783
/* ignore if page tracking off and page is not a landing page */
3784
if ( inbound_settings.page_tracking == 'off' && inbound_settings.post_type != 'landing-page' ) {
3785
return;
3786
}
3787
3788
+ setTimeout(function(){
3789
+ var leadID = ( _inbound.Utils.readCookie('wp_lead_id') ) ? _inbound.Utils.readCookie('wp_lead_id') : '';
3790
+ var lead_uid = ( _inbound.Utils.readCookie('wp_lead_uid') ) ? _inbound.Utils.readCookie('wp_lead_uid') : '';
3791
+ var ctas_loaded = _inbound.totalStorage('wp_cta_loaded');
3792
+ var ctas_impressions = _inbound.totalStorage('wp_cta_impressions');
3793
+ stored = true;
3794
+
3795
+ /* now reset impressions */
3796
+ _inbound.totalStorage('wp_cta_impressions' , {} );
3797
+
3798
+ var data = {
3799
+ action: 'inbound_track_lead',
3800
+ wp_lead_uid: lead_uid,
3801
+ wp_lead_id: leadID,
3802
+ page_id: inbound_settings.post_id,
3803
+ variation_id: inbound_settings.variation_id,
3804
+ post_type: inbound_settings.post_type,
3805
+ current_url: window.location.href,
3806
+ page_views: JSON.stringify(_inbound.PageTracking.getPageViews()),
3807
+ cta_impressions : JSON.stringify(ctas_impressions),
3808
+ cta_history : JSON.stringify(ctas_loaded),
3809
+ json: '0'
3810
+ };
3811
3812
+ var firePageCallback = function(leadID) {
3813
+ //_inbound.Events.page_view_saved(leadID);
3814
+ };
3815
+ //_inbound.Utils.doAjax(data, firePageCallback);
3816
3817
+ _inbound.Utils.ajaxPost(inbound_settings.admin_url, data, firePageCallback);
3818
+
3819
+ } , 200 );
3820
3821
}
3822
/*! GA functions
3823
function log_event(category, action, label) {
shared/assets/js/frontend/analytics/inboundAnalytics.min.js CHANGED
@@ -1,2 +1,2 @@
1
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
2
- function inboundFormNoRedirect(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form,n=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])');0!=n.length&&"IA=="!=n[0].value||(t.action="javascript:void(0)")}}function inboundFormNoRedirectContent(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),n=jQuery(e).css("background"),o=jQuery(e).css("color"),i=jQuery(e).css("height"),a=e.getElementsByClassName("inbound-form-spinner");0!=t.length&&"IA=="!=t[0].value||(jQuery(a).remove(),jQuery(e).prepend('<div id="redir-check"><i class="fa fa-check-square" aria-hidden="true" style="background='+n+"; color="+o+"; font-size:calc("+i+' * .42);"></i></div>'))}}var inbound_data=inbound_data||{},_inboundOptions=_inboundOptions||{},_gaq=_gaq||[],_inbound=function(e){var t={timeout:inbound_settings.is_admin?500:1e4,formAutoTracking:!0,formAutoPopulation:!0},n={init:function(){_inbound.Utils.init(),_inbound.Utils.domReady(window,function(){_inbound.DomLoaded()})},DomLoaded:function(){_inbound.PageTracking.init(),_inbound.Forms.init(),_inbound.Utils.setUrlParams(),_inbound.LeadsAPI.init(),setTimeout(function(){_inbound.Forms.init()},2e3),_inbound.trigger("analytics_ready")},extend:function(e,t){var n,o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o},debug:function(e,t){},deBugger:function(e,t,n){if(console){var o,i,a,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(a=(r=r.split("-"))[1]),i="true"===_inbound.Utils.readCookie("inbound_debug"),((o="true"===_inbound.Utils.readCookie("inbound_debug_"+e))||s||i)&&(t&&"string"==typeof t&&(i||"all"===a?console.log('logAll "'+e+'" =>',t):o?console.log('log "'+e+'" =>',t):e===a&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},o=n.extend(t,e);return n.Settings=o||{},n}(_inboundOptions),_inboundHooks=function(e){return e.hooks=new function(){function e(e,t,n,o){if(a[e][t])if(n){var i,r=a[e][t];if(o)for(i=r.length;i--;){var s=r[i];s.callback===n&&s.context===o&&r.splice(i,1)}else for(i=r.length;i--;)r[i].callback===n&&r.splice(i,1)}else a[e][t]=[]}function t(e,t,o,i,r){var s={callback:o,priority:i,context:r},l=a[e][t];l?(l.push(s),l=n(l)):l=[s],a[e][t]=l}function n(e){for(var t,n,o,i=1,a=e.length;i<a;i++){for(t=e[i],n=i;(o=e[n-1])&&o.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function o(e,t,n){var o=a[e][t];if(!o)return"filters"===e&&n[0];var i=0,r=o.length;if("filters"===e)for(;i<r;i++)n[0]=o[i].callback.apply(o[i].context,n);else for(;i<r;i++)o[i].callback.apply(o[i].context,n);return"filters"!==e||n[0]}var i={removeFilter:function(t,n){return"string"==typeof t&&e("filters",t,n),i},applyFilters:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?o("filters",t,e):i},addFilter:function(e,n,o,a){return"string"==typeof e&&"function"==typeof n&&t("filters",e,n,o=parseInt(o||10,10)),i},removeAction:function(t,n){return"string"==typeof t&&e("actions",t,n),i},doAction:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&o("actions",t,e),i},addAction:function(e,n,o,a){return"string"==typeof e&&"function"==typeof n&&t("actions",e,n,o=parseInt(o||10,10),a),i}},a={actions:{},filters:{}};return i},e.add_action=function(){var t=arguments[0].split(" ");for(k in t)arguments[0]="inbound."+t[k],e.hooks.addAction.apply(this,arguments);return this},e.remove_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeAction.apply(this,arguments),this},e.do_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.doAction.apply(this,arguments),this},e.add_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.addFilter.apply(this,arguments),this},e.remove_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeFilter.apply(this,arguments),this},e.apply_filters=function(){return arguments[0]="inbound."+arguments[0],e.hooks.applyFilters.apply(this,arguments)},e}(_inbound||{}),_inboundUtils=function(e){var t,n=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,o=(Object.prototype.toString,{api_host:("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/#x2F;,""),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}#x2F;i))?host[0]:""});return e.Utils={init:function(){this.polyFills(),this.checkLocalStorage(),this.SetUID(),this.storeReferralData()},polyFills:function(){window.console||(window.console={});for(var e=["log","info","warn","error","debug","trace","dir","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","dirxml","assert","count","markTimeline","timeStamp","clear"],t=0;t<e.length;t++)window.console[e[t]]||(window.console[e[t]]=function(){});Date.prototype.toISOString||function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();try{new CustomEvent("?")}catch(e){this.CustomEvent=function(e,t){function n(t,n,o,i){this["init"+e](t,n,o,i),"detail"in this||(this.detail=i)}return function(o,i){var a=document.createEvent(e);return null!==o?n.call(a,o,(i||(i=t)).bubbles,i.cancelable,i.detail):a.initCustomEvent=n,a}}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),o=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)(t=document._qsa.shift()).style.removeAttribute("x-qsa"),o.push(t);return document._qsa=null,o}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var e,t=window.getSelection(),n=[],o=0;o<t.rangeCount;o++)n[o]=t.getRangeAt(o);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(o=0;o<n.length;o++)t.addRange(n[o]);return e})},createCookie:function(e,t,n){var o="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}document.cookie=e+"="+t+o+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.length)}return null},eraseCookie:function(e){this.createCookie(e,"",-1)},getAllCookies:function(){var t={};if(document.cookie&&""!==document.cookie)for(var n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o].split("=");i[0]=i[0].replace(/^ /,""),t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e.totalStorage("inbound_cookies",t),t},setUrlParams:function(){var n={};!function(){for(var e,t=function(e){return decodeURIComponent(e).replace(/\+/g," ")},o=window.location.search.substring(1),i=/([^&=]+)=?([^&]*)/g;e=i.exec(o);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var a=e[1].indexOf("["),r=e[1].slice(a+1,e[1].indexOf("]",a)),s=t(e[1].slice(0,a));"object"!=typeof n[s]&&(n[t(s)]={},n[t(s)].length=0),r?n[t(s)][t(r)]=t(e[2]):Array.prototype.push.call(n[t(s)],t(e[2]))}}();for(var o in n)if("action"!=o)if("object"==typeof n[o])for(var i in n[o])this.createCookie(i,n[o][i],30);else this.createCookie(o,n[o],30);if(t){var a=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(a,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){n={};if(t)var n=e.totalStorage("inbound_url_params");return n},getParameterVal:function(e,t){return(RegExp(e+"=(.+?)(&|$)").exec(t)||[,!1])[1]},checkLocalStorage:function(){if("localStorage"in window)try{ls=void 0===window.localStorage?void 0:window.localStorage,t="undefined"!=typeof ls&&void 0!==window.JSON}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}var n=Object.keys(localStorage).map(function(t){return{name:t,size:e(localStorage[t])}}).map(function(e){return e.size=t(e.size).toFixed(2)+" MB",e});console.table(n)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=t<10?"0":"",o=e.getFullYear(),i=e.getHours(),a=i<10?"0":"",r=e.getMinutes(),s=r<10?"0":"",l=e.getSeconds(),u=l<10?"0":"",d=e.getMonth()+1;return o+"/"+(d<10?"0":"")+d+"/"+n+t+" "+a+i+":"+s+r+":"+u+l},SetSessionTimeout:function(){this.readCookie("lead_session_expire");var e=new Date;e.setTime(e.getTime()+18e5),this.createCookie("lead_session_expire",!0,e)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",o=e.Utils.readCookie("inbound_referral_site"),i=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),o||this.createCookie("inbound_referral_site",n,t),i||e.totalStorage("inbound_original_referral",i)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n},generateGUID:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,guid)},SetUID:function(e){if(!this.readCookie("wp_lead_uid")){var t=e||this.CreateUID(35);this.createCookie("wp_lead_uid",t)}},countProperties:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&++t;return t},mergeObjs:function(e,t){var n={};for(var o in e)n[o]=e[o];for(var o in t)n[o]=t[o];return n},hasClass:function(e,t){if("classList"in document.documentElement)n=t.classList.contains(e);else var n=new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className);return n},addClass:function(e,t){"classList"in document.documentElement?t.classList.add(e):this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)},removeClass:function(e,t){"classList"in document.documentElement?t.classList.remove(e):this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)*"+e+"(\\s|$)*","g"),""))},removeElement:function(e){e.parentNode.removeChild(e)},trim:function(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,"\n")},ajaxPolyFill:function(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(var e,t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(e){}return e},ajaxSendData:function(e,t,n,o,i){var a=this.ajaxPolyFill();setTimeout(function(){a.open(n,e,!0),a.onreadystatechange=function(){4==a.readyState&&t(a.responseText)},"POST"==n&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(o)},100)},ajaxGet:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e+"?"+i.join("&"),n,"GET",null,o)},ajaxPost:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e,n,"POST",i.join("&"),o)},sendEvent:function(e,t,i){t=t||{},async=!0;var a=getCookie();if(a){var r;for(r in a)t[r]=a[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=o.api_host+"/track?data="+encodeURIComponent(JSON.stringify(s));if(n){var u=new XMLHttpRequest;u.open("GET",l,async),u.withCredentials=async,u.send(null)}else{var d=document.createElement("script");d.type="text/javascript",d.async=async,d.defer=async,d.src=l;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(d,c)}return action(i),self},domReady:function(e,t){var n=!1,o=!0,i=e.document,a=i.documentElement,r=i.addEventListener?"addEventListener":"attachEvent",s=i.addEventListener?"removeEventListener":"detachEvent",l=i.addEventListener?"":"on",u=function(o){"readystatechange"==o.type&&"complete"!=i.readyState||(("load"==o.type?e:i)[s](l+o.type,u,!1),!n&&(n=!0)&&t.call(e,o.type||o))},d=function(){try{a.doScroll("left")}catch(e){return void setTimeout(d,50)}u("poll")};if("complete"==i.readyState)t.call(e,"lazy");else{if(i.createEventObject&&a.doScroll){try{o=!e.frameElement}catch(e){}o&&d()}i[r](l+"DOMContentLoaded",u,!1),i[r](l+"readystatechange",u,!1),e[r](l+"load",u,!1)}},addListener:function(e,t,n){e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},removeListener:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},throttle:function(e,t){var n,o,i,a=null,r=0,s=function(){r=new Date,a=null,i=e.apply(n,o)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,o=arguments,u<=0?(clearTimeout(a),a=null,r=l,i=e.apply(n,o)):a||(a=setTimeout(s,u)),i}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),void 0!==_gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)},cacheSearchData:function(n,o){if(t){var i=e.totalStorage.getItem("inbound_search_storage");if(i)i.unshift(n),e.totalStorage.setItem("inbound_search_storage",i);else{var a=[n];e.totalStorage.setItem("inbound_search_storage",a)}}else{var r=JSON.stringify(n),s=this.readCookie("inbound_search_storage");s&&(r+="SPLIT-TOKEN"+s),this.createCookie("inbound_search_storage",r,"180")}e.Forms.releaseFormSubmit(o)},storeSearchData:function(){if(inbound_settings.wp_lead_data.lead_id&&inbound_settings.wp_lead_data.lead_nonce){var t=[],n=e.totalStorage.getItem("inbound_search_storage"),o=this.readCookie("inbound_search_storage");if(n||o){if(o){o=o.split("SPLIT-TOKEN");for(var i in o)t.push(JSON.parse(o[i]))}n&&(t=t.concat(n)),t.sort(function(e,t){return e.timestamp-t.timestamp});var a={action:"inbound_search_store",data:t=encodeURIComponent(JSON.stringify(t)),nonce:inbound_settings.wp_lead_data.lead_nonce,lead_id:inbound_settings.wp_lead_data.lead_id};callback=function(t){t&&(t=JSON.parse(t)),t.success&&(console.log(t.success),e.Utils.eraseCookie("inbound_search_storage"),e.totalStorage.deleteItem("inbound_search_storage")),t.error&&console.log(t.error)},this.ajaxPost(inbound_settings.admin_url,a,callback)}}}},e}(_inbound||{}),InboundForms=function(e){var t=e.Utils,n=[],o=[],a=[],r={},s=e.Settings,l=["first name","last name","name","email","e-mail","phone","website","job title","your favorite food","company","tele","address","comment"];if(e.Forms={init:function(){e.Forms.runFieldMappingFilters(),e.Forms.formTrackInit(),e.Forms.searchTrackInit()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,t){return},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=window.document.forms[e];t.dataset.formProcessed||(t.dataset.formProcessed=!0,this.checkTrackStatus(t)&&(this.attachFormSubmitEvent(t),this.initFormMapping(t)))}},searchTrackInit:function(){if("off"!=inbound_settings.search_tracking&&!r.searchTrackInit){for(var e=0;e<window.document.forms.length;e++){var n=window.document.forms[e];n.dataset.searchChecked||(n.dataset.searchChecked=!0,this.checkSearchTrackStatus(n)&&this.attachSearchFormSubmitEvent(n))}t.storeSearchData(),r.searchTrackInit=!0}},checkTrackStatus:function(t){var n=t.getAttribute("class");if(""!==n&&null!==n)return n.toLowerCase().indexOf("wpl-track-me")>-1||(n.toLowerCase().indexOf("inbound-track")>-1||(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1))},checkSearchTrackStatus:function(t){var n=t.getAttribute("class"),o=t.getAttribute("id");return""!==n&&null!==n&&n.toLowerCase().indexOf("search")>-1||(""===o||null===o?(cb=function(){console.log(t)},e.deBugger("searches","This search form is not tracked. Please assign on in settings...",cb),!1):o.toLowerCase().indexOf("search")>-1||void 0)},loopClassSelectors:function(n,o){for(var i=n.length-1;i>=0;i--){var a=t.trim(n[i]);-1===a.indexOf("#")&&-1===a.indexOf(".")&&(a="#"+a),(a=document.querySelector(a))&&("add"===o?(e.Utils.addClass("wpl-track-me",a),e.Utils.addClass("inbound-track",a)):(e.Utils.removeClass("wpl-track-me",a),e.Utils.removeClass("inbound-track",a)))}},initFormMapping:function(t){for(var n=[],o=0;o<t.elements.length;o++)formInput=t.elements[o],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&!e.Utils.hasClass("nopopulate",t)&&this.fillInputValues(formInput)):n.push(formInput);for(var i=n.length-1;i>=0;i--)formInput=n[i],this.mapField(formInput)},mapField:function(o){var a=o.id||!1,r=o.name||!1,s=this.getInputLabel(o);if(s&&this.ignoreFieldByLabel(s[0].innerText))return o.dataset.ignoreFormField=!0,!1;for(i=0;i<l.length;i++){var u=!1,d=l[i],c=t.trim(d),m=c.replace(/ /g,"_");r&&r.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching name attribute for -> "+c)):a&&a.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching ID attribute for ->"+c)):s?s[0].innerText.toLowerCase().indexOf(c)>-1&&(u=!0,e.deBugger("forms","Found matching sibling label for -> "+c)):n.push(c),u&&(this.addDataAttr(o,m),this.removeArrayItem(l,c),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},searchFormListener:function(t){t.preventDefault(),e.Forms.saveSearchData(t.target)},attachFormSubmitEvent:function(e){t.addListener(e,"submit",this.formListener);document.querySelector(".inbound-email")},attachSearchFormSubmitEvent:function(e){t.addListener(e,"submit",this.searchFormListener)},ignoreFieldByLabel:function(t){var n=!1;return!!t&&(-1==t.toLowerCase().indexOf("credit card")&&-1==t.toLowerCase().indexOf("card number")||(n=!0),-1==t.toLowerCase().indexOf("expiration")&&-1==t.toLowerCase().indexOf("expiry")||(n=!0),"month"!=t.toLowerCase()&&"mm"!=t.toLowerCase()&&"yy"!=t.toLowerCase()&&"yyyy"!=t.toLowerCase()&&"year"!=t.toLowerCase()||(n=!0),-1==t.toLowerCase().indexOf("cvv")&&-1==t.toLowerCase().indexOf("cvc")&&-1==t.toLowerCase().indexOf("secure code")&&-1==t.toLowerCase().indexOf("security code")||(n=!0),n&&e.deBugger("forms","ignore "+t),n)},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;if("visa"!=e.toLowerCase()&&"mastercard"!=e.toLowerCase()&&"american express"!=e.toLowerCase()&&"amex"!=e.toLowerCase()&&"discover"!=e.toLowerCase()||(t=!0),new RegExp("/^[0-9]+#x2F;").test(e)){var n=e.replace(" ","");this.isInt(n)&&n.length>=16&&(t=!0)}return t},isInt:function(e){return"number"==typeof e&&isFinite(e)&&e%1==0},releaseFormSubmit:function(e){document.body.style.cursor="default",t.removeClass("wpl-track-me",e),t.removeListener(e,"submit",this.formListener);var n=e.getAttribute("class");if(""!==n&&null!==n&&-1!=n.toLowerCase().indexOf("wpcf7-form"))return setTimeout(function(){document.body.style.cursor="default"},300),!0;e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&"submit"===formInput.name&&e.elements[t].click()},2e3)},saveFormData:function(n){for(var i=i||{},r=0;r<n.elements.length;r++)if(formInput=n.elements[r],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),i[inputName]||(i[inputName]={}),formInput.type&&(i[inputName].type=formInput.type),i[inputName].name||(i[inputName].name=formInput.name),formInput.dataset.mapFormField&&(i[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(l=this.getInputValue(formInput)))continue;break;case"TEXTAREA":l=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var s=0;s<formInput.length;s++)formInput[s].selected&&values.push(encodeURIComponent(formInput[s].value))}else l=formInput.value}if(e.deBugger("forms","Input Value = "+l),l){i[inputName].value||(i[inputName].value=[]),i[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",i);for(var u in i){var d=i[u].value,c=i[u].map;if(void 0!==d&&null!=d&&""!=d&&o.push(u+"="+i[u].value.join(",")),void 0!==c&&null!=c&&i[u].value&&(a.push(c+"="+i[u].value.join(",")),"email"===u))var m=i[u].value.join(",")}var f=o.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=a.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g),(m=t.getParameterVal("email",g)||t.readCookie("wp_lead_email"))||(m=t.getParameterVal("wpleads_email_address",g));var p=t.getParameterVal("name",g),h=t.getParameterVal("first_name",g),v=t.getParameterVal("last_name",g);if(!v&&h&&(_=decodeURI(h).split(" ")).length>0&&(h=_[0],v=_[1]),p&&!v&&!h){var _=decodeURI(p).split(" ");_.length>0&&(h=_[0],v=_[1])}p=h&&v?h+" "+v:p,h||(h=""),v||(v=""),e.deBugger("forms","fName = "+h),e.deBugger("forms","lName = "+v),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{},w=n.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),k=!1;if(0==w.length||"IA=="==w[0].value)k=!0;var S=n.querySelectorAll('input[value][type="hidden"][name="inbound_form_id"]');S=S.length>0?S[0].value:0;if("undefined"!=typeof landing_path_info)C=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)C=cta_path_info.variation;else var C=inbound_settings.variation_id;var I=inbound_settings.post_type||"page",L=inbound_settings.post_id||0;search_data={},formData={action:"inbound_lead_store",email:m,full_name:p,first_name:h,last_name:v,raw_params:f,mapped_params:g,url_params:JSON.stringify(y),search_data:"test",page_views:JSON.stringify(b),post_type:I,page_id:L,variation:C,source:t.readCookie("inbound_referral_site"),inbound_submitted:k,inbound_form_id:S,inbound_nonce:inbound_settings.ajax_nonce,event:n},callback=function(o){e.deBugger("forms","Lead Created with ID: "+o),o=parseInt(o,10),formData.leadID=o,o&&(t.createCookie("wp_lead_id",o),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(n)},e.trigger("form_before_submission",formData),t.ajaxPost(inbound_settings.admin_url,formData,callback)},saveSearchData:function(n){for(var o=o||{},i=0;i<n.elements.length;i++)if(formInput=n.elements[i],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("searches","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),o[inputName]||(o[inputName]={}),formInput.type&&(o[inputName].type=formInput.type),o[inputName].name||(o[inputName].name=formInput.name),formInput.dataset.mapFormField&&(o[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(r=this.getInputValue(formInput)))continue;break;case"TEXTAREA":r=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var a=0;a<formInput.length;a++)formInput[a].selected&&values.push(encodeURIComponent(formInput[a].value))}else r=formInput.value}if(e.deBugger("searches","Input Value = "+r),r){o[inputName].value||(o[inputName].value=[]),o[inputName].value.push(multiple?values.join(","):encodeURIComponent(r));var r=multiple?values.join(","):encodeURIComponent(r)}}e.deBugger("searches",o);var s=[];for(var l in o){var u=o[l].value,d=o[l].type;void 0!==u&&null!=u&&""!=u&&"search"==d&&s.push("search_text|value|"+o[l].value)}if(s[0]){var c=s.join("|field|");if(e.deBugger("searches","Stringified Search Form PARAMS: "+c),"undefined"!=typeof landing_path_info)m=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)m=cta_path_info.variation;else var m=inbound_settings.variation_id;var f=inbound_settings.post_type||"page",g=inbound_settings.post_id||0,p=t.readCookie("wp_lead_uid");inbound_settings.wp_lead_data.lead_email?email=inbound_settings.wp_lead_data.lead_email:t.readCookie("inbound_wpleads_email_address")?email=t.readCookie("inbound_wpleads_email_address"):email="",searchData={email:email,search_data:c,user_UID:p,post_type:f,page_id:g,variation:m,source:t.readCookie("inbound_referral_site"),ip_address:inbound_settings.ip_address,timestamp:Math.floor((new Date).getTime()/1e3)},e.trigger("search_before_caching",searchData),inbound_settings.wp_lead_data.lead_id?(searchData.lead_id=inbound_settings.wp_lead_data.lead_id,t.cacheSearchData(searchData,n)):t.cacheSearchData(searchData,n)}},rememberInputValues:function(n){n.name&&n.name;var o=n.type?n.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o||n.dataset.ignoreFormField)return!1;t.addListener(n,"change",function(n){if(n.target.name){if("checkbox"!==o)var i=n.target.value;else for(var a=[],r=document.querySelectorAll('input[name="'+n.target.name+'"]'),s=0;s<r.length;s++)r[s].checked&&a.push(r[s].value),i=a.join(",");inputData={name:n.target.name,node:n.target.nodeName.toLowerCase(),type:o,value:i,mapping:n.target.dataset.mapFormField},e.trigger("form_input_change",inputData),t.createCookie("inbound_"+n.target.name,encodeURIComponent(i))}})},fillInputValues:function(e){var n=e.name?"inbound_"+e.name:"",o=e.type?e.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o)return!1;if(t.readCookie(n)&&"comment"!=n)if(value=decodeURIComponent(t.readCookie(n)),"checkbox"===o||"radio"===o)for(var i=value.split(","),a=0;a<i.length;a++)e.value.indexOf(i[a])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},getInputLabel:function(e){var t;return(t=this.siblingsIsLabel(e))?t:!!(t=this.CheckParentForLabel(e))&&t},getInputValue:function(e){var t=!1;switch(e.type){case"radio":case"checkbox":e.checked&&(t=e.value);break;case"text":case"hidden":default:t=e.value}return t},addDataAttr:function(e,t){for(var n=document.getElementsByName(e.name),o=n.length-1;o>=0;o--)e.dataset.mapFormField||(n[o].dataset.mapFormField=t)},removeArrayItem:function(e,t){if(e.indexOf)index=e.indexOf(t);else for(index=e.length-1;index>=0&&e[index]!==t;--index);index>=0&&e.splice(index,1)},siblingsIsLabel:function(e){for(var t=this.getSiblings(e),n=[],o=t.length-1;o>=0;o--)"label"===t[o].nodeName.toLowerCase()&&n.push(t[o]);return n.length>0&&n.length<2&&n},getChildren:function(e,t){for(var n=[];e;e=e.nextSibling)1==e.nodeType&&e!=t&&n.push(e);return n},getSiblings:function(e){return this.getChildren(e.parentNode.firstChild,e)},CheckParentForLabel:function(e){if("FORM"===e.nodeName)return null;do{var t=e.getElementsByTagName("label");if(t.length>0&&t.length<2)return e.getElementsByTagName("label")}while(e=e.parentNode);return null},mailCheck:function(){var e=document.querySelector(".inbound-email");e&&(t.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(n){var o=document.querySelector(".email_suggestion");o&&t.removeElement(o);var i=document.createElement("span");i.innerHTML="<span class=\"email_suggestion\">Did youu mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+n.full+"</b></i>?</span>",e.parentNode.insertBefore(i,e.nextSibling);var a=document.getElementById("email_correction");t.addListener(a,"click",function(){e.value=a.innerHTML,a.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},void 0===u)var u={domainThreshold:1,topLevelThreshold:3,defaultDomains:["yahoo.com","google.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","mail.com","outlook.com","icloud.com"],defaultTopLevelDomains:["co.jp","co.uk","com","net","org","info","edu","gov","mil","ca","de"],run:function(e){e.domains=e.domains||u.defaultDomains,e.topLevelDomains=e.topLevelDomains||u.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||u.sift3Distance;var t=function(e){return e},n=e.suggested||t,o=e.empty||t,i=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return i?n(i):o()},suggest:function(e,t,n,o){e=e.toLowerCase();var i=this.splitEmail(e),a=this.findClosestDomain(i.domain,t,o,this.domainThreshold);if(a){if(a!=i.domain)return{address:i.address,domain:a,full:i.address+"@"+a}}else{var r=this.findClosestDomain(i.topLevelDomain,n,o,this.topLevelThreshold);if(i.domain&&r&&r!=i.topLevelDomain){var s=i.domain;return a=s.substring(0,s.lastIndexOf(i.topLevelDomain))+r,{address:i.address,domain:a,full:i.address+"@"+a}}}return!1},findClosestDomain:function(e,t,n,o){o=o||this.topLevelThreshold;var i,a=99,r=null;if(!e||!t)return!1;n||(n=this.sift3Distance);for(var s=0;s<t.length;s++){if(e===t[s])return e;(i=n(e,t[s]))<a&&(a=i,r=t[s])}return a<=o&&null!==r&&r},sift3Distance:function(e,t){if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(var n=0,o=0,i=0,a=0;n+o<e.length&&n+i<t.length;){if(e.charAt(n+o)==t.charAt(n+i))a++;else{o=0,i=0;for(var r=0;r<5;r++){if(n+r<e.length&&e.charAt(n+r)==t.charAt(n)){o=r;break}if(n+r<t.length&&e.charAt(n)==t.charAt(n+r)){i=r;break}}}n++}return(e.length+t.length)/2-a},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(a=0;a<t.length;a++)if(""===t[a])return!1;var n=t.pop(),o=n.split("."),i="";if(0===o.length)return!1;if(1==o.length)i=o[0];else{for(var a=1;a<o.length;a++)i+=o[a]+".";o.length>=2&&(i=i.substring(0,i.length-1))}return{topLevelDomain:i,domain:n,address:t.join("@")}},encodeEmail:function(e){var t=encodeURI(e);return t=t.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return e}(_inbound||{}),_inboundEvents=function(e){function t(t,o,i){var o=o||{};(i=i||{}).bubbles=i.bubbles||!0,i.cancelable=i.cancelable||!0,o=e.apply_filters("filter_"+t,o);!window.ActiveXObject&&window;if("function"==typeof CustomEvent)var a=new CustomEvent(t,{detail:o,bubbles:i.bubbles,cancelable:i.cancelable});else(a=document.createEvent("Event")).initEvent(t,!0,!0);window.dispatchEvent(a),e.do_action(t,o),n(t,o)}function n(e,t){if(window.jQuery){var t=t||{};jQuery(document).trigger(e,t)}}e.trigger=function(t,n){e.Events[t](n)};return e.Events={analytics_ready:function(){t("analytics_ready",{data:"xyxy"},{opt1:!0})},url_parameters:function(e){t("url_parameters",e)},session_start:function(){console.log(""),t("session_start")},session_end:function(e){t("session_end",e),console.log("Session End")},session_active:function(){t("session_active")},session_idle:function(e){t("session_idle",e)},session_resume:function(){t("session_resume")},session_heartbeat:function(e){t("session_heartbeat",{clock:e,leadData:InboundLeadData})},page_visit:function(e){t("page_view",e)},page_first_visit:function(n){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);e.deBugger("pages",status,function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")})},tab_hidden:function(n){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(n){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(n){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){e.deBugger("forms","inputData change. Data=",function(){console.log(n)}),t("form_input_change",n)},form_before_submission:function(e){t("form_before_submission",e)},form_after_submission:function(e){t("form_after_submission",e)},search_before_caching:function(e){t("search_before_caching",e)},analyticsError:function(e,t,n){var o=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(o),console.log("Page Save Error")}},e}(_inbound||{});_inbound.add_action("form_before_submission",inboundFormNoRedirect,10),_inbound.add_action("form_after_submission",inboundFormNoRedirectContent,10);var InboundTotalStorage=function(e){var t,n;if("localStorage"in window)try{n=void 0===window.localStorage?void 0:window.localStorage,t=void 0!==n&&void 0!==window.JSON,window.localStorage.setItem("_inbound","1"),window.localStorage.removeItem("_inbound")}catch(e){t=!1}e.totalStorage=function(t,n,o){return e.totalStorage.impl.init(t,n)},e.totalStorage.setItem=function(t,n){return e.totalStorage.impl.setItem(t,n)},e.totalStorage.getItem=function(t){return e.totalStorage.impl.getItem(t)},e.totalStorage.getAll=function(){return e.totalStorage.impl.getAll()},e.totalStorage.deleteItem=function(t){return e.totalStorage.impl.deleteItem(t)},e.totalStorage.impl={init:function(e,t){return void 0!==t?this.setItem(e,t):this.getItem(e)},setItem:function(o,i){if(!t)try{return e.Utils.createCookie(o,i),i}catch(e){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var a=JSON.stringify(i);return n.setItem(o,a),this.parseResult(a)},getItem:function(o){if(!t)try{return this.parseResult(e.Utils.readCookie(o))}catch(e){return null}var i=n.getItem(o);return this.parseResult(i)},deleteItem:function(o){if(!t)try{return e.Utils.eraseCookie(o,null),!0}catch(e){return!1}return n.removeItem(o),!0},getAll:function(){var o=[];if(t)for(var i in n)i.length&&o.push({key:i,value:this.parseResult(n.getItem(i))});else try{for(var a=document.cookie.split(";"),r=0;r<a.length;r++){var s=a[r].split("=")[0];o.push({key:s,value:this.parseResult(e.Utils.readCookie(s))})}}catch(e){return null}return o},parseResult:function(e){var t;try{void 0===(t=JSON.parse(e))&&(t=e),"true"==t&&(t=!0),"false"==t&&(t=!1),parseFloat(t)==t&&"object"!=typeof t&&(t=parseFloat(t))}catch(n){t=e}return t}}}(_inbound||{}),_inboundLeadsAPI=function(e){return e.LeadsAPI={init:function(){var t=e.Utils,n=(t.readCookie("wp_lead_uid"),t.readCookie("wp_lead_id"));t.readCookie("lead_data_expire")||(e.deBugger("leads","expired vistor. Run Processes"),n&&e.LeadsAPI.getAllLeadData())},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(t){var n=e.Utils.readCookie("wp_lead_id"),o=e.totalStorage("inbound_lead_data"),i=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:n},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var o=new Date;o.setTime(o.getTime()+18e5);var i=e.Utils.addDays(o,3);e.Utils.createCookie("lead_data_expire",!0,i)},o?(e.LeadsAPI.setGlobalLeadData(o),e.deBugger("lead","Set Global Lead Data from Localstorage"),i||(e.Utils.ajaxPost(inbound_settings.admin_url,data,success),e.deBugger("lead","localized data old. Pull new from DB"))):e.Utils.ajaxPost(inbound_settings.admin_url,data,success)},getLeadLists:function(){var t={action:"wpl_check_lists",wp_lead_id:e.Utils.readCookie("wp_lead_id")};e.Utils.ajaxPost(inbound_settings.admin_url,t,function(t){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")})}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,o=!1,i=!1,a=!1,r=parseInt(e.Utils.readCookie("lead_session"),10)||0,s=0,l=(new Date,null),u=null,d=null,c=e.Utils,m=e.Utils.GetDate(),f="page_views",g=e.totalStorage(f)||{},p=inbound_settings.post_id||window.location.pathname,h=e.Settings.timeout||1e4;return e.PageTracking={init:function(o){this.CheckTimeOut(),o=o||{},t=parseInt(o.reportInterval,10)||10,n=parseInt(o.idleTimeout,10)||3,c.addListener(document,"keydown",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(document,"click",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(window,"mousemove",c.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession()},setIdle:function(t){var n="Session IDLE. Activity Timeout due to "+(t=t||"No Movement");e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n;void 0!==document.hidden?(t="hidden",n="visibilitychange"):void 0!==document.mozHidden?(t="mozHidden",n="mozvisibilitychange"):void 0!==document.msHidden?(t="msHidden",n="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",n="webkitvisibilitychange");var o=document[t];e.Utils.addListener(document,n,function(n){o!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),o=document[t])})},clock:function(){var n="Total time spent on Page in this Session: "+((r+=1)/60).toFixed(2)+" min";if(e.deBugger("pages",n),r>0&&r%t==0){var o=new Date;o.setTime(o.getTime()+18e5),c.createCookie("lead_session",r,o),e.trigger("session_heartbeat",r)}},inactiveClock:function(){var t="Time until Session Timeout: "+((1800-(s+=1))/60).toFixed(2)+" min";e.deBugger("pages",t),s>1800&&(e.trigger("session_end",InboundLeadData),e.Utils.eraseCookie("lead_session"),s=0,clearTimeout(u))},stopClock:function(){i=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){i=!1,e.trigger("session_resume"),e.deBugger("pages","Activity resumed. Session Active"),clearTimeout(l),s=0,clearTimeout(u),l=setInterval(e.PageTracking.clock,1e3)},turnOff:function(){e.PageTracking.setIdle(),a=!0},turnOn:function(){a=!1},startSession:function(){new Date;if(o=!0,l=setInterval(e.PageTracking.clock,1e3),c.readCookie("lead_session"))e.trigger("session_active");else{e.trigger("session_start");var t=new Date;t.setTime(t.getTime()+18e5),e.Utils.createCookie("lead_session",1,t)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){a||(o||e.PageTracking.startSession(),i&&e.PageTracking.restartClock(),clearTimeout(d),d=setTimeout(e.PageTracking.setIdle,1e3*n+100),void 0!==t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){if(e.Utils.checkLocalStorage()){var t=localStorage.getItem(f),n=JSON.parse(t);return n}},isRevisit:function(e){var t=!1,n=(e=e||{})[p];return void 0!==n&&null!==n&&(t=!0),t},triggerPageView:function(t){var n={title:document.title,url:document.location.href,path:document.location.pathname,count:1};t?(g[p].push(m),n.count=g[p].length,e.trigger("page_revisit",n)):(g[p]=[],g[p].push(m),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage(f,g),this.storePageView()},CheckTimeOut:function(){var t,n=this.isRevisit(g);if(n){var o=g[p].length-1,i=g[p][o],a=Math.abs(new Date(i).getTime()-new Date(m).getTime());a>h?(t="Timeout Happened. Page view fired",this.triggerPageView(n)):(time_left=.001*Math.abs(h-a),t=h/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(n);e.deBugger("pages",t)},storePageView:function(){var t=!1;"off"==inbound_settings.page_tracking&&"landing-page"!=inbound_settings.post_type||(document.onreadystatechange=function(){"loading"!==document.readyState&&!1===t&&setTimeout(function(){var n=e.Utils.readCookie("wp_lead_id")?e.Utils.readCookie("wp_lead_id"):"",o=e.Utils.readCookie("wp_lead_uid")?e.Utils.readCookie("wp_lead_uid"):"",i=e.totalStorage("wp_cta_loaded"),a=e.totalStorage("wp_cta_impressions");t=!0,e.totalStorage("wp_cta_impressions",{});var r={action:"inbound_track_lead",wp_lead_uid:o,wp_lead_id:n,page_id:inbound_settings.post_id,variation_id:inbound_settings.variation_id,post_type:inbound_settings.post_type,current_url:window.location.href,page_views:JSON.stringify(e.PageTracking.getPageViews()),cta_impressions:JSON.stringify(a),cta_history:JSON.stringify(i),json:"0"};e.Utils.ajaxPost(inbound_settings.admin_url,r,function(e){})},200)})}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
1
/*! Inbound Analyticsv1.0.0 | (c) 2017 Inbound Now | https://github.com/inboundnow/cta */
2
+ function inboundFormNoRedirect(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form,n=t.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])');0!=n.length&&"IA=="!=n[0].value||(t.action="javascript:void(0)")}}function inboundFormNoRedirectContent(){if(null==window.frames.frameElement)e=document.querySelectorAll("button.inbound-button-submit[disabled]")[0];else if("iframe"==window.frames.frameElement.tagName.toLowerCase())var e=window.frames.frameElement.contentWindow.document.querySelectorAll("button.inbound-button-submit")[0];if(void 0!==e){var t=e.form.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),n=jQuery(e).css("background"),o=jQuery(e).css("color"),a=jQuery(e).css("height"),i=e.getElementsByClassName("inbound-form-spinner");0!=t.length&&"IA=="!=t[0].value||(jQuery(i).remove(),jQuery(e).prepend('<div id="redir-check"><i class="fa fa-check-square" aria-hidden="true" style="background='+n+"; color="+o+"; font-size:calc("+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(e,t){},deBugger:function(e,t,n){if(console){var o,a,i,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(i=(r=r.split("-"))[1]),a="true"===_inbound.Utils.readCookie("inbound_debug"),((o="true"===_inbound.Utils.readCookie("inbound_debug_"+e))||s||a)&&(t&&"string"==typeof t&&(a||"all"===i?console.log('logAll "'+e+'" =>',t):o?console.log('log "'+e+'" =>',t):e===i&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},o=n.extend(t,e);return n.Settings=o||{},n}(_inboundOptions),_inboundHooks=function(e){return e.hooks=new function(){function e(e,t,n,o){if(i[e][t])if(n){var a,r=i[e][t];if(o)for(a=r.length;a--;){var s=r[a];s.callback===n&&s.context===o&&r.splice(a,1)}else for(a=r.length;a--;)r[a].callback===n&&r.splice(a,1)}else i[e][t]=[]}function t(e,t,o,a,r){var s={callback:o,priority:a,context:r},l=i[e][t];l?(l.push(s),l=n(l)):l=[s],i[e][t]=l}function n(e){for(var t,n,o,a=1,i=e.length;a<i;a++){for(t=e[a],n=a;(o=e[n-1])&&o.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function o(e,t,n){var o=i[e][t];if(!o)return"filters"===e&&n[0];var a=0,r=o.length;if("filters"===e)for(;a<r;a++)n[0]=o[a].callback.apply(o[a].context,n);else for(;a<r;a++)o[a].callback.apply(o[a].context,n);return"filters"!==e||n[0]}var a={removeFilter:function(t,n){return"string"==typeof t&&e("filters",t,n),a},applyFilters:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?o("filters",t,e):a},addFilter:function(e,n,o,i){return"string"==typeof e&&"function"==typeof n&&t("filters",e,n,o=parseInt(o||10,10)),a},removeAction:function(t,n){return"string"==typeof t&&e("actions",t,n),a},doAction:function(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&o("actions",t,e),a},addAction:function(e,n,o,i){return"string"==typeof e&&"function"==typeof n&&t("actions",e,n,o=parseInt(o||10,10),i),a}},i={actions:{},filters:{}};return a},e.add_action=function(){var t=arguments[0].split(" ");for(k in t)arguments[0]="inbound."+t[k],e.hooks.addAction.apply(this,arguments);return this},e.remove_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeAction.apply(this,arguments),this},e.do_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.doAction.apply(this,arguments),this},e.add_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.addFilter.apply(this,arguments),this},e.remove_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeFilter.apply(this,arguments),this},e.apply_filters=function(){return arguments[0]="inbound."+arguments[0],e.hooks.applyFilters.apply(this,arguments)},e}(_inbound||{}),_inboundUtils=function(e){var t,n=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,o=(Object.prototype.toString,{api_host:("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/#x2F;,""),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}#x2F;i))?host[0]:""});return e.Utils={init:function(){this.polyFills(),this.checkLocalStorage(),this.SetUID(),this.storeReferralData()},polyFills:function(){window.console||(window.console={});for(var e=["log","info","warn","error","debug","trace","dir","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","dirxml","assert","count","markTimeline","timeStamp","clear"],t=0;t<e.length;t++)window.console[e[t]]||(window.console[e[t]]=function(){});Date.prototype.toISOString||function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();try{new CustomEvent("?")}catch(e){this.CustomEvent=function(e,t){function n(t,n,o,a){this["init"+e](t,n,o,a),"detail"in this||(this.detail=a)}return function(o,a){var i=document.createEvent(e);return null!==o?n.call(i,o,(a||(a=t)).bubbles,a.cancelable,a.detail):i.initCustomEvent=n,i}}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),o=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)(t=document._qsa.shift()).style.removeAttribute("x-qsa"),o.push(t);return document._qsa=null,o}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var e,t=window.getSelection(),n=[],o=0;o<t.rangeCount;o++)n[o]=t.getRangeAt(o);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(o=0;o<n.length;o++)t.addRange(n[o]);return e})},createCookie:function(e,t,n){var o="";if(n){var a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3),o="; expires="+a.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 a=n[o];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t))return a.substring(t.length,a.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 a=n[o].split("=");a[0]=a[0].replace(/^ /,""),t[decodeURIComponent(a[0])]=decodeURIComponent(a[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),a=/([^&=]+)=?([^&]*)/g;e=a.exec(o);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var i=e[1].indexOf("["),r=e[1].slice(i+1,e[1].indexOf("]",i)),s=t(e[1].slice(0,i));"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 a in n[o])this.createCookie(a,n[o][a],30);else this.createCookie(o,n[o],30);if(t){var i=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(i,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){n={};if(t)var n=e.totalStorage("inbound_url_params");return n},getParameterVal:function(e,t){return(RegExp(e+"=(.+?)(&|$)").exec(t)||[,!1])[1]},checkLocalStorage:function(){if("localStorage"in window)try{ls=void 0===window.localStorage?void 0:window.localStorage,t="undefined"!=typeof ls&&void 0!==window.JSON}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}var n=Object.keys(localStorage).map(function(t){return{name:t,size:e(localStorage[t])}}).map(function(e){return e.size=t(e.size).toFixed(2)+" MB",e});console.table(n)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=t<10?"0":"",o=e.getFullYear(),a=e.getHours(),i=a<10?"0":"",r=e.getMinutes(),s=r<10?"0":"",l=e.getSeconds(),u=l<10?"0":"",d=e.getMonth()+1;return o+"/"+(d<10?"0":"")+d+"/"+n+t+" "+i+a+":"+s+r+":"+u+l},SetSessionTimeout:function(){this.readCookie("lead_session_expire");var e=new Date;e.setTime(e.getTime()+18e5),this.createCookie("lead_session_expire",!0,e)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",o=e.Utils.readCookie("inbound_referral_site"),a=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),o||this.createCookie("inbound_referral_site",n,t),a||e.totalStorage("inbound_original_referral",a)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n},generateGUID:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,guid)},SetUID:function(e){if(!this.readCookie("wp_lead_uid")){var t=e||this.CreateUID(35);this.createCookie("wp_lead_uid",t)}},countProperties:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&++t;return t},mergeObjs:function(e,t){var n={};for(var o in e)n[o]=e[o];for(var o in t)n[o]=t[o];return n},hasClass:function(e,t){if("classList"in document.documentElement)n=t.classList.contains(e);else var n=new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className);return n},addClass:function(e,t){"classList"in document.documentElement?t.classList.add(e):this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)},removeClass:function(e,t){"classList"in document.documentElement?t.classList.remove(e):this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)*"+e+"(\\s|$)*","g"),""))},removeElement:function(e){e.parentNode.removeChild(e)},trim:function(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,"\n")},ajaxPolyFill:function(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(var e,t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(e){}return e},ajaxSendData:function(e,t,n,o,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(o)},100)},ajaxGet:function(e,t,n,o){var a=[];for(var i in t)a.push(encodeURIComponent(i)+"="+encodeURIComponent(t[i]));this.ajaxSendData(e+"?"+a.join("&"),n,"GET",null,o)},ajaxPost:function(e,t,n,o){var a=[];for(var i in t)a.push(encodeURIComponent(i)+"="+encodeURIComponent(t[i]));this.ajaxSendData(e,n,"POST",a.join("&"),o)},sendEvent:function(e,t,a){t=t||{},async=!0;var i=getCookie();if(i){var r;for(r in i)t[r]=i[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=o.api_host+"/track?data="+encodeURIComponent(JSON.stringify(s));if(n){var u=new XMLHttpRequest;u.open("GET",l,async),u.withCredentials=async,u.send(null)}else{var d=document.createElement("script");d.type="text/javascript",d.async=async,d.defer=async,d.src=l;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(d,c)}return action(a),self},domReady:function(e,t){var n=!1,o=!0,a=e.document,i=a.documentElement,r=a.addEventListener?"addEventListener":"attachEvent",s=a.addEventListener?"removeEventListener":"detachEvent",l=a.addEventListener?"":"on",u=function(o){"readystatechange"==o.type&&"complete"!=a.readyState||(("load"==o.type?e:a)[s](l+o.type,u,!1),!n&&(n=!0)&&t.call(e,o.type||o))},d=function(){try{i.doScroll("left")}catch(e){return void setTimeout(d,50)}u("poll")};if("complete"==a.readyState)t.call(e,"lazy");else{if(a.createEventObject&&i.doScroll){try{o=!e.frameElement}catch(e){}o&&d()}a[r](l+"DOMContentLoaded",u,!1),a[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,a,i=null,r=0,s=function(){r=new Date,i=null,a=e.apply(n,o)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,o=arguments,u<=0?(clearTimeout(i),i=null,r=l,a=e.apply(n,o)):i||(i=setTimeout(s,u)),a}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),void 0!==_gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)},cacheSearchData:function(n,o){if(t){var a=e.totalStorage.getItem("inbound_search_storage");if(a)a.unshift(n),e.totalStorage.setItem("inbound_search_storage",a);else{var i=[n];e.totalStorage.setItem("inbound_search_storage",i)}}else{var r=JSON.stringify(n),s=this.readCookie("inbound_search_storage");s&&(r+="SPLIT-TOKEN"+s),this.createCookie("inbound_search_storage",r,"180")}e.Forms.releaseFormSubmit(o)},storeSearchData:function(){if(inbound_settings.wp_lead_data.lead_id&&inbound_settings.wp_lead_data.lead_nonce){var t=[],n=e.totalStorage.getItem("inbound_search_storage"),o=this.readCookie("inbound_search_storage");if(n||o){if(o){o=o.split("SPLIT-TOKEN");for(var a in o)t.push(JSON.parse(o[a]))}n&&(t=t.concat(n)),t.sort(function(e,t){return e.timestamp-t.timestamp});var i={action:"inbound_search_store",data:t=encodeURIComponent(JSON.stringify(t)),nonce:inbound_settings.wp_lead_data.lead_nonce,lead_id:inbound_settings.wp_lead_data.lead_id};callback=function(t){t&&(t=JSON.parse(t)),t.success&&(console.log(t.success),e.Utils.eraseCookie("inbound_search_storage"),e.totalStorage.deleteItem("inbound_search_storage")),t.error&&console.log(t.error)},this.ajaxPost(inbound_settings.admin_url,i,callback)}}}},e}(_inbound||{}),InboundForms=function(e){var t=e.Utils,n=[],o=[],a=[],r={},s=e.Settings,l=["first name","last name","name","email","e-mail","phone","website","job title","your favorite food","company","tele","address","comment"];if(e.Forms={init:function(){e.Forms.runFieldMappingFilters(),e.Forms.formTrackInit(),e.Forms.searchTrackInit()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,t){return},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=window.document.forms[e];t.dataset.formProcessed||(t.dataset.formProcessed=!0,this.checkTrackStatus(t)&&(this.attachFormSubmitEvent(t),this.initFormMapping(t)))}},searchTrackInit:function(){if("off"!=inbound_settings.search_tracking&&!r.searchTrackInit){for(var e=0;e<window.document.forms.length;e++){var n=window.document.forms[e];n.dataset.searchChecked||(n.dataset.searchChecked=!0,this.checkSearchTrackStatus(n)&&this.attachSearchFormSubmitEvent(n))}t.storeSearchData(),r.searchTrackInit=!0}},checkTrackStatus:function(t){var n=t.getAttribute("class");if(""!==n&&null!==n)return n.toLowerCase().indexOf("wpl-track-me")>-1||(n.toLowerCase().indexOf("inbound-track")>-1||(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1))},checkSearchTrackStatus:function(t){var n=t.getAttribute("class"),o=t.getAttribute("id");return""!==n&&null!==n&&n.toLowerCase().indexOf("search")>-1||(""===o||null===o?(cb=function(){console.log(t)},e.deBugger("searches","This search form is not tracked. Please assign on in settings...",cb),!1):o.toLowerCase().indexOf("search")>-1||void 0)},loopClassSelectors:function(n,o){for(var a=n.length-1;a>=0;a--){var i=t.trim(n[a]);-1===i.indexOf("#")&&-1===i.indexOf(".")&&(i="#"+i),(i=document.querySelector(i))&&("add"===o?(e.Utils.addClass("wpl-track-me",i),e.Utils.addClass("inbound-track",i)):(e.Utils.removeClass("wpl-track-me",i),e.Utils.removeClass("inbound-track",i)))}},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 a=n.length-1;a>=0;a--)formInput=n[a],this.mapField(formInput)},mapField:function(o){var a=o.id||!1,r=o.name||!1,s=this.getInputLabel(o);if(s&&this.ignoreFieldByLabel(s[0].innerText))return o.dataset.ignoreFormField=!0,!1;for(i=0;i<l.length;i++){var u=!1,d=l[i],c=t.trim(d),m=c.replace(/ /g,"_");r&&r.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching name attribute for -> "+c)):a&&a.toLowerCase().indexOf(c)>-1?(u=!0,e.deBugger("forms","Found matching ID attribute for ->"+c)):s?s[0].innerText.toLowerCase().indexOf(c)>-1&&(u=!0,e.deBugger("forms","Found matching sibling label for -> "+c)):n.push(c),u&&(this.addDataAttr(o,m),this.removeArrayItem(l,c),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},searchFormListener:function(t){t.preventDefault(),e.Forms.saveSearchData(t.target)},attachFormSubmitEvent:function(e){t.addListener(e,"submit",this.formListener);document.querySelector(".inbound-email")},attachSearchFormSubmitEvent:function(e){t.addListener(e,"submit",this.searchFormListener)},ignoreFieldByLabel:function(t){var n=!1;return!!t&&(-1==t.toLowerCase().indexOf("credit card")&&-1==t.toLowerCase().indexOf("card number")||(n=!0),-1==t.toLowerCase().indexOf("expiration")&&-1==t.toLowerCase().indexOf("expiry")||(n=!0),"month"!=t.toLowerCase()&&"mm"!=t.toLowerCase()&&"yy"!=t.toLowerCase()&&"yyyy"!=t.toLowerCase()&&"year"!=t.toLowerCase()||(n=!0),-1==t.toLowerCase().indexOf("cvv")&&-1==t.toLowerCase().indexOf("cvc")&&-1==t.toLowerCase().indexOf("secure code")&&-1==t.toLowerCase().indexOf("security code")||(n=!0),n&&e.deBugger("forms","ignore "+t),n)},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;if("visa"!=e.toLowerCase()&&"mastercard"!=e.toLowerCase()&&"american express"!=e.toLowerCase()&&"amex"!=e.toLowerCase()&&"discover"!=e.toLowerCase()||(t=!0),new RegExp("/^[0-9]+#x2F;").test(e)){var n=e.replace(" ","");this.isInt(n)&&n.length>=16&&(t=!0)}return t},isInt:function(e){return"number"==typeof e&&isFinite(e)&&e%1==0},releaseFormSubmit:function(e){document.body.style.cursor="default",t.removeClass("wpl-track-me",e),t.removeListener(e,"submit",this.formListener);var n=e.getAttribute("class");if(""!==n&&null!==n&&-1!=n.toLowerCase().indexOf("wpcf7-form"))return setTimeout(function(){document.body.style.cursor="default"},300),!0;e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&"submit"===formInput.name&&e.elements[t].click()},2e3)},saveFormData:function(n){for(var i=i||{},r=0;r<n.elements.length;r++)if(formInput=n.elements[r],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),i[inputName]||(i[inputName]={}),formInput.type&&(i[inputName].type=formInput.type),i[inputName].name||(i[inputName].name=formInput.name),formInput.dataset.mapFormField&&(i[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(l=this.getInputValue(formInput)))continue;break;case"TEXTAREA":l=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var s=0;s<formInput.length;s++)formInput[s].selected&&values.push(encodeURIComponent(formInput[s].value))}else l=formInput.value}if(e.deBugger("forms","Input Value = "+l),l){i[inputName].value||(i[inputName].value=[]),i[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",i);for(var u in i){var d=i[u].value,c=i[u].map;if(void 0!==d&&null!=d&&""!=d&&o.push(u+"="+i[u].value.join(",")),void 0!==c&&null!=c&&i[u].value&&(a.push(c+"="+i[u].value.join(",")),"email"===u))var m=i[u].value.join(",")}var f=o.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=a.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g),(m=t.getParameterVal("email",g)||t.readCookie("wp_lead_email"))||(m=t.getParameterVal("wpleads_email_address",g));var p=t.getParameterVal("name",g),h=t.getParameterVal("first_name",g),v=t.getParameterVal("last_name",g);if(!v&&h&&(_=decodeURI(h).split(" ")).length>0&&(h=_[0],v=_[1]),p&&!v&&!h){var _=decodeURI(p).split(" ");_.length>0&&(h=_[0],v=_[1])}p=h&&v?h+" "+v:p,h||(h=""),v||(v=""),e.deBugger("forms","fName = "+h),e.deBugger("forms","lName = "+v),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{},w=n.querySelectorAll('input[value][type="hidden"][name="inbound_furl"]:not([value=""])'),k=!1;if(0==w.length||"IA=="==w[0].value)k=!0;var S=n.querySelectorAll('input[value][type="hidden"][name="inbound_form_id"]');S=S.length>0?S[0].value:0;if("undefined"!=typeof landing_path_info)C=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)C=cta_path_info.variation;else var C=inbound_settings.variation_id;var I=inbound_settings.post_type||"page",L=inbound_settings.post_id||0;search_data={},formData={action:"inbound_lead_store",email:m,full_name:p,first_name:h,last_name:v,raw_params:f,mapped_params:g,url_params:JSON.stringify(y),search_data:"test",page_views:JSON.stringify(b),post_type:I,page_id:L,variation:C,source:t.readCookie("inbound_referral_site"),inbound_submitted:k,inbound_form_id:S,inbound_nonce:inbound_settings.ajax_nonce,event:n},callback=function(o){e.deBugger("forms","Lead Created with ID: "+o),o=parseInt(o,10),formData.leadID=o,o&&(t.createCookie("wp_lead_id",o),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(n)},e.trigger("form_before_submission",formData),t.ajaxPost(inbound_settings.admin_url,formData,callback)},saveSearchData:function(n){for(var o=o||{},a=0;a<n.elements.length;a++)if(formInput=n.elements[a],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("searches","ignore "+formInput.name);continue}switch(c=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),o[c]||(o[c]={}),formInput.type&&(o[c].type=formInput.type),o[c].name||(o[c].name=formInput.name),formInput.dataset.mapFormField&&(o[c].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(!1===(r=this.getInputValue(formInput)))continue;break;case"TEXTAREA":r=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var i=0;i<formInput.length;i++)formInput[i].selected&&values.push(encodeURIComponent(formInput[i].value))}else r=formInput.value}if(e.deBugger("searches","Input Value = "+r),r){o[c].value||(o[c].value=[]),o[c].value.push(multiple?values.join(","):encodeURIComponent(r));var r=multiple?values.join(","):encodeURIComponent(r)}}e.deBugger("searches",o);var s=[];for(var l in o){var u=o[l].value,d=o[l].type,c=o[l].name;void 0!==u&&null!=u&&""!=u&&("search"==d?s.push("search_text|value|"+o[l].value):"s"==c&&s.push("search_text|value|"+o[l].value))}s[0]||e.Forms.releaseFormSubmit(n);var m=s.join("|field|");if(e.deBugger("searches","Stringified Search Form PARAMS: "+m),"undefined"!=typeof landing_path_info)f=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)f=cta_path_info.variation;else var f=inbound_settings.variation_id;var g=inbound_settings.post_type||"page",p=inbound_settings.post_id||0,h=t.readCookie("wp_lead_uid");inbound_settings.wp_lead_data.lead_email?email=inbound_settings.wp_lead_data.lead_email:t.readCookie("inbound_wpleads_email_address")?email=t.readCookie("inbound_wpleads_email_address"):email="",searchData={email:email,search_data:m,user_UID:h,post_type:g,page_id:p,variation:f,source:t.readCookie("inbound_referral_site"),ip_address:inbound_settings.ip_address,timestamp:Math.floor((new Date).getTime()/1e3)},e.trigger("search_before_caching",searchData),inbound_settings.wp_lead_data.lead_id?(searchData.lead_id=inbound_settings.wp_lead_data.lead_id,t.cacheSearchData(searchData,n)):t.cacheSearchData(searchData,n)},rememberInputValues:function(n){n.name&&n.name;var o=n.type?n.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o||n.dataset.ignoreFormField)return!1;t.addListener(n,"change",function(n){if(n.target.name){if("checkbox"!==o)var a=n.target.value;else for(var i=[],r=document.querySelectorAll('input[name="'+n.target.name+'"]'),s=0;s<r.length;s++)r[s].checked&&i.push(r[s].value),a=i.join(",");inputData={name:n.target.name,node:n.target.nodeName.toLowerCase(),type:o,value:a,mapping:n.target.dataset.mapFormField},e.trigger("form_input_change",inputData),t.createCookie("inbound_"+n.target.name,encodeURIComponent(a))}})},fillInputValues:function(e){var n=e.name?"inbound_"+e.name:"",o=e.type?e.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o)return!1;if(t.readCookie(n)&&"comment"!=n)if(value=decodeURIComponent(t.readCookie(n)),"checkbox"===o||"radio"===o)for(var a=value.split(","),i=0;i<a.length;i++)e.value.indexOf(a[i])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},getInputLabel:function(e){var t;return(t=this.siblingsIsLabel(e))?t:!!(t=this.CheckParentForLabel(e))&&t},getInputValue:function(e){var t=!1;switch(e.type){case"radio":case"checkbox":e.checked&&(t=e.value);break;case"text":case"hidden":default:t=e.value}return t},addDataAttr:function(e,t){for(var n=document.getElementsByName(e.name),o=n.length-1;o>=0;o--)e.dataset.mapFormField||(n[o].dataset.mapFormField=t)},removeArrayItem:function(e,t){if(e.indexOf)index=e.indexOf(t);else for(index=e.length-1;index>=0&&e[index]!==t;--index);index>=0&&e.splice(index,1)},siblingsIsLabel:function(e){for(var t=this.getSiblings(e),n=[],o=t.length-1;o>=0;o--)"label"===t[o].nodeName.toLowerCase()&&n.push(t[o]);return n.length>0&&n.length<2&&n},getChildren:function(e,t){for(var n=[];e;e=e.nextSibling)1==e.nodeType&&e!=t&&n.push(e);return n},getSiblings:function(e){return this.getChildren(e.parentNode.firstChild,e)},CheckParentForLabel:function(e){if("FORM"===e.nodeName)return null;do{var t=e.getElementsByTagName("label");if(t.length>0&&t.length<2)return e.getElementsByTagName("label")}while(e=e.parentNode);return null},mailCheck:function(){var e=document.querySelector(".inbound-email");e&&(t.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(n){var o=document.querySelector(".email_suggestion");o&&t.removeElement(o);var a=document.createElement("span");a.innerHTML="<span class=\"email_suggestion\">Did youu mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+n.full+"</b></i>?</span>",e.parentNode.insertBefore(a,e.nextSibling);var i=document.getElementById("email_correction");t.addListener(i,"click",function(){e.value=i.innerHTML,i.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},void 0===u)var u={domainThreshold:1,topLevelThreshold:3,defaultDomains:["yahoo.com","google.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","mail.com","outlook.com","icloud.com"],defaultTopLevelDomains:["co.jp","co.uk","com","net","org","info","edu","gov","mil","ca","de"],run:function(e){e.domains=e.domains||u.defaultDomains,e.topLevelDomains=e.topLevelDomains||u.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||u.sift3Distance;var t=function(e){return e},n=e.suggested||t,o=e.empty||t,a=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return a?n(a):o()},suggest:function(e,t,n,o){e=e.toLowerCase();var a=this.splitEmail(e),i=this.findClosestDomain(a.domain,t,o,this.domainThreshold);if(i){if(i!=a.domain)return{address:a.address,domain:i,full:a.address+"@"+i}}else{var r=this.findClosestDomain(a.topLevelDomain,n,o,this.topLevelThreshold);if(a.domain&&r&&r!=a.topLevelDomain){var s=a.domain;return i=s.substring(0,s.lastIndexOf(a.topLevelDomain))+r,{address:a.address,domain:i,full:a.address+"@"+i}}}return!1},findClosestDomain:function(e,t,n,o){o=o||this.topLevelThreshold;var a,i=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;(a=n(e,t[s]))<i&&(i=a,r=t[s])}return i<=o&&null!==r&&r},sift3Distance:function(e,t){if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(var n=0,o=0,a=0,i=0;n+o<e.length&&n+a<t.length;){if(e.charAt(n+o)==t.charAt(n+a))i++;else{o=0,a=0;for(var r=0;r<5;r++){if(n+r<e.length&&e.charAt(n+r)==t.charAt(n)){o=r;break}if(n+r<t.length&&e.charAt(n)==t.charAt(n+r)){a=r;break}}}n++}return(e.length+t.length)/2-i},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(i=0;i<t.length;i++)if(""===t[i])return!1;var n=t.pop(),o=n.split("."),a="";if(0===o.length)return!1;if(1==o.length)a=o[0];else{for(var i=1;i<o.length;i++)a+=o[i]+".";o.length>=2&&(a=a.substring(0,a.length-1))}return{topLevelDomain:a,domain:n,address:t.join("@")}},encodeEmail:function(e){var t=encodeURI(e);return t=t.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return e}(_inbound||{}),_inboundEvents=function(e){function t(t,o,a){var o=o||{};(a=a||{}).bubbles=a.bubbles||!0,a.cancelable=a.cancelable||!0,o=e.apply_filters("filter_"+t,o);!window.ActiveXObject&&window;if("function"==typeof CustomEvent)var i=new CustomEvent(t,{detail:o,bubbles:a.bubbles,cancelable:a.cancelable});else(i=document.createEvent("Event")).initEvent(t,!0,!0);window.dispatchEvent(i),e.do_action(t,o),n(t,o)}function n(e,t){if(window.jQuery){var t=t||{};jQuery(document).trigger(e,t)}}e.trigger=function(t,n){e.Events[t](n)};return e.Events={analytics_ready:function(){t("analytics_ready",{data:"xyxy"},{opt1:!0})},url_parameters:function(e){t("url_parameters",e)},session_start:function(){console.log(""),t("session_start")},session_end:function(e){t("session_end",e),console.log("Session End")},session_active:function(){t("session_active")},session_idle:function(e){t("session_idle",e)},session_resume:function(){t("session_resume")},session_heartbeat:function(e){t("session_heartbeat",{clock:e,leadData:InboundLeadData})},page_visit:function(e){t("page_view",e)},page_first_visit:function(n){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);e.deBugger("pages",status,function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")})},tab_hidden:function(n){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(n){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(n){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){e.deBugger("forms","inputData change. Data=",function(){console.log(n)}),t("form_input_change",n)},form_before_submission:function(e){t("form_before_submission",e)},form_after_submission:function(e){t("form_after_submission",e)},search_before_caching:function(e){t("search_before_caching",e)},analyticsError:function(e,t,n){var o=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(o),console.log("Page Save Error")}},e}(_inbound||{});_inbound.add_action("form_before_submission",inboundFormNoRedirect,10),_inbound.add_action("form_after_submission",inboundFormNoRedirectContent,10);var InboundTotalStorage=function(e){var t,n;if("localStorage"in window)try{n=void 0===window.localStorage?void 0:window.localStorage,t=void 0!==n&&void 0!==window.JSON,window.localStorage.setItem("_inbound","1"),window.localStorage.removeItem("_inbound")}catch(e){t=!1}e.totalStorage=function(t,n,o){return e.totalStorage.impl.init(t,n)},e.totalStorage.setItem=function(t,n){return e.totalStorage.impl.setItem(t,n)},e.totalStorage.getItem=function(t){return e.totalStorage.impl.getItem(t)},e.totalStorage.getAll=function(){return e.totalStorage.impl.getAll()},e.totalStorage.deleteItem=function(t){return e.totalStorage.impl.deleteItem(t)},e.totalStorage.impl={init:function(e,t){return void 0!==t?this.setItem(e,t):this.getItem(e)},setItem:function(o,a){if(!t)try{return e.Utils.createCookie(o,a),a}catch(e){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var i=JSON.stringify(a);return n.setItem(o,i),this.parseResult(i)},getItem:function(o){if(!t)try{return this.parseResult(e.Utils.readCookie(o))}catch(e){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(e){return!1}return n.removeItem(o),!0},getAll:function(){var o=[];if(t)for(var a in n)a.length&&o.push({key:a,value:this.parseResult(n.getItem(a))});else try{for(var i=document.cookie.split(";"),r=0;r<i.length;r++){var s=i[r].split("=")[0];o.push({key:s,value:this.parseResult(e.Utils.readCookie(s))})}}catch(e){return null}return o},parseResult:function(e){var t;try{void 0===(t=JSON.parse(e))&&(t=e),"true"==t&&(t=!0),"false"==t&&(t=!1),parseFloat(t)==t&&"object"!=typeof t&&(t=parseFloat(t))}catch(n){t=e}return t}}}(_inbound||{}),_inboundLeadsAPI=function(e){return e.LeadsAPI={init:function(){var t=e.Utils,n=(t.readCookie("wp_lead_uid"),t.readCookie("wp_lead_id"));t.readCookie("lead_data_expire")||(e.deBugger("leads","expired vistor. Run Processes"),n&&e.LeadsAPI.getAllLeadData())},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(t){var n=e.Utils.readCookie("wp_lead_id"),o=e.totalStorage("inbound_lead_data"),a=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:n},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var o=new Date;o.setTime(o.getTime()+18e5);var a=e.Utils.addDays(o,3);e.Utils.createCookie("lead_data_expire",!0,a)},o?(e.LeadsAPI.setGlobalLeadData(o),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={action:"wpl_check_lists",wp_lead_id:e.Utils.readCookie("wp_lead_id")};e.Utils.ajaxPost(inbound_settings.admin_url,t,function(t){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")})}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,o=!1,a=!1,i=!1,r=parseInt(e.Utils.readCookie("lead_session"),10)||0,s=0,l=(new Date,null),u=null,d=null,c=e.Utils,m=e.Utils.GetDate(),f="page_views",g=e.totalStorage(f)||{},p=inbound_settings.post_id||window.location.pathname,h=e.Settings.timeout||1e4;return e.PageTracking={init:function(o){this.CheckTimeOut(),o=o||{},t=parseInt(o.reportInterval,10)||10,n=parseInt(o.idleTimeout,10)||3,c.addListener(document,"keydown",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(document,"click",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(window,"mousemove",c.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession()},setIdle:function(t){var n="Session IDLE. Activity Timeout due to "+(t=t||"No Movement");e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n;void 0!==document.hidden?(t="hidden",n="visibilitychange"):void 0!==document.mozHidden?(t="mozHidden",n="mozvisibilitychange"):void 0!==document.msHidden?(t="msHidden",n="msvisibilitychange"):void 0!==document.webkitHidden&&(t="webkitHidden",n="webkitvisibilitychange");var o=document[t];e.Utils.addListener(document,n,function(n){o!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),o=document[t])})},clock:function(){var n="Total time spent on Page in this Session: "+((r+=1)/60).toFixed(2)+" min";if(e.deBugger("pages",n),r>0&&r%t==0){var o=new Date;o.setTime(o.getTime()+18e5),c.createCookie("lead_session",r,o),e.trigger("session_heartbeat",r)}},inactiveClock:function(){var t="Time until Session Timeout: "+((1800-(s+=1))/60).toFixed(2)+" min";e.deBugger("pages",t),s>1800&&(e.trigger("session_end",InboundLeadData),e.Utils.eraseCookie("lead_session"),s=0,clearTimeout(u))},stopClock:function(){a=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){a=!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(),i=!0},turnOn:function(){i=!1},startSession:function(){new Date;if(o=!0,l=setInterval(e.PageTracking.clock,1e3),c.readCookie("lead_session"))e.trigger("session_active");else{e.trigger("session_start");var t=new Date;t.setTime(t.getTime()+18e5),e.Utils.createCookie("lead_session",1,t)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){i||(o||e.PageTracking.startSession(),a&&e.PageTracking.restartClock(),clearTimeout(d),d=setTimeout(e.PageTracking.setIdle,1e3*n+100),void 0!==t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){if(e.Utils.checkLocalStorage()){var t=localStorage.getItem(f),n=JSON.parse(t);return n}},isRevisit:function(e){var t=!1,n=(e=e||{})[p];return void 0!==n&&null!==n&&(t=!0),t},triggerPageView:function(t){var n={title:document.title,url:document.location.href,path:document.location.pathname,count:1};t?(g[p].push(m),n.count=g[p].length,e.trigger("page_revisit",n)):(g[p]=[],g[p].push(m),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage(f,g);document.onreadystatechange=function(){"loading"!==document.readyState&&e.PageTracking.storePageView()}},CheckTimeOut:function(){var t,n=this.isRevisit(g);if(n){var o=g[p].length-1,a=g[p][o],i=Math.abs(new Date(a).getTime()-new Date(m).getTime());i>h?(t="Timeout Happened. Page view fired",this.triggerPageView(n)):(time_left=.001*Math.abs(h-i),t=h/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(n);e.deBugger("pages",t)},storePageView:function(){"off"==inbound_settings.page_tracking&&"landing-page"!=inbound_settings.post_type||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"):"",o=e.totalStorage("wp_cta_loaded"),a=e.totalStorage("wp_cta_impressions");stored=!0,e.totalStorage("wp_cta_impressions",{});var i={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(a),cta_history:JSON.stringify(o),json:"0"};e.Utils.ajaxPost(inbound_settings.admin_url,i,function(e){})},200)}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
shared/classes/class.ajax.php CHANGED
@@ -76,8 +76,14 @@ if (!class_exists('Inbound_Ajax')) {
76
/* record CTA impressions */
77
$cta_impressions = ( isset($_POST['cta_impressions']) ) ? json_decode(stripslashes($_POST['cta_impressions']),true) : array();
78
79
foreach ( $cta_impressions as $cta_id => $vid ) {
80
- do_action('wp_cta_record_impression', (int) $cta_id, (int) $vid );
81
}
82
83
/* update content data */
@@ -151,4 +157,4 @@ if (!class_exists('Inbound_Ajax')) {
151
152
/* Loads Inbound_Ajax pre init */
153
$Inbound_Ajax = new Inbound_Ajax();
154
- }
76
/* record CTA impressions */
77
$cta_impressions = ( isset($_POST['cta_impressions']) ) ? json_decode(stripslashes($_POST['cta_impressions']),true) : array();
78
79
+ if (!is_array($cta_impressions)) {
80
+ error_log('Bad CTA Impression Object');
81
+ return;
82
+ }
83
foreach ( $cta_impressions as $cta_id => $vid ) {
84
+ $lead_data['cta_id'] = (int) $cta_id;
85
+ $lead_data['variation_id'] = (int) $vid;
86
+ do_action('wp_cta_record_impression', $lead_data );
87
}
88
89
/* update content data */
157
158
/* Loads Inbound_Ajax pre init */
159
$Inbound_Ajax = new Inbound_Ajax();
160
+ }
shared/classes/class.database-routines.php CHANGED
@@ -41,8 +41,8 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
41
self::$routines['page-views-table-1'] = array(
42
'id' => 'page-views-table-1',
43
'scope' => 'shared',
44
- 'introduced' => '1.0.2',
45
- 'callback' => array( __CLASS__ , 'alter_page_views_table_1')
46
);
47
48
/* alter page view table */
@@ -154,7 +154,7 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
154
* Alter pageview table from INT to VARCHARR
155
* @param $routines
156
*/
157
- public static function alter_page_views_table_1() {
158
global $wpdb;
159
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
160
@@ -170,6 +170,12 @@ if ( !class_exists('Inbound_Upgrade_Routines') ) {
170
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `ip` VARCHAR(45)" );
171
}
172
173
}
174
175
/**
41
self::$routines['page-views-table-1'] = array(
42
'id' => 'page-views-table-1',
43
'scope' => 'shared',
44
+ 'introduced' => '2.0.2',
45
+ 'callback' => array( __CLASS__ , 'alter_page_views_table')
46
);
47
48
/* alter page view table */
154
* Alter pageview table from INT to VARCHARR
155
* @param $routines
156
*/
157
+ public static function alter_page_views_table() {
158
global $wpdb;
159
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
160
170
$wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `ip` VARCHAR(45)" );
171
}
172
173
+ if(!isset($col_check->cta_id)) {
174
+ $wpdb->get_results("ALTER TABLE {$table_name} ADD `cta_id` VARCHAR(20) NOT NULL");
175
+ } else {
176
+ $wpdb->get_results( "ALTER TABLE {$table_name} MODIFY COLUMN `cta_id` VARCHAR(20)" );
177
+ }
178
+
179
}
180
181
/**
shared/classes/class.events.php CHANGED
@@ -111,6 +111,7 @@ class Inbound_Events {
111
$sql = "CREATE TABLE IF NOT EXISTS $table_name (
112
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
113
`page_id` varchar(20) NOT NULL,
114
`variation_id` mediumint(9) NOT NULL,
115
`lead_id` mediumint(20) NOT NULL,
116
`lead_uid` varchar(255) NOT NULL,
@@ -404,6 +405,7 @@ class Inbound_Events {
404
$defaults = array(
405
'page_id' => '',
406
'variation_id' => '',
407
'lead_id' => ( isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : '' ),
408
'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
409
'session_id' => ( isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : session_id() ),
@@ -748,6 +750,9 @@ class Inbound_Events {
748
case 'page_id':
749
$query .=' `page_id` = "'.$params['page_id'].'" ';
750
break;
751
case 'mixed':
752
if (isset($params['lead_id']) && $params['lead_id'] ) {
753
$queries[] = ' `lead_id` = "'.$params['lead_id'].'" ';
@@ -798,12 +803,37 @@ class Inbound_Events {
798
$params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
799
800
$table_name = $wpdb->prefix . "inbound_page_views";
801
802
- $query = 'SELECT *, count(*) as impressions, count(date(datetime)) as impressions_per_day, date(datetime) as date FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
803
804
805
if (isset($params['source']) && $params['source'] ) {
806
- $query .= ' AND source = "'.$params['source'].'" ';
807
}
808
809
$query .=' AND `page_id` != "0" ';
@@ -897,7 +927,15 @@ class Inbound_Events {
897
$params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
898
899
$table_name = $wpdb->prefix . "inbound_page_views";
900
- $query = 'SELECT *, count('.$params['group_by'].') as count FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
901
902
if (isset($params['source']) && $params['source'] ) {
903
$query .= ' AND source = "'.$params['source'].'" ';
@@ -935,8 +973,15 @@ class Inbound_Events {
935
$table_name = $wpdb->prefix . "inbound_page_views";
936
$query = 'SELECT count(date(datetime)) as visits_per_day, date(datetime) as date , sum(visits) as visitors FROM ( ';
937
938
- $query .= ' SELECT *, count('.$params['group_by'].') as visits FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
939
940
941
if (isset($params['source']) && $params['source'] ) {
942
$query .= ' AND source = "'.$params['source'].'" ';
@@ -966,7 +1011,15 @@ class Inbound_Events {
966
$table_name = $wpdb->prefix . "inbound_page_views";
967
$query = 'SELECT * , count(source) as visitors, sum(page_views) as page_views_total FROM ( ';
968
969
- $query .= ' SELECT *, count(lead_uid) as page_views FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
970
971
if (isset($params['source']) && $params['source'] ) {
972
$query .= ' AND source = "'.$params['source'].'" ';
@@ -1015,7 +1068,18 @@ class Inbound_Events {
1015
}
1016
1017
if (isset($params['event_name']) && $params['event_name'] ) {
1018
- $query .= ' AND event_name = "'.$params['event_name'].'" ';
1019
}
1020
1021
if (isset($params['source']) && $params['source'] ) {
@@ -1026,6 +1090,14 @@ class Inbound_Events {
1026
$query .= ' AND lead_id = "'.$params['lead_id'].'" ';
1027
}
1028
1029
if (isset($params['start_date']) && $params['start_date']) {
1030
$query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
1031
}
@@ -1065,7 +1137,7 @@ class Inbound_Events {
1065
case 'inbound_content_click':
1066
return ($plural) ? __('Content Clicks' , 'inbound-pro') : __('Content Click' , 'inbound-pro');
1067
break;
1068
- case 'inbound_direct_messege':
1069
return ($plural) ? __('Direct Messages' , 'inbound-pro') : __('Direct Message' , 'inbound-pro');
1070
break;
1071
case 'inbound_list_add':
@@ -1135,20 +1207,28 @@ class Inbound_Events {
1135
$table_name = $wpdb->prefix . "inbound_events";
1136
$query = 'SELECT date(datetime) as date , sum(events) as events_count FROM ( ';
1137
1138
- $query .= ' SELECT *, count('.$params['group_by'].') as events FROM '.$table_name.' WHERE `page_id` = "'.$params['page_id'].'"';
1139
1140
- if (isset($params['event_name']) && $params['event_name'] ) {
1141
- $query .= ' AND event_name = "'.$params['event_name'].'" ';
1142
}
1143
1144
- if (isset($params['source']) && $params['source'] ) {
1145
- $query .= ' AND source = "'.$params['source'].'" ';
1146
}
1147
1148
if (isset($params['lead_id']) && $params['lead_id'] ) {
1149
$query .= ' AND lead_id = "'.$params['lead_id'].'" ';
1150
}
1151
1152
if (isset($params['start_date'])) {
1153
$query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
1154
}
@@ -1215,6 +1295,44 @@ class Inbound_Events {
1215
return $results;
1216
}
1217
1218
/**
1219
* Get all cta click events related to lead ID
1220
*/
111
$sql = "CREATE TABLE IF NOT EXISTS $table_name (
112
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
113
`page_id` varchar(20) NOT NULL,
114
+ `cta_id` varchar(20) NOT NULL,
115
`variation_id` mediumint(9) NOT NULL,
116
`lead_id` mediumint(20) NOT NULL,
117
`lead_uid` varchar(255) NOT NULL,
405
$defaults = array(
406
'page_id' => '',
407
'variation_id' => '',
408
+ 'cta_id' => ( isset($args['cta_id']) ? $args['cta_id'] : 0 ),
409
'lead_id' => ( isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : '' ),
410
'lead_uid' => ( isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : '' ),
411
'session_id' => ( isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : session_id() ),
750
case 'page_id':
751
$query .=' `page_id` = "'.$params['page_id'].'" ';
752
break;
753
+ case 'cta_id':
754
+ $query .=' `cta_id` = "'.$params['cta_id'].'" ';
755
+ break;
756
case 'mixed':
757
if (isset($params['lead_id']) && $params['lead_id'] ) {
758
$queries[] = ' `lead_id` = "'.$params['lead_id'].'" ';
803
$params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
804
805
$table_name = $wpdb->prefix . "inbound_page_views";
806
+ $where = false;
807
+
808
+ $query = 'SELECT *, count(*) as impressions, count(date(datetime)) as impressions_per_day, date(datetime) as date FROM '.$table_name.' WHERE';
809
810
811
812
+ if (isset($params['page_id']) && $params['page_id'] ) {
813
+ if ($where) {
814
+ $query .= " AND ";
815
+ } else {
816
+ $where = true;
817
+ }
818
+ $query .= ' page_id = "'.$params['page_id'].'" ';
819
+ }
820
+
821
+ if (isset($params['cta_id']) && $params['cta_id'] ) {
822
+ if ($where) {
823
+ $query .= " AND ";
824
+ } else {
825
+ $where = true;
826
+ }
827
+ $query .= ' cta_id = "'.$params['cta_id'].'" ';
828
+ }
829
+
830
if (isset($params['source']) && $params['source'] ) {
831
+ if ($where) {
832
+ $query .= " AND ";
833
+ } else {
834
+ $where = true;
835
+ }
836
+ $query .= ' source = "'.$params['source'].'" ';
837
}
838
839
$query .=' AND `page_id` != "0" ';
927
$params['order_by'] = (isset($params['order_by'])) ? $params['order_by'] : 'datetime DESC';
928
929
$table_name = $wpdb->prefix . "inbound_page_views";
930
+ $query = 'SELECT *, count('.$params['group_by'].') as count FROM '.$table_name .' WHERE 1=1 ';
931
+
932
+ if (isset($params['cta_id']) && $params['cta_id']) {
933
+ $query .= ' AND `cta_id` = "'.$params['cta_id'].'" ';
934
+ }
935
+
936
+ if (isset($params['page_id']) && $params['page_id'] ) {
937
+ $query .= ' AND `page_id` = "'.$params['page_id'].'" ';
938
+ }
939
940
if (isset($params['source']) && $params['source'] ) {
941
$query .= ' AND source = "'.$params['source'].'" ';
973
$table_name = $wpdb->prefix . "inbound_page_views";
974
$query = 'SELECT count(date(datetime)) as visits_per_day, date(datetime) as date , sum(visits) as visitors FROM ( ';
975
976
+ $query .= ' SELECT *, count('.$params['group_by'].') as visits FROM '.$table_name.' WHERE 1=1 ';
977
978
+ if (isset($params['page_id']) && $params['page_id']) {
979
+ $query .=' AND `page_id` = "'.$params['page_id'].'" ';
980
+ }
981
+
982
+ if (isset($params['cta_id']) && $params['cta_id']) {
983
+ $query .='AND `cta_id` = "'.$params['cta_id'].'" ';
984
+ }
985
986
if (isset($params['source']) && $params['source'] ) {
987
$query .= ' AND source = "'.$params['source'].'" ';
1011
$table_name = $wpdb->prefix . "inbound_page_views";
1012
$query = 'SELECT * , count(source) as visitors, sum(page_views) as page_views_total FROM ( ';
1013
1014
+ $query .= ' SELECT *, count(lead_uid) as page_views FROM '.$table_name.' WHERE 1=1 ';
1015
+
1016
+ if (isset($params['page_id']) && $params['page_id']) {
1017
+ $query .=' AND `page_id` = "'.$params['page_id'].'" ';
1018
+ }
1019
+
1020
+ if (isset($params['cta_id']) && $params['cta_id'] ) {
1021
+ $query .='AND `cta_id` = "'.$params['cta_id'].'" ';
1022
+ }
1023
1024
if (isset($params['source']) && $params['source'] ) {
1025
$query .= ' AND source = "'.$params['source'].'" ';
1068
}
1069
1070
if (isset($params['event_name']) && $params['event_name'] ) {
1071
+ if(isset($params['event_name_2']) && $params['event_name_2'] != ''){
1072
+ $query .= ' AND event_name = "'.$params['event_name'].'" + "'.$params['event_name_2'].'"';
1073
+ }else{
1074
+ $query .= ' AND event_name = "'.$params['event_name'].'" ';
1075
+ }
1076
+ } else if (isset($params['exclude_events']) && $params['exclude_events']) {
1077
+ if (!is_array($params['exclude_events'])) {
1078
+ $params['exclude_events'] = explode(',' , $params['exclude_events']);
1079
+ }
1080
+ foreach ($params['exclude_events'] as $event_name) {
1081
+ $query .= ' AND event_name != "'.$event_name.'" ';
1082
+ }
1083
}
1084
1085
if (isset($params['source']) && $params['source'] ) {
1090
$query .= ' AND lead_id = "'.$params['lead_id'].'" ';
1091
}
1092
1093
+ if (isset($params['cta_id']) && $params['cta_id'] ) {
1094
+ $query .= ' AND cta_id = "'.$params['cta_id'].'" ';
1095
+ }
1096
+
1097
+ if (isset($params['variation_id']) && $params['variation_id'] ) {
1098
+ $query .= ' AND variation_id = "'.$params['variation_id'].'" ';
1099
+ }
1100
+
1101
if (isset($params['start_date']) && $params['start_date']) {
1102
$query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
1103
}
1137
case 'inbound_content_click':
1138
return ($plural) ? __('Content Clicks' , 'inbound-pro') : __('Content Click' , 'inbound-pro');
1139
break;
1140
+ case 'inbound_direct_message':
1141
return ($plural) ? __('Direct Messages' , 'inbound-pro') : __('Direct Message' , 'inbound-pro');
1142
break;
1143
case 'inbound_list_add':
1207
$table_name = $wpdb->prefix . "inbound_events";
1208
$query = 'SELECT date(datetime) as date , sum(events) as events_count FROM ( ';
1209
1210
+ $query .= ' SELECT *, count('.$params['group_by'].') as events FROM '.$table_name.' WHERE 1=1';
1211
1212
+ if (isset($params['page_id']) && $params['page_id'] ) {
1213
+ $query .= ' AND page_id = "'.$params['page_id'].'" ';
1214
}
1215
1216
+ if (isset($params['cta_id']) && $params['cta_id'] ) {
1217
+ $query .= ' AND cta_id = "'.$params['cta_id'].'" ';
1218
}
1219
1220
if (isset($params['lead_id']) && $params['lead_id'] ) {
1221
$query .= ' AND lead_id = "'.$params['lead_id'].'" ';
1222
}
1223
1224
+ if (isset($params['event_name']) && $params['event_name'] ) {
1225
+ $query .= ' AND event_name = "'.$params['event_name'].'" ';
1226
+ }
1227
+
1228
+ if (isset($params['source']) && $params['source'] ) {
1229
+ $query .= ' AND source = "'.$params['source'].'" ';
1230
+ }
1231
+
1232
if (isset($params['start_date'])) {
1233
$query .= ' AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
1234
}
1295
return $results;
1296
}
1297
1298
+ /**
1299
+ * Gets cta conversion events by cta_id, lead_id or by page_id
1300
+ *
1301
+ */
1302
+ public static function get_cta_conversions( $nature = 'lead_id' , $params ){
1303
+ global $wpdb;
1304
+
1305
+ $table_name = $wpdb->prefix . "inbound_events";
1306
+ $query = 'SELECT * FROM '.$table_name.' WHERE ';
1307
+
1308
+ switch ($nature) {
1309
+ case 'lead_id':
1310
+ $query .= '`lead_id` = "'.$params['lead_id'].'" ';
1311
+ break;
1312
+ case 'page_id':
1313
+ $query .= '`page_id` = "'.$params['page_id'].'" ';
1314
+ break;
1315
+ case 'cta_id':
1316
+ $query .= '`cta_id` = "'.$params['cta_id'].'" ';
1317
+ break;
1318
+ }
1319
+
1320
+ /* add date constraints if applicable */
1321
+ if (isset($params['start_date'])) {
1322
+ $query .= 'AND datetime >= "'.$params['start_date'].'" AND datetime <= "'.$params['end_date'].'" ';
1323
+ }
1324
+
1325
+ if (isset($params['variation_id'])) {
1326
+ $query .= 'AND variation_id = "'.$params['variation_id'].'" ';
1327
+ }
1328
+
1329
+ $query .= 'AND ( `event_name` = "inbound_cta_click" || `event_name` LIKE "%_form_submission%" ) ORDER BY `datetime` DESC';
1330
+
1331
+ $results = $wpdb->get_results( $query , ARRAY_A );
1332
+
1333
+ return $results;
1334
+ }
1335
+
1336
/**
1337
* Get all cta click events related to lead ID
1338
*/
shared/classes/class.form.php CHANGED
@@ -534,7 +534,9 @@ if (!class_exists('Inbound_Forms')) {
534
$form .= '<input type="hidden" name="page_id" value="' . (isset($post->ID) ? $post->ID : '0') . '">';
535
$form .= '<input type="hidden" name="inbound_furl" value="' . base64_encode(trim($redirect)) . '">';
536
$form .= '<input type="hidden" name="inbound_notify" value="' . base64_encode($notify) . '">';
537
- $form .= '<input type="hidden" name="inbound_nonce" value="' . wp_create_nonce(SECURE_AUTH_KEY) . '">';
538
$form .= '<input type="hidden" class="inbound_params" name="inbound_params" value="">';
539
$form .= '</div>';
540
$form .= '</form>';
@@ -824,7 +826,9 @@ if (!class_exists('Inbound_Forms')) {
824
}
825
826
/* if POST does not contain correct nonce then bail */
827
- check_ajax_referer( SECURE_AUTH_KEY , 'inbound_nonce' );
828
829
$form_post_data = array();
830
if (isset($_POST['phone_xoxo']) && $_POST['phone_xoxo'] != "") {
534
$form .= '<input type="hidden" name="page_id" value="' . (isset($post->ID) ? $post->ID : '0') . '">';
535
$form .= '<input type="hidden" name="inbound_furl" value="' . base64_encode(trim($redirect)) . '">';
536
$form .= '<input type="hidden" name="inbound_notify" value="' . base64_encode($notify) . '">';
537
+ if (!defined('DISABLE_INBOUND_FORM_NONCE')) {
538
+ $form .= '<input type="hidden" name="inbound_nonce" value="' . wp_create_nonce(SECURE_AUTH_KEY) . '">';
539
+ }
540
$form .= '<input type="hidden" class="inbound_params" name="inbound_params" value="">';
541
$form .= '</div>';
542
$form .= '</form>';
826
}
827
828
/* if POST does not contain correct nonce then bail */
829
+ if (!defined('DISABLE_INBOUND_FORM_NONCE')) {
830
+ check_ajax_referer(SECURE_AUTH_KEY, 'inbound_nonce');
831
+ }
832
833
$form_post_data = array();
834
if (isset($_POST['phone_xoxo']) && $_POST['phone_xoxo'] != "") {
shared/classes/class.list-double-optin.php CHANGED
@@ -354,17 +354,20 @@ class Inbound_List_Double_Optin {
354
jQuery('.double-optin-enabled').css({'display': 'none'});
355
} else {
356
jQuery('.double-optin-enabled').css({'display': 'table-row'});
357
}
358
});
359
360
/*if the double optin status has changed*/
361
jQuery('#double_optin_email_template').on('change', function () {
362
- if (jQuery('#double_optin_email_template').val() == 'default-email-template') {
363
- jQuery('.default-email-setting').css({'display': 'table-row'});
364
- jQuery('.confirmation-shortcode-notice').css({'display': 'none'});
365
- } else {
366
- jQuery('.default-email-setting').css({'display': 'none'});
367
- jQuery('.confirmation-shortcode-notice').css({'display': 'table-row'});
368
}
369
});
370
354
jQuery('.double-optin-enabled').css({'display': 'none'});
355
} else {
356
jQuery('.double-optin-enabled').css({'display': 'table-row'});
357
+ jQuery('#double_optin_email_template').trigger('change');
358
}
359
});
360
361
/*if the double optin status has changed*/
362
jQuery('#double_optin_email_template').on('change', function () {
363
+ if(jQuery('#double_optin_toggle').val() == '1'){
364
+ if (jQuery('#double_optin_email_template').val() == 'default-email-template') {
365
+ jQuery('.default-email-setting').css({'display': 'table-row'});
366
+ jQuery('.confirmation-shortcode-notice').css({'display': 'none'});
367
+ } else {
368
+ jQuery('.default-email-setting').css({'display': 'none'});
369
+ jQuery('.confirmation-shortcode-notice').css({'display': 'table-row'});
370
+ }
371
}
372
});
373
shared/classes/class.load-shared.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists('Inbound_Load_Shared')) {
39
*/
40
public static function load_constants() {
41
define('INBOUNDNOW_SHARED', 'loaded');
42
- define('INBOUNDNOW_SHARED_DBRV', '1.0.9');
43
define('INBOUNDNOW_SHARED_PATH', self::get_shared_path());
44
define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath());
45
define('INBOUNDNOW_SHARED_FILE', self::get_shared_file());
39
*/
40
public static function load_constants() {
41
define('INBOUNDNOW_SHARED', 'loaded');
42
+ define('INBOUNDNOW_SHARED_DBRV', '2.0.2');
43
define('INBOUNDNOW_SHARED_PATH', self::get_shared_path());
44
define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath());
45
define('INBOUNDNOW_SHARED_FILE', self::get_shared_file());
shared/classes/class.post-type.wp-lead.php CHANGED
@@ -207,7 +207,8 @@ class Inbound_Leads {
207
* Displays the list id and double option status in the lead-tags WP List Table
208
*/
209
public static function support_lead_list_columns( $out, $column_name, $term_id ) {
210
-
211
switch($column_name){
212
case 'lead_id':
213
echo $term_id;
@@ -786,4 +787,4 @@ class Inbound_Leads {
786
/**
787
* Register 'wp-lead' CPT
788
*/
789
- new Inbound_Leads();
207
* Displays the list id and double option status in the lead-tags WP List Table
208
*/
209
public static function support_lead_list_columns( $out, $column_name, $term_id ) {
210
+ global $inbound_settings;
211
+
212
switch($column_name){
213
case 'lead_id':
214
echo $term_id;
787
/**
788
* Register 'wp-lead' CPT
789
*/
790
+ new Inbound_Leads();
shared/shortcodes/shortcodes/column.php CHANGED
@@ -1,176 +1,177 @@
1
- <?php
2
- /**
3
- * Columns Shortcode
4
- */
5
-
6
- /* Shortcode generator config
7
- * ----------------------------------------------------- */
8
- $shortcodes_config['columns'] = array(
9
- 'no_preview' => true,
10
- 'options' => array(
11
- 'gutter' => array(
12
- 'name' => __('Gutter Width', 'inbound-pro' ),
13
- 'desc' => __('A space between the columns.', 'inbound-pro' ),
14
- 'type' => 'select',
15
- 'options' => array(
16
- '20' => '20px',
17
- '30' => '30px'
18
- ),
19
- 'std' => ''
20
- ),
21
- 'set' => array(
22
- 'name' => __('Column Set', 'inbound-pro' ),
23
- 'desc' => __('Select the set.', 'inbound-pro' ),
24
- 'type' => 'select',
25
- 'options' => array(
26
- '[one_full]Content goes here[/one_full]' => '1/1',
27
- '[one_half]Content goes here[/one_half][one_half]Content goes here[/one_half]' => '1/2 + 1/2',
28
- '[one_third]Content goes here[/one_third][one_third]Content goes here[/one_third][one_third]Content goes here[/one_third]' => '1/3 + 1/3 + 1/3',
29
- '[two_third]Content goes here[/two_third][one_third]Content goes here[/one_third]' => '2/3 + 1/3',
30
- '[one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth]' => '1/4 + 1/4 + 1/4 + 1/4',
31
- '[one_half]Content goes here[/one_half][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth]' => '1/2 + 1/4 + 1/4',
32
- '[three_fourth]Content goes here[/three_fourth][one_fourth]Content goes here[/one_fourth]' => '3/4 + 1/4',
33
- '[one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '1/5 + 1/5 + 1/5 + 1/5 + 1/5',
34
- '[two_fifth]Content goes here[/two_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '2/5 + 1/5 + 1/5 + 1/5',
35
- '[three_fifth]Content goes here[/three_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '3/5 + 1/5 + 1/5',
36
- '[four_fifth]Content goes here[/four_fifth][one_fifth]Content goes here[/one_fifth]' => '4/5 + 1/5',
37
- ),
38
- 'std' => ''
39
- )
40
- ),
41
- 'shortcode' => '[columns gutter="{{gutter}}"]{{set}}[/columns]',
42
- 'popup_title' => 'Insert Column Shortcode'
43
- );
44
-
45
- /* Page builder module config
46
- * ----------------------------------------------------- */
47
- $freshbuilder_modules['column'] = array(
48
- 'name' => __('Column', 'inbound-pro' ),
49
- 'size' => 'one_fifth',
50
- 'options' => array(
51
- 'content' => array(
52
- 'name' => __('Column Content', 'inbound-pro' ),
53
- 'desc' => __('Enter the column content', 'inbound-pro' ),
54
- 'type' => 'textarea',
55
- 'std' => '',
56
- 'class' => 'wide',
57
- 'is_content' => '1'
58
- )
59
- )
60
- );
61
-
62
- /* Add shortcode
63
- * ----------------------------------------------------- */
64
-
65
- if ( !defined('INBOUND_DISABLE_COLUMN_SHORTCODES') ) {
66
-
67
- /* Columns Wrap */
68
- if (!function_exists('inbound_shortcode_columns') || !is_defined('INBOUND_DISABLE_COLUMN_SHORTCODES') ) {
69
- function inbound_shortcode_columns( $atts, $content = null ) {
70
- extract(shortcode_atts(array(
71
- 'gutter' => '20'
72
- ), $atts));
73
-
74
- if( $gutter == '30') {
75
- $gutter = 'inbound-row_30';
76
- } else {
77
- $gutter = 'inbound-row';
78
- }
79
- $content = preg_replace('/<br class=\'inbr\'.*\/>/', '', $content); // remove editor br tags
80
- return '<div class="'. $gutter .'">' . do_shortcode($content) . '</div>';
81
- }
82
- add_shortcode('columns', 'inbound_shortcode_columns');
83
- }
84
-
85
-
86
- /* Full column */
87
- if (!function_exists('inbound_shortcode_full_columns') ) {
88
- function inbound_shortcode_full_columns( $atts, $content = null ) {
89
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
90
- return '<div class="inbound-grid full">' . do_shortcode($content) . '</div>';
91
- }
92
- add_shortcode('one_full', 'inbound_shortcode_full_columns');
93
- }
94
-
95
- /* One Half */
96
- if (!function_exists('inbound_shortcode_one_half_columns')) {
97
- function inbound_shortcode_one_half_columns( $atts, $content = null ) {
98
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
99
- return '<div class="inbound-grid one-half">' . do_shortcode($content) . '</div>';
100
- }
101
- add_shortcode('one_half', 'inbound_shortcode_one_half_columns');
102
- }
103
-
104
-
105
- /* One Third */
106
- if (!function_exists('inbound_shortcode_one_third_columns')) {
107
- function inbound_shortcode_one_third_columns( $atts, $content = null ) {
108
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
109
- return '<div class="inbound-grid one-third">' . do_shortcode($content) . '</div>';
110
- }
111
- }
112
- add_shortcode('one_third', 'inbound_shortcode_one_third_columns');
113
-
114
- /* Two Third */
115
- if (!function_exists('inbound_shortcode_two_third_columns')) {
116
- function inbound_shortcode_two_third_columns( $atts, $content = null ) {
117
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
118
- return '<div class="inbound-grid two-third">' . do_shortcode($content) . '</div>';
119
- }
120
- }
121
- add_shortcode('two_third', 'inbound_shortcode_two_third_columns');
122
-
123
- /* One Fourth */
124
- if (!function_exists('inbound_shortcode_one_fourth_columns')) {
125
- function inbound_shortcode_one_fourth_columns( $atts, $content = null ) {
126
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
127
- return '<div class="inbound-grid one-fourth">' . do_shortcode($content) . '</div>';
128
- }
129
- }
130
- add_shortcode('one_fourth', 'inbound_shortcode_one_fourth_columns');
131
-
132
- /* Three Fourth */
133
- if (!function_exists('inbound_shortcode_three_fourth_columns')) {
134
- function inbound_shortcode_three_fourth_columns( $atts, $content = null ) {
135
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
136
- return '<div class="inbound-grid three-fourth">' . do_shortcode($content) . '</div>';
137
- }
138
- }
139
- add_shortcode('three_fourth', 'inbound_shortcode_three_fourth_columns');
140
-
141
- /* One Fifth */
142
- if (!function_exists('inbound_shortcode_one_fifth_columns')) {
143
- function inbound_shortcode_one_fifth_columns( $atts, $content = null ) {
144
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
145
- return '<div class="inbound-grid one-fifth">' . do_shortcode($content) . '</div>';
146
- }
147
- }
148
- add_shortcode('one_fifth', 'inbound_shortcode_one_fifth_columns');
149
-
150
- /* Two Fifth */
151
- if (!function_exists('inbound_shortcode_two_fifth_columns')) {
152
- function inbound_shortcode_two_fifth_columns( $atts, $content = null ) {
153
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
154
- return '<div class="inbound-inbound-grid two-fifth">' . do_shortcode($content) . '</div>';
155
- }
156
- }
157
- add_shortcode('two_fifth', 'inbound_shortcode_two_fifth_columns');
158
-
159
- /* Three Fifth */
160
- if (!function_exists('inbound_shortcode_three_fifth_columns')) {
161
- function inbound_shortcode_three_fifth_columns( $atts, $content = null ) {
162
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
163
- return '<div class="inbound-inbound-grid three-fifth">' . do_shortcode($content) . '</div>';
164
- }
165
- }
166
- add_shortcode('three_fifth', 'inbound_shortcode_three_fifth_columns');
167
-
168
- /* Four Fifth */
169
- if (!function_exists('inbound_shortcode_four_fifth_columns')) {
170
- function inbound_shortcode_four_fifth_columns( $atts, $content = null ) {
171
- $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
172
- return '<div class="inbound-inbound-grid three-four">' . do_shortcode($content) . '</div>';
173
- }
174
- }
175
- add_shortcode('three_four', 'inbound_shortcode_four_fifth_columns');
176
}
1
+ <?php
2
+ /**
3
+ * Columns Shortcode
4
+ */
5
+
6
+ /* Shortcode generator config
7
+ * ----------------------------------------------------- */
8
+ $shortcodes_config['columns'] = array(
9
+ 'no_preview' => true,
10
+ 'options' => array(
11
+ 'gutter' => array(
12
+ 'name' => __('Gutter Width', 'inbound-pro' ),
13
+ 'desc' => __('A space between the columns.', 'inbound-pro' ),
14
+ 'type' => 'select',
15
+ 'options' => array(
16
+ '20' => '20px',
17
+ '30' => '30px'
18
+ ),
19
+ 'std' => ''
20
+ ),
21
+ 'set' => array(
22
+ 'name' => __('Column Set', 'inbound-pro' ),
23
+ 'desc' => __('Select the set.', 'inbound-pro' ),
24
+ 'type' => 'select',
25
+ 'options' => array(
26
+ '[one_full]Content goes here[/one_full]' => '1/1',
27
+ '[one_half]Content goes here[/one_half][one_half]Content goes here[/one_half]' => '1/2 + 1/2',
28
+ '[one_third]Content goes here[/one_third][one_third]Content goes here[/one_third][one_third]Content goes here[/one_third]' => '1/3 + 1/3 + 1/3',
29
+ '[two_third]Content goes here[/two_third][one_third]Content goes here[/one_third]' => '2/3 + 1/3',
30
+ '[one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth]' => '1/4 + 1/4 + 1/4 + 1/4',
31
+ '[one_half]Content goes here[/one_half][one_fourth]Content goes here[/one_fourth][one_fourth]Content goes here[/one_fourth]' => '1/2 + 1/4 + 1/4',
32
+ '[three_fourth]Content goes here[/three_fourth][one_fourth]Content goes here[/one_fourth]' => '3/4 + 1/4',
33
+ '[one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '1/5 + 1/5 + 1/5 + 1/5 + 1/5',
34
+ '[two_fifth]Content goes here[/two_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '2/5 + 1/5 + 1/5 + 1/5',
35
+ '[three_fifth]Content goes here[/three_fifth][one_fifth]Content goes here[/one_fifth][one_fifth]Content goes here[/one_fifth]' => '3/5 + 1/5 + 1/5',
36
+ '[four_fifth]Content goes here[/four_fifth][one_fifth]Content goes here[/one_fifth]' => '4/5 + 1/5',
37
+ ),
38
+ 'std' => ''
39
+ )
40
+ ),
41
+ 'shortcode' => '[columns gutter="{{gutter}}"]{{set}}[/columns]',
42
+ 'popup_title' => 'Insert Column Shortcode'
43
+ );
44
+
45
+ /* Page builder module config
46
+ * ----------------------------------------------------- */
47
+ $freshbuilder_modules['column'] = array(
48
+ 'name' => __('Column', 'inbound-pro' ),
49
+ 'size' => 'one_fifth',
50
+ 'options' => array(
51
+ 'content' => array(
52
+ 'name' => __('Column Content', 'inbound-pro' ),
53
+ 'desc' => __('Enter the column content', 'inbound-pro' ),
54
+ 'type' => 'textarea',
55
+ 'std' => '',
56
+ 'class' => 'wide',
57
+ 'is_content' => '1'
58
+ )
59
+ )
60
+ );
61
+
62
+ /* Add shortcode
63
+ * ----------------------------------------------------- */
64
+
65
+ if ( !defined('INBOUND_DISABLE_COLUMN_SHORTCODES') ) {
66
+
67
+ /* Columns Wrap */
68
+ if (!function_exists('inbound_shortcode_columns') && !shortcode_exists('columns') ) {
69
+ function inbound_shortcode_columns( $atts, $content = null ) {
70
+ extract(shortcode_atts(array(
71
+ 'gutter' => '20'
72
+ ), $atts));
73
+
74
+ if( $gutter == '30') {
75
+ $gutter = 'inbound-row_30';
76
+ } else {
77
+ $gutter = 'inbound-row';
78
+ }
79
+ $content = preg_replace('/<br class=\'inbr\'.*\/>/', '', $content); // remove editor br tags
80
+ return '<div class="'. $gutter .'">' . do_shortcode($content) . '</div>';
81
+ }
82
+ add_shortcode('columns', 'inbound_shortcode_columns');
83
+ }
84
+
85
+
86
+ /* Full column */
87
+ if (!function_exists('inbound_shortcode_full_columns') && !shortcode_exists('one_full') ) {
88
+ function inbound_shortcode_full_columns( $atts, $content = null ) {
89
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
90
+ return '<div class="inbound-grid full">' . do_shortcode($content) . '</div>';
91
+ }
92
+ add_shortcode('one_full', 'inbound_shortcode_full_columns');
93
+ }
94
+
95
+ /* One Half */
96
+ if (!function_exists('inbound_shortcode_one_half_columns') && !shortcode_exists('one_half')) {
97
+ function inbound_shortcode_one_half_columns( $atts, $content = null ) {
98
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
99
+ return '<div class="inbound-grid one-half">' . do_shortcode($content) . '</div>';
100
+ }
101
+ add_shortcode('one_half', 'inbound_shortcode_one_half_columns');
102
+ }
103
+
104
+
105
+ /* One Third */
106
+ if (!function_exists('inbound_shortcode_one_third_columns') && !shortcode_exists('one_third') ) {
107
+ function inbound_shortcode_one_third_columns( $atts, $content = null ) {
108
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
109
+ return '<div class="inbound-grid one-third">' . do_shortcode($content) . '</div>';
110
+ }
111
+ add_shortcode('one_third', 'inbound_shortcode_one_third_columns');
112
+ }
113
+
114
+
115
+ /* Two Third */
116
+ if (!function_exists('inbound_shortcode_two_third_columns')) {
117
+ function inbound_shortcode_two_third_columns( $atts, $content = null ) {
118
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
119
+ return '<div class="inbound-grid two-third">' . do_shortcode($content) . '</div>';
120
+ }
121
+ }
122
+ add_shortcode('two_third', 'inbound_shortcode_two_third_columns');
123
+
124
+ /* One Fourth */
125
+ if (!function_exists('inbound_shortcode_one_fourth_columns')) {
126
+ function inbound_shortcode_one_fourth_columns( $atts, $content = null ) {
127
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
128
+ return '<div class="inbound-grid one-fourth">' . do_shortcode($content) . '</div>';
129
+ }
130
+ }
131
+ add_shortcode('one_fourth', 'inbound_shortcode_one_fourth_columns');
132
+
133
+ /* Three Fourth */
134
+ if (!function_exists('inbound_shortcode_three_fourth_columns')) {
135
+ function inbound_shortcode_three_fourth_columns( $atts, $content = null ) {
136
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
137
+ return '<div class="inbound-grid three-fourth">' . do_shortcode($content) . '</div>';
138
+ }
139
+ }
140
+ add_shortcode('three_fourth', 'inbound_shortcode_three_fourth_columns');
141
+
142
+ /* One Fifth */
143
+ if (!function_exists('inbound_shortcode_one_fifth_columns')) {
144
+ function inbound_shortcode_one_fifth_columns( $atts, $content = null ) {
145
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
146
+ return '<div class="inbound-grid one-fifth">' . do_shortcode($content) . '</div>';
147
+ }
148
+ }
149
+ add_shortcode('one_fifth', 'inbound_shortcode_one_fifth_columns');
150
+
151
+ /* Two Fifth */
152
+ if (!function_exists('inbound_shortcode_two_fifth_columns')) {
153
+ function inbound_shortcode_two_fifth_columns( $atts, $content = null ) {
154
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
155
+ return '<div class="inbound-inbound-grid two-fifth">' . do_shortcode($content) . '</div>';
156
+ }
157
+ }
158
+ add_shortcode('two_fifth', 'inbound_shortcode_two_fifth_columns');
159
+
160
+ /* Three Fifth */
161
+ if (!function_exists('inbound_shortcode_three_fifth_columns')) {
162
+ function inbound_shortcode_three_fifth_columns( $atts, $content = null ) {
163
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
164
+ return '<div class="inbound-inbound-grid three-fifth">' . do_shortcode($content) . '</div>';
165
+ }
166
+ }
167
+ add_shortcode('three_fifth', 'inbound_shortcode_three_fifth_columns');
168
+
169
+ /* Four Fifth */
170
+ if (!function_exists('inbound_shortcode_four_fifth_columns')) {
171
+ function inbound_shortcode_four_fifth_columns( $atts, $content = null ) {
172
+ $content = preg_replace('/<br class="inbr".\/>/', '', $content); // remove editor br tags
173
+ return '<div class="inbound-inbound-grid three-four">' . do_shortcode($content) . '</div>';
174
+ }
175
+ }
176
+ add_shortcode('three_four', 'inbound_shortcode_four_fifth_columns');
177
}
shared/shortcodes/shortcodes/forms.php CHANGED
@@ -1,825 +1,819 @@
1
- <?php
2
- /**
3
- * Inbound Forms Shortcode Options
4
- * Forms code found in /shared/classes/form.class.php
5
- * master code
6
- */
7
-
8
- if (empty($lead_list_names)){
9
- // if lead transient doesn't exist use defaults
10
- $lead_list_names = array(
11
- 'null' => 'No Lists detected',
12
- );
13
- }
14
-
15
- if (empty($lead_tag_names)){
16
- // if lead transient doesn't exist use defaults
17
- $lead_tag_names = array(
18
- 'null' => 'No Lists detected',
19
- );
20
- }
21
-
22
-
23
- $shortcodes_config['forms'] = array(
24
- 'no_preview' => false,
25
- 'options' => array(
26
- 'insert_default' => array(
27
- 'name' => __('Choose Starting Template', 'inbound-pro' ),
28
- 'desc' => __('Start Building Your Form from premade templates', 'inbound-pro' ),
29
- 'type' => 'select',
30
- 'options' => $form_names,
31
- 'std' => 'none',
32
- 'class' => 'main-form-settings',
33
- ),
34
- 'form_name' => array(
35
- 'name' => __('Form Name<span class="small-required-text">*</span>', 'inbound-pro' ),
36
- 'desc' => __('This is for internal use and is not shown to visitors', 'inbound-pro' ),
37
- 'type' => 'text',
38
- 'placeholder' => "Example: XYZ Whitepaper Download",
39
- 'std' => '',
40
- 'class' => 'main-form-settings',
41
- ),
42
- /*'confirmation' => array(
43
- 'name' => __('Form Layout', 'inbound-pro' ),
44
- 'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
45
- 'type' => 'select',
46
- 'options' => array(
47
- "redirect" => "Redirect After Form Completion",
48
- "text" => "Display Text on Same Page",
49
- ),
50
- 'std' => 'redirect'
51
- ),*/
52
- 'redirect' => array(
53
- 'name' => __('Redirect URL', 'inbound-pro' ),
54
- 'desc' => __('Where do you want to send people after they fill out the form? Please note: http:// is required. Leave blank to prevent redirection.', 'inbound-pro' ),
55
- 'type' => 'text',
56
- 'placeholder' => "http://www.yoursite.com/thank-you",
57
- 'std' => '',
58
- 'reveal_on' => 'redirect',
59
- 'class' => 'main-form-settings',
60
- ),
61
- /*'thank_you_text' => array(
62
- 'name' => __('Field Description <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
63
- 'desc' => __('Put field description here.', 'inbound-pro' ),
64
- 'type' => 'textarea',
65
- 'std' => '',
66
- 'class' => 'advanced',
67
- 'reveal_on' => 'text'
68
- ), */
69
- 'notify' => array(
70
- 'name' => __('Notify on Form Completions<span class="small-required-text">*</span>', 'inbound-pro' ),
71
- 'desc' => __('Who should get admin notifications on this form?<br>For multiple notifications separate email addresses with commas', 'inbound-pro' ),
72
- 'type' => 'text',
73
- 'placeholder' => "youremail@email.com",
74
- 'std' => '',
75
- 'class' => 'main-form-settings',
76
- ),
77
- 'notify_subject' => array(
78
- 'name' => __('Admin Email Subject Line<span class="small-required-text">*</span>', 'inbound-pro' ),
79
- 'desc' => __('Customize the subject line of email notifications arriving from this form. default: {{site-name}} {{form-name}} - New Lead Conversion', 'inbound-pro' ),
80
- 'type' => 'text',
81
- 'std' => "{{site-name}} {{form-name}} - New Lead Conversion",
82
- 'palceholder' => '{{site-name}} {{form-name}} - New Lead Conversion',
83
- 'class' => 'main-form-settings',
84
- ),
85
- 'lists' => array(
86
- 'name' => __('Add to List(s)', 'inbound-pro' ),
87
- 'desc' => __('Add the converting lead to 1 or more lead lists', 'inbound-pro' ),
88
- 'type' => 'leadlists',
89
- 'options' => $lead_list_names,
90
- 'class' => 'main-form-settings exclude-from-refresh',
91
- ),
92
-
93
- 'lists_hidden' => array(
94
- 'name' => __('Hidden List Values', 'inbound-pro' ),
95
- 'desc' => __('Hidden list values', 'inbound-pro' ),
96
- 'type' => 'hidden',
97
- 'class' => 'main-form-settings exclude-from-refresh',
98
- ),
99
- 'tags' => array(
100
- 'name' => __('Add Tags to Lead', 'inbound-pro' ),
101
- 'desc' => __('Tag the lead with these tags', 'inbound-pro' ),
102
- 'type' => 'leadtags',
103
- 'options' => $lead_tag_names,
104
- 'class' => 'main-form-settings exclude-from-refresh',
105
- ),
106
- 'tags_hidden' => array(
107
- 'name' => __('Hidden Tag Values', 'inbound-pro' ),
108
- 'desc' => __('Hidden Tag values', 'inbound-pro' ),
109
- 'type' => 'hidden',
110
- 'class' => 'main-form-settings exclude-from-refresh',
111
- ),
112
- 'helper-block-one' => array(
113
- 'name' => __('Name Name Name', 'inbound-pro' ),
114
- 'desc' => __('<span class="switch-to-form-insert button">Cancel Form Creation & Insert Existing Form</span>', 'inbound-pro' ),
115
- 'type' => 'helper-block',
116
- 'std' => '',
117
- 'class' => 'main-form-settings',
118
- ),
119
- 'heading_design' => array(
120
- 'name' => __('Name Name Name', 'inbound-pro' ),
121
- 'desc' => __('Layout Options', 'inbound-pro' ),
122
- 'type' => 'helper-block',
123
- 'std' => '',
124
- 'class' => 'main-design-settings',
125
- ),
126
- 'layout' => array(
127
- 'name' => __('Form Layout', 'inbound-pro' ),
128
- 'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
129
- 'type' => 'select',
130
- 'options' => array(
131
- "vertical" => "Vertical",
132
- "horizontal" => "Horizontal",
133
- ),
134
- 'std' => 'inline',
135
- 'class' => 'main-design-settings',
136
- ),
137
- 'labels' => array(
138
- 'name' => __('Label Alignment', 'inbound-pro' ),
139
- 'desc' => __('Choose Label Layout', 'inbound-pro' ),
140
- 'type' => 'select',
141
- 'options' => array(
142
- "top" => "Labels on Top",
143
- "bottom" => "Labels on Bottom",
144
- "inline" => "Inline",
145
- "placeholder" => "Use HTML5 Placeholder text only"
146
- ),
147
- 'std' => 'top',
148
- 'class' => 'main-design-settings',
149
- ),
150
- 'font-size' => array(
151
- 'name' => __('Form Font Size', 'inbound-pro' ),
152
- 'desc' => __('Size of Label Font. This also determines default submit button size', 'inbound-pro' ),
153
- 'type' => 'text',
154
- 'std' => '16',
155
- 'class' => 'main-design-settings',
156
- ),
157
- 'icon' => array(
158
- 'name' => __('Submit Button Icon', 'inbound-pro' ),
159
- 'desc' => __('Select an icon.', 'inbound-pro' ),
160
- 'type' => 'select',
161
- 'options' => $fontawesome,
162
- 'std' => 'none',
163
- 'class' => 'main-design-settings'
164
- ),
165
- 'submit' => array(
166
- 'name' => __('Submit Button Text', 'inbound-pro' ),
167
- 'desc' => __('Enter the text you want to show on the submit button. (or a link to a custom submit button image)', 'inbound-pro' ),
168
- 'type' => 'text',
169
- 'std' => 'Submit',
170
- 'class' => 'main-design-settings',
171
- ),
172
- 'submit-colors' => array(
173
- 'name' => __('Submit Color Options', 'inbound-pro' ),
174
- 'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
175
- 'type' => 'select',
176
- 'options' => array(
177
- "on" => "Color Options On",
178
- "off" => "Color Options Off (use theme defaults)",
179
- ),
180
- 'std' => 'off',
181
- 'class' => 'main-design-settings',
182
- ),
183
- 'submit-text-color' => array(
184
- 'name' => __('Button Text Color', 'inbound-pro' ),
185
- 'desc' => __('Color of text. Must toggle on "Submit Color Options" on', 'inbound-pro' ),
186
- 'type' => 'colorpicker',
187
- 'std' => '#434242',
188
- 'class' => 'main-design-settings',
189
- ),
190
- 'submit-bg-color' => array(
191
- 'name' => __('Button BG Color', 'inbound-pro' ),
192
- 'desc' => __('Background color of button. Must toggle on "Submit Color Options" on', 'inbound-pro' ),
193
- 'type' => 'colorpicker',
194
- 'std' => '#E9E9E9',
195
- 'class' => 'main-design-settings',
196
- ),
197
- 'width' => array(
198
- 'name' => __('Custom Width', 'inbound-pro' ),
199
- 'desc' => __('Enter in pixel width or % width. Example: 400 <u>or</u> 100%', 'inbound-pro' ),
200
- 'type' => 'text',
201
- 'std' => '',
202
- 'class' => 'main-design-settings',
203
- ),
204
- 'custom-class' => array(
205
- 'name' => __('Custom Class Names', 'inbound-pro' ),
206
- 'desc' => __('Add custom classes here ', 'inbound-pro' ),
207
- 'type' => 'text',
208
- 'std' => '',
209
- 'class' => 'main-design-settings',
210
- ),
211
- ),
212
- 'child' => array(
213
- 'options' => array(
214
- 'label' => array(
215
- 'name' => __('Field Label', 'inbound-pro' ),
216
- 'desc' => '',
217
- 'type' => 'text',
218
- 'std' => '',
219
- 'placeholder' => __("Enter the Form Field Label. Example: First Name" , "leads" )
220
- ),
221
- 'field_type' => array(
222
- 'name' => __('Field Type', 'inbound-pro' ),
223
- 'desc' => __('Select an form field type', 'inbound-pro' ),
224
- 'type' => 'select',
225
- 'options' => array(
226
- "text" => __('Single Line Text' , 'inbound-pro' ),
227
- 'textarea' => __('Paragraph Field' , 'inbound-pro' ),
228
- 'dropdown' => __('Dropdown - Custom' , 'inbound-pro' ),
229
- 'dropdown_countries' => __('Dropdown - Countries' , 'inbound-pro' ),
230
- 'radio' => __('Radio Select' , 'inbound-pro' ),
231
- 'checkbox' => __('Checkbox' , 'inbound-pro' ),
232
- 'html-block' => __('HTML Block' , 'inbound-pro' ),
233
- 'divider' => __('Divider' , 'inbound-pro' ),
234
- 'date-selector' => __('Date Dropdown Selection' , 'inbound-pro' ),
235
- 'date' => __('Date Picker Field' , 'inbound-pro' ),
236
- 'range' => __('Range Field' , 'inbound-pro' ),
237
- 'time' => __('Time Pick Field' , 'inbound-pro' ),
238
- 'hidden' => __('Hidden Field' , 'inbound-pro' ),
239
- 'honeypot' => __('Anti Spam Honey Pot' , 'inbound-pro' ),
240
- /*
241
- 'url' => __('URL' , 'inbound-pro' ),
242
- 'email' => __( 'Email' , 'inbound-pro' ),
243
- 'tel' => __( 'Telephone' , 'inbound-pro' ),
244
- 'datetime-local' => __('Date Time Pick Selector Field' , 'inbound-pro' ),
245
- 'file_upload' => __('File Upload' , 'inbound-pro' ),
246
- 'editor' => __('HTML Editor' ,'inbound-pro' ),
247
- 'multi-select' => __('multi-select' , 'inbound-pro' )
248
- */
249
- ),
250
- 'std' => ''
251
- ),
252
- 'map_to' => array(
253
- 'name' => __('Mapping', 'inbound-pro' ),
254
- 'desc' => __('This is required.', 'inbound-pro' ),
255
- 'type' => 'select',
256
- 'options' => $lead_mapping_fields,
257
- 'std' => 'none',
258
- 'class' => '',
259
- ),
260
- 'dropdown_options' => array(
261
- 'name' => __('Dropdown choices', 'inbound-pro' ),
262
- 'desc' => __('Enter Your Dropdown Options. Separate by commas. You may also use label|value to have a different value than the label stored.', 'inbound-pro' ),
263
- 'type' => 'text',
264
- 'std' => '',
265
- 'placeholder' => __('Choice 1|a, Choice 2, Choice 3' , 'inbound-pro' ),
266
- 'reveal_on' => 'dropdown' // on select choice show this
267
- ),
268
- 'radio_options' => array(
269
- 'name' => __('Radio Choices', 'inbound-pro' ),
270
- 'desc' => __('Enter Your Radio Options. Separate by commas. You may also use label|value to have a different value than the label stored.', 'inbound-pro' ),
271
- 'type' => 'text',
272
- 'std' => '',
273
- 'placeholder' => 'Choice 1|a, Choice 2',
274
- 'reveal_on' => 'radio' // on select choice show this
275
- ),
276
- 'checkbox_options' => array(
277
- 'name' => __('Checkbox choices', 'inbound-pro' ),
278
- 'desc' => __('Enter Your Checkbox Options. Separate by commas. You may also use label|value to have a different value than the label stored.', 'inbound-pro' ),
279
- 'type' => 'text',
280
- 'std' => '',
281
- 'placeholder' => __( 'Choice 1|a, Choice 2, Choice 3', 'inbound-pro' ),
282
- 'reveal_on' => 'checkbox' // on select choice show this
283
- ),
284
- 'html_block_options' => array(
285
- 'name' => __('HTML Block', 'inbound-pro' ),
286
- 'desc' => __('This is a raw HTML block in the form. Insert text/HTML', 'inbound-pro' ),
287
- 'type' => 'textarea',
288
- 'std' => '',
289
- 'reveal_on' => 'html-block' // on select choice show this
290
- ),
291
- 'range_options' => array(
292
- 'name' => __('Range Setup', 'inbound-pro' ),
293
- 'desc' => __('Enter the min, max, and steps inside the range input. Separate each with a pipe, eg: min|max|steps', 'inbound-pro' ),
294
- 'type' => 'text',
295
- 'std' => '',
296
- 'placeholder' => __('0|100|10' , 'inbound-pro' ),
297
- 'reveal_on' => 'range' // on select choice show this
298
- ),
299
- 'default_value' => array(
300
- 'name' => __('Default Value', 'inbound-pro' ),
301
- 'desc' => __('Enter the Default Value', 'inbound-pro' ),
302
- 'type' => 'text',
303
- 'std' => '',
304
- 'placeholder' => 'Enter Default Value',
305
- 'reveal_on' => 'hidden' // on select choice show this
306
- ),
307
- 'divider_options' => array(
308
- 'name' => __('Divider Text (optional)', 'inbound-pro' ),
309
- 'desc' => __('This is the text in the divider', 'inbound-pro' ),
310
- 'type' => 'text',
311
- 'std' => '',
312
- 'reveal_on' => 'divider' // on select choice show this
313
- ),
314
- 'required' => array(
315
- 'name' => __('Required Field? <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
316
- 'checkbox_text' => __('Check to make field required', 'inbound-pro' ),
317
- 'desc' => '',
318
- 'type' => 'checkbox',
319
- 'std' => '0',
320
- 'class' => '',
321
- ),
322
- 'helper' => array(
323
- 'name' => __('Field Description <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
324
- 'desc' => __('<span class="show-advanced-fields button">Show advanced options</span>', 'inbound-pro' ),
325
- 'type' => 'helper-block',
326
- 'std' => '',
327
- 'class' => '',
328
- ),
329
- 'exclude_tracking' => array(
330
- 'name' => __('Exclude Tracking? <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
331
- 'checkbox_text' => __('Check to exclude this form field from being tracked. Note this will not store in your Database', 'inbound-pro' ),
332
- 'desc' => '',
333
- 'type' => 'checkbox',
334
- 'std' => '0',
335
- 'class' => 'advanced',
336
- ),
337
- 'placeholder' => array(
338
- 'name' => __('Field Placeholder <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
339
- 'desc' => __('Put field placeholder text here. Only works for normal text inputs', 'inbound-pro' ),
340
- 'type' => 'text',
341
- 'std' => '',
342
- 'class' => 'advanced',
343
- ),
344
- 'description' => array(
345
- 'name' => __('Field Description <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
346
- 'desc' => __('Put field description here.', 'inbound-pro' ),
347
- 'type' => 'textarea',
348
- 'std' => '',
349
- 'class' => 'advanced',
350
- ),
351
- 'field_container_class' => array(
352
- 'name' => __('Field Container Classes <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
353
- 'desc' => __('Add additional class ids to the div that contains this field. Separate classes with spaces.', 'inbound-pro' ),
354
- 'type' => 'text',
355
- 'std' => '',
356
- 'class' => 'advanced',
357
- ),
358
- 'field_input_class' => array(
359
- 'name' => __('Field Input Classes <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
360
- 'desc' => __('Add additional class ids to this input field. Separate classes with spaces.', 'inbound-pro' ),
361
- 'type' => 'text',
362
- 'std' => '',
363
- 'class' => 'advanced',
364
- ),
365
-
366
- 'hidden_input_options' => array(
367
- 'name' => __('Dynamic Field Filling <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
368
- 'desc' => __('Enter Your Dynamic URL parameter', 'inbound-pro' ),
369
- 'type' => 'text',
370
- 'std' => '',
371
- 'placeholder' => 'enter dynamic url parameter example: utm_campaign ',
372
- 'class' => 'advanced',
373
- //'reveal_on' => 'hidden' // on select choice show this
374
- )
375
- ),
376
- 'shortcode' => '[inbound_field label="{{label}}" type="{{field_type}}" description="{{description}}" required="{{required}}" exclude_tracking={{exclude_tracking}} dropdown="{{dropdown_options}}" radio="{{radio_options}}" checkbox="{{checkbox_options}}" range="{{range_options}}" placeholder="{{placeholder}}" field_container_class="{{field_container_class}}" field_input_class="{{field_input_class}}" html="{{html_block_options}}" dynamic="{{hidden_input_options}}" default="{{default_value}}" map_to="{{map_to}}" divider_options="{{divider_options}}"]',
377
- 'clone' => __('Add Another Field', 'inbound-pro' )
378
- ),
379
- 'shortcode' => '[inbound_form name="{{form_name}}" lists="{{lists_hidden}}" tags="{{tags_hidden}}" redirect="{{redirect}}" notify="{{notify}}" notify_subject="{{notify_subject}}" layout="{{layout}}" font_size="{{font-size}}" labels="{{labels}}" icon="{{icon}}" submit="{{submit}}" submit="{{submit}}" submit_colors="{{submit-colors}}" submit_text_color="{{submit-text-color}}" submit_bg_color="{{submit-bg-color}}" custom_class="{{custom-class}}" width="{{width}}"]{{child}}[/inbound_form]',
380
- 'popup_title' => 'Insert Inbound Form Shortcode'
381
- );
382
-
383
- /* CPT Lead Lists */
384
- add_action('init', 'inbound_forms_cpt',11);
385
- if (!function_exists('inbound_forms_cpt')) {
386
- function inbound_forms_cpt() {
387
- //echo $slug;exit;
388
- $labels = array(
389
- 'name' => _x('Inbound Forms' , 'inbound-pro'),
390
- 'singular_name' => _x('Form' , 'inbound-pro'),
391
- 'add_new' => _x('Add New', 'Form'),
392
- 'add_new_item' => __('Create New Form' , 'inbound-pro'),
393
- 'edit_item' => __('Edit Form' , 'inbound-pro'),
394
- 'new_item' => __('New Form' , 'inbound-pro'),
395
- 'view_item' => __('View Form' , 'inbound-pro'),
396
- 'search_items' => __('Search Forms' , 'inbound-pro'),
397
- 'not_found' => __('Nothing found' , 'inbound-pro'),
398
- 'not_found_in_trash' => __('Nothing found in Trash' , 'inbound-pro'),
399
- 'parent_item_colon' => ''
400
- );
401
-
402
- $args = array(
403
- 'labels' => $labels,
404
- 'public' => false,
405
- 'publicly_queryable' => false,
406
- 'show_ui' => true,
407
- 'query_var' => true,
408
- 'show_in_menu' => true,
409
- 'capability_type' => array('inbound-form','inbound-forms'),
410
- 'map_meta_cap' => true,
411
- 'hierarchical' => false,
412
- 'menu_position' => 34,
413
- 'supports' => array('title','custom-fields', 'editor')
414
- );
415
-
416
- register_post_type( 'inbound-forms' , $args );
417
- //flush_rewrite_rules( false );
418
-
419
- /*
420
- add_action('admin_menu', 'remove_list_cat_menu');
421
- function remove_list_cat_menu() {
422
- global $submenu;
423
- unset($submenu['edit.php?post_type=wp-lead'][15]);
424
- //print_r($submenu); exit;
425
- }*/
426
- }
427
-
428
- /**
429
- * Register Role Capabilities
430
- */
431
- add_action( 'admin_init' , 'inbound_register_form_role_capabilities' ,999);
432
- function inbound_register_form_role_capabilities() {
433
- // Add the roles you'd like to administer the custom post types
434
- $roles = array('inbound_marketer','administrator');
435
-
436
- // Loop through each role and assign capabilities
437
- foreach($roles as $the_role) {
438
-
439
- $role = get_role($the_role);
440
- if (!$role) {
441
- continue;
442
- }
443
-
444
- $role->add_cap( 'read' );
445
- $role->add_cap( 'read_inbound-form');
446
- $role->add_cap( 'read_private_inbound-forms' );
447
- $role->add_cap( 'edit_inbound-form' );
448
- $role->add_cap( 'edit_inbound-forms' );
449
- $role->add_cap( 'edit_others_inbound-forms' );
450
- $role->add_cap( 'edit_published_inbound-forms' );
451
- $role->add_cap( 'publish_inbound-form' );
452
- $role->add_cap( 'delete_inbound-form' );
453
- $role->add_cap( 'delete_inbound-forms' );
454
- $role->add_cap( 'delete_others_inbound-forms' );
455
- $role->add_cap( 'delete_private_inbound-forms' );
456
- $role->add_cap( 'delete_published_inbound-forms' );
457
- }
458
- }
459
- }
460
-
461
-
462
- if (is_admin()) {
463
- // Change the columns for the edit CPT screen
464
- add_filter( "manage_inbound-forms_posts_columns", "inbound_forms_change_columns" );
465
- if (!function_exists('inbound_forms_change_columns')) {
466
- function inbound_forms_change_columns( $cols ) {
467
- $cols = array(
468
- "cb" => "<input type=\"checkbox\" />",
469
- 'title' => "Form Name",
470
- "inbound-form-shortcode" => "Shortcode",
471
- "inbound-form-converions" => "Conversion Count",
472
- "date" => "Date"
473
- );
474
- return $cols;
475
- }
476
- }
477
-
478
- add_action( "manage_posts_custom_column", "inbound_forms_custom_columns", 10, 2 );
479
- if (!function_exists('inbound_forms_custom_columns')) {
480
- function inbound_forms_custom_columns( $column, $post_id )
481
- {
482
- switch ( $column ) {
483
-
484
- case "inbound-form-shortcode":
485
- $shortcode = get_post_meta( $post_id , 'inbound_shortcode', true );
486
- $form_name = get_the_title( $post_id );
487
- if ($shortcode == "") {
488
- $shortcode = 'N/A';
489
- }
490
-
491
- echo '<input type="text" onclick="select()" class="regular-text code short-shortcode-input" readonly="readonly" id="shortcode" name="shortcode" value=\'[inbound_forms id="'.$post_id.'" name="'.$form_name.'"]\'>';
492
- break;
493
- case "inbound-form-converions":
494
- $count = get_post_meta( $post_id, 'inbound_form_conversion_count', true);
495
- if (get_post_meta( $post_id, 'inbound_form_conversion_count', true) == "") {
496
- $count = 'N/A';
497
- }
498
- echo $count;
499
- break;
500
- }
501
- }
502
- }
503
- }
504
-
505
- add_action('admin_head', 'inbound_get_form_names',16);
506
- if (!function_exists('inbound_get_form_names')) {
507
- function inbound_get_form_names() {
508
- global $post;
509
-
510
- $loop = get_transient( 'inbound-form-names' );
511
- if ( false === $loop ) {
512
- $args = array(
513
- 'posts_per_page' => -1,
514
- 'post_type'=> 'inbound-forms');
515
- $form_list = get_posts($args);
516
- $form_array = array();
517
-
518
- foreach ( $form_list as $form ) {
519
- $this_id = $form->ID;
520
- $this_link = get_permalink( $this_id );
521
- $title = $form->post_title;
522
- $form_array['form_' . $this_id] = $title;
523
-
524
- }
525
-
526
- set_transient('inbound-form-names', $form_array, 24 * HOUR_IN_SECONDS);
527
- }
528
-
529
- }
530
- }
531
-
532
- add_action('save_post', 'inbound_form_delete_transient', 10, 2);
533
- add_action('edit_post', 'inbound_form_delete_transient', 10, 2);
534
- add_action('wp_insert_post', 'inbound_form_delete_transient', 10, 2);
535
- if (!function_exists('inbound_form_delete_transient')) {
536
- // Refresh transient
537
- function inbound_form_delete_transient($post_id){
538
-
539
- if(get_post_type( $post_id ) != 'inbound-forms') {
540
- return;
541
- }
542
-
543
- delete_transient('inbound-form-names');
544
- inbound_get_form_names();
545
-
546
- }
547
- }
548
-
549
- if (!function_exists('inbound_form_save')) {
550
- /* Shortcode moved to shared form class */
551
- add_action('wp_ajax_inbound_form_save', 'inbound_form_save');
552
-
553
- function inbound_form_save() {
554
-
555
- global $user_ID, $wpdb;
556
- $check_nonce = wp_verify_nonce( $_POST['nonce'], 'inbound-shortcode-nonce' );
557
- if( !$check_nonce ) {
558
- exit;
559
- }
560
-
561
- /* Post Values */
562
- $form_name = (isset( $_POST['name'] )) ? $_POST['name'] : "";
563
- $shortcode = (isset( $_POST['shortcode'] )) ? $_POST['shortcode'] : "";
564
- $form_settings = (isset( $_POST['form_settings'] )) ? $_POST['form_settings'] : "";
565
- $form_values = (isset( $_POST['form_values'] )) ? $_POST['form_values'] : "";
566
- $field_count = (isset( $_POST['field_count'] )) ? $_POST['field_count'] : "";
567
- $page_id = (isset( $_POST['post_id'] )) ? $_POST['post_id'] : "";
568
- $post_type = (isset( $_POST['post_type'] )) ? $_POST['post_type'] : "";
569
- $redirect_value = (isset( $_POST['redirect_value'] )) ? $_POST['redirect_value'] : "";
570
- $notify_email = (isset( $_POST['notify_email'] )) ? $_POST['notify_email'] : "";
571
- $notify_email_subject = (isset( $_POST['notify_email_subject'] )) ? $_POST['notify_email_subject'] : "";
572
- $email_contents = (isset( $_POST['email_contents'] )) ? $_POST['email_contents'] : "";
573
- $send_email = (isset( $_POST['send_email'] )) ? $_POST['send_email'] : "off";
574
- $send_email_template = (isset( $_POST['send_email_template'] )) ? $_POST['send_email_template'] : "custom";
575
- $send_subject = (isset( $_POST['send_subject'] )) ? $_POST['send_subject'] : "off";
576
-
577
- if ($post_type === 'inbound-forms'){
578
- $post_ID = $page_id;
579
- $update_post = array(
580
- 'ID' => $post_ID,
581
- 'post_title' => $form_name,
582
- 'post_status' => 'publish',
583
- 'post_content' => $email_contents
584
- );
585
- wp_update_post( $update_post );
586
- $form_settings_data = get_post_meta( $post_ID, 'form_settings', TRUE );
587
- update_post_meta( $post_ID, 'inbound_form_settings', $form_settings );
588
- update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
589
- $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $post_ID . "\"", $shortcode);
590
- update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
591
- update_post_meta( $post_ID, 'inbound_form_values', $form_values );
592
- update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
593
- update_post_meta( $post_ID, 'inbound_redirect_value', $redirect_value );
594
- update_post_meta( $post_ID, 'inbound_notify_email', $notify_email );
595
- update_post_meta( $post_ID, 'inbound_notify_email_subject', $notify_email_subject );
596
- update_post_meta( $post_ID, 'inbound_email_send_notification', $send_email );
597
- update_post_meta( $post_ID, 'inbound_email_send_notification_template', $send_email_template );
598
- update_post_meta( $post_ID, 'inbound_confirmation_subject', $send_subject );
599
-
600
- $output = array('post_id'=> $post_ID,
601
- 'form_name'=>$form_name,
602
- 'redirect' => $redirect_value);
603
-
604
- echo json_encode($output,JSON_FORCE_OBJECT);
605
- wp_die();
606
- } else {
607
-
608
- // If from popup run this
609
- $query = $wpdb->prepare(
610
- 'SELECT ID FROM ' . $wpdb->posts . '
611
- WHERE post_title = %s
612
- AND post_type = \'inbound-forms\'',
613
- $form_name
614
- );
615
- $wpdb->query( $query );
616
-
617
- // If form exists
618
- if ( $wpdb->num_rows ) {
619
- $post_ID = $wpdb->get_var( $query );
620
-
621
- if ($post_ID != $page_id) {
622
- // if form name exists already in popup mode
623
- echo json_encode("Found");
624
- exit;
625
- } else {
626
- update_post_meta( $post_ID, 'inbound_form_settings', $form_settings );
627
- update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
628
- update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
629
- update_post_meta( $post_ID, 'inbound_form_values', $form_values );
630
- update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
631
- update_post_meta( $post_ID, 'inbound_redirect_value', $redirect_value );
632
- update_post_meta( $post_ID, 'inbound_notify_email', $notify_email );
633
- update_post_meta( $post_ID, 'inbound_notify_email_subject', $notify_email_subject );
634
- update_post_meta( $post_ID, 'inbound_email_send_notification', $send_email );
635
- update_post_meta( $post_ID, 'inbound_email_send_notification_template', $send_email_template );
636
- update_post_meta( $post_ID, 'inbound_confirmation_subject', $send_subject );
637
- }
638
-
639
- } else {
640
-
641
- // If form doesn't exist create it
642
- $post = array(
643
- 'post_title' => $form_name,
644
- 'post_content' => $email_contents,
645
- 'post_status' => 'publish',
646
- 'post_type' => 'inbound-forms',
647
- 'post_author' => 1
648
- );
649
-
650
- $post_ID = wp_insert_post($post);
651
- update_post_meta( $post_ID, 'inbound_form_settings', $form_settings );
652
- update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
653
- update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
654
- update_post_meta( $post_ID, 'inbound_form_values', $form_values );
655
- update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
656
- update_post_meta( $post_ID, 'inbound_redirect_value', $redirect_value );
657
- update_post_meta( $post_ID, 'inbound_notify_email', $notify_email );
658
- update_post_meta( $post_ID, 'inbound_notify_email_subject', $notify_email_subject );
659
- update_post_meta( $post_ID, 'inbound_email_send_notification', $send_email );
660
- update_post_meta( $post_ID, 'inbound_email_send_notification_template', $send_email_template );
661
- update_post_meta( $post_ID, 'inbound_confirmation_subject', $send_subject );
662
- }
663
- $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $post_ID . "\"", $shortcode);
664
- update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
665
-
666
- inbound_form_delete_transient( $post_ID );
667
-
668
-
669
- $output = array('post_id'=> $post_ID,
670
- 'form_name'=>$form_name,
671
- 'redirect' => $redirect_value);
672
-
673
- echo json_encode($output,JSON_FORCE_OBJECT);
674
- wp_die();
675
- }
676
- }
677
- }
678
-
679
- add_filter( 'default_content', 'inbound_forms_default_content', 10, 2 );
680
- if (!function_exists('inbound_forms_default_content')) {
681
- function inbound_forms_default_content( $content, $post ) {
682
- if (!isset($post))
683
- return;
684
- if( $post->post_type === 'inbound-forms' ) {
685
-
686
- $content = 'This is the email response. Do not use shortcodes or forms here. They will not work in this email setup component. (Delete this text)';
687
-
688
- }
689
-
690
- return $content;
691
- }
692
- }
693
-
694
- /* Shortcode moved to shared form class */
695
- if (!function_exists('inbound_form_get_data')) {
696
- add_action('wp_ajax_inbound_form_get_data', 'inbound_form_get_data');
697
-
698
- function inbound_form_get_data()
699
- {
700
- // Post Values
701
- $post_ID = (isset( $_POST['form_id'] )) ? $_POST['form_id'] : "";
702
-
703
- if (isset( $_POST['form_id'])&&!empty( $_POST['form_id']))
704
- {
705
- $check_nonce = wp_verify_nonce( $_POST['nonce'], 'inbound-shortcode-nonce' );
706
- if( !$check_nonce ) {
707
- //echo json_encode("Found");
708
- exit;
709
- }
710
-
711
- $form_settings_data = get_post_meta( $post_ID, 'inbound_form_settings', TRUE );
712
- $field_count = get_post_meta( $post_ID, 'inbound_form_field_count', TRUE );
713
- $shortcode = get_post_meta( $post_ID, 'inbound_shortcode', TRUE );
714
- $inbound_form_values = get_post_meta( $post_ID, 'inbound_form_values', TRUE );
715
-
716
-
717
- /**get stored email response info. Mainly used when selecting a form starting template**/
718
- $send_email = get_post_meta( $post_ID, 'inbound_email_send_notification', true);//yes/no select send response email
719
- $send_email = '&inbound_email_send_notification=' . $send_email;//format the data into a string which fill_form_fields() over in shortcodes.js will use to fill in the field
720
-
721
- $email_template_id = get_post_meta( $post_ID, 'inbound_email_send_notification_template', true );// email template id, or 'custom' email flag
722
-
723
- /*if a custom email response is to be used, custom will be true*/
724
- if($email_template_id == 'custom'){
725
- $content = get_post($post_ID); //the email is contained in the post content
726
- $content = $content->post_content;
727
- $custom_email_response = '&content=' . $content;
728
-
729
- $custom_email_subject = get_post_meta( $post_ID, 'inbound_confirmation_subject', true ); //the subject is in the meta
730
- $custom_email_subject = '&inbound_confirmation_subject=' . $custom_email_subject;
731
- }else{
732
- $custom_email_response = '';
733
- $custom_email_subject = '';
734
- }
735
-
736
- $email_template_id = '&inbound_email_send_notification_template=' . $email_template_id;
737
-
738
- /*concatenate into a big string and add it to $inbound_form_values*/
739
- $inbound_form_values .= ($send_email . $email_template_id . $custom_email_response . $custom_email_subject);
740
-
741
-
742
- /* update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
743
- update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
744
- update_post_meta( $post_ID, 'inbound_form_values', $form_values );
745
- update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
746
- */
747
-
748
- $output = array('inbound_shortcode'=> $shortcode,
749
- 'field_count'=>$field_count,
750
- 'form_settings_data' => $form_settings_data,
751
- 'field_values'=>$inbound_form_values);
752
-
753
- echo json_encode($output,JSON_FORCE_OBJECT);
754
-
755
- }
756
- wp_die();
757
- }
758
- }
759
-
760
- if (!function_exists('inbound_form_auto_publish')) {
761
- /* Shortcode moved to shared form class */
762
- add_action('wp_ajax_inbound_form_auto_publish', 'inbound_form_auto_publish');
763
- //add_action('wp_ajax_nopriv_inbound_form_auto_publish', 'inbound_form_auto_publish');
764
-
765
- function inbound_form_auto_publish()
766
- {
767
- // Post Values
768
- $post_ID = (isset( $_POST['post_id'] )) ? $_POST['post_id'] : "";
769
- $post_title = (isset( $_POST['post_title'] )) ? $_POST['post_title'] : "";
770
-
771
- if (isset( $_POST['post_id'])&&!empty( $_POST['post_id']))
772
- {
773
- // Update Post status to published immediately
774
- // Update post 37
775
- $my_post = array(
776
- 'ID' => $post_ID,
777
- 'post_title' => $post_title,
778
- 'post_status' => 'publish'
779
- );
780
-
781
- // Update the post into the database
782
- wp_update_post( $my_post );
783
- }
784
- wp_die();
785
- }
786
- }
787
-
788
- if (!function_exists('inbound_form_add_lead_list')) {
789
-
790
- add_action('wp_ajax_inbound_form_add_lead_list', 'inbound_form_add_lead_list');
791
-
792
- function inbound_form_add_lead_list()
793
- {
794
- if(isset($_POST['list_val']) && !empty($_POST['list_val'])){
795
-
796
- $list_title = $_POST['list_val'];
797
-
798
- $taxonomy = 'wplead_list_category';
799
-
800
- $list_parent = $_POST['list_parent_val'];
801
-
802
- $term_array = wp_insert_term( $list_title, $taxonomy, $args = array('parent' => $list_parent) );
803
-
804
- if($term_array['term_id']){
805
-
806
- $term_id = $term_array['term_id'];
807
-
808
- $term = get_term( $term_id, $taxonomy );
809
-
810
- $name = $term->name;
811
-
812
- $response_arr = array('status' => true, 'term_id' => $term_id, 'name' => $name);
813
-
814
- } else {
815
-
816
- $response_arr = array('status' => false);
817
- }
818
-
819
- echo json_encode($response_arr);
820
-
821
- }
822
-
823
- wp_die();
824
- }
825
- }
1
+ <?php
2
+ /**
3
+ * Inbound Forms Shortcode Options
4
+ * Forms code found in /shared/classes/form.class.php
5
+ * master code
6
+ */
7
+
8
+ if (empty($lead_list_names)){
9
+ // if lead transient doesn't exist use defaults
10
+ $lead_list_names = array(
11
+ 'null' => 'No Lists detected',
12
+ );
13
+ }
14
+
15
+ if (empty($lead_tag_names)){
16
+ // if lead transient doesn't exist use defaults
17
+ $lead_tag_names = array(
18
+ 'null' => 'No Lists detected',
19
+ );
20
+ }
21
+
22
+
23
+ $shortcodes_config['forms'] = array(
24
+ 'no_preview' => false,
25
+ 'options' => array(
26
+ 'insert_default' => array(
27
+ 'name' => __('Choose Starting Template', 'inbound-pro' ),
28
+ 'desc' => __('Start Building Your Form from premade templates', 'inbound-pro' ),
29
+ 'type' => 'select',
30
+ 'options' => $form_names,
31
+ 'std' => 'none',
32
+ 'class' => 'main-form-settings',
33
+ ),
34
+ 'form_name' => array(
35
+ 'name' => __('Form Name<span class="small-required-text">*</span>', 'inbound-pro' ),
36
+ 'desc' => __('This is for internal use and is not shown to visitors', 'inbound-pro' ),
37
+ 'type' => 'text',
38
+ 'placeholder' => "Example: XYZ Whitepaper Download",
39
+ 'std' => '',
40
+ 'class' => 'main-form-settings',
41
+ ),
42
+ /*'confirmation' => array(
43
+ 'name' => __('Form Layout', 'inbound-pro' ),
44
+ 'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
45
+ 'type' => 'select',
46
+ 'options' => array(
47
+ "redirect" => "Redirect After Form Completion",
48
+ "text" => "Display Text on Same Page",
49
+ ),
50
+ 'std' => 'redirect'
51
+ ),*/
52
+ 'redirect' => array(
53
+ 'name' => __('Redirect URL', 'inbound-pro' ),
54
+ 'desc' => __('Where do you want to send people after they fill out the form? Please note: http:// is required. Leave blank to prevent redirection.', 'inbound-pro' ),
55
+ 'type' => 'text',
56
+ 'placeholder' => "http://www.yoursite.com/thank-you",
57
+ 'std' => '',
58
+ 'reveal_on' => 'redirect',
59
+ 'class' => 'main-form-settings',
60
+ ),
61
+ /*'thank_you_text' => array(
62
+ 'name' => __('Field Description <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
63
+ 'desc' => __('Put field description here.', 'inbound-pro' ),
64
+ 'type' => 'textarea',
65
+ 'std' => '',
66
+ 'class' => 'advanced',
67
+ 'reveal_on' => 'text'
68
+ ), */
69
+ 'notify' => array(
70
+ 'name' => __('Notify on Form Completions<span class="small-required-text">*</span>', 'inbound-pro' ),
71
+ 'desc' => __('Who should get admin notifications on this form?<br>For multiple notifications separate email addresses with commas', 'inbound-pro' ),
72
+ 'type' => 'text',
73
+ 'placeholder' => "youremail@email.com",
74
+ 'std' => '',
75
+ 'class' => 'main-form-settings',
76
+ ),
77
+ 'notify_subject' => array(
78
+ 'name' => __('Admin Email Subject Line<span class="small-required-text">*</span>', 'inbound-pro' ),
79