WP Google Analytics Events - Version 2.6.1

Version Description

Download this release

Release Info

Developer yuvalo
Plugin Icon 128x128 WP Google Analytics Events
Version 2.6.1
Comparing to
See all releases

Code changes from version 2.6.0 to 2.6.1

ga-scroll-event.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: WP Google Analytics Events
5
  Plugin URI: http://wpflow.com
6
  Description: Adds the Google Analytics code to your website and enables you to send events on scroll or click.
7
- Version: 2.6.0
8
  Author: PineWise
9
  Author URI: http://wpflow.com
10
  License: GPLv2
@@ -29,7 +29,7 @@ plugin_dir_url(__FILE__));
29
  // Current version number
30
  if (!defined('GA_EVENTS_VERSION'))
31
  define('GA_EVENTS_VERSION',
32
- '2.6.0');
33
 
34
  // Dependencies
35
 
@@ -75,6 +75,8 @@ if (!class_exists('GaEvents')) {
75
  add_action('wp_ajax_wpflow_add_event', 'wpflow_event_ajax_handler');
76
  add_action('wp_ajax_wpflow_edit_event', 'wpflow_event_ajax_handler');
77
  add_action('wp_ajax_wpflow_delete_event', 'wpflow_event_ajax_handler');
 
 
78
  function wpflow_event_ajax_handler()
79
  {
80
  /**
@@ -203,6 +205,8 @@ if (!class_exists('GaEvents')) {
203
  add_action('admin_init',
204
  array($settings_instance, 'ga_events_initialize_plugin_options'));
205
 
 
 
206
  // Display settings link next to plugin listing on plugins page
207
  $plugin = plugin_basename(__FILE__);
208
  add_filter("plugin_action_links_$plugin",
@@ -219,7 +223,7 @@ if (!class_exists('GaEvents')) {
219
  }
220
  }
221
 
222
- function load_admin_scripts()
223
  {
224
 
225
  $ga_options = get_option('ga_events_options');
@@ -268,7 +272,9 @@ if (!class_exists('GaEvents')) {
268
 
269
  function enqueue_admin_scripts($hook)
270
  {
271
- if (strpos($hook, "wp-google-analytics-events") == false) {
 
 
272
  return;
273
  }
274
 
@@ -299,7 +305,9 @@ if (!class_exists('GaEvents')) {
299
 
300
  function enqueue_admin_scripts_debug($hook)
301
  {
302
- if (strpos($hook, "wp-google-analytics-events") == false) {
 
 
303
  return;
304
  }
305
  // Localize plugin options in database for use in main JS script
@@ -362,6 +370,8 @@ if (!class_exists('GaEvents')) {
362
  'ga_options',
363
  prepare_ga_options_for_frontend());
364
 
 
 
365
  /* ------------------------------------------------------------- *
366
  * Enqueue frontend scripts
367
  * -------------------------------------------------------------- */
@@ -390,6 +400,8 @@ if (!class_exists('GaEvents')) {
390
  'ga_options',
391
  prepare_ga_options_for_frontend());
392
 
 
 
393
  /* --------------------------------------------------------------------- *
394
  * Enqueue frontend scripts
395
  * --------------------------------------------------------------------- */
@@ -421,6 +433,37 @@ if (!class_exists('GaEvents')) {
421
  0);
422
  }
423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
 
425
  function isAdvancedModeOn()
426
  {
@@ -431,6 +474,37 @@ if (!class_exists('GaEvents')) {
431
  return false;
432
 
433
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  }
435
 
436
  /*
@@ -445,8 +519,12 @@ if (!class_exists('GaEvents')) {
445
  unset($ga_options[$key_to_remove]);
446
  }
447
  }
 
 
 
448
  return $ga_options;
449
  }
 
450
  }
451
 
452
 
4
  Plugin Name: WP Google Analytics Events
5
  Plugin URI: http://wpflow.com
6
  Description: Adds the Google Analytics code to your website and enables you to send events on scroll or click.
7
+ Version: 2.6.1
8
  Author: PineWise
9
  Author URI: http://wpflow.com
10
  License: GPLv2
29
  // Current version number
30
  if (!defined('GA_EVENTS_VERSION'))
31
  define('GA_EVENTS_VERSION',
32
+ '2.6.1');
33
 
34
  // Dependencies
35
 
75
  add_action('wp_ajax_wpflow_add_event', 'wpflow_event_ajax_handler');
76
  add_action('wp_ajax_wpflow_edit_event', 'wpflow_event_ajax_handler');
77
  add_action('wp_ajax_wpflow_delete_event', 'wpflow_event_ajax_handler');
78
+ add_action('wp_ajax_wpflow_delete_event', 'wpflow_event_ajax_handler');
79
+ add_action('wp_ajax_wpflow_deactivate_event', array($this, 'wpflow_plugin_deactivation_handler'));
80
  function wpflow_event_ajax_handler()
81
  {
82
  /**
205
  add_action('admin_init',
206
  array($settings_instance, 'ga_events_initialize_plugin_options'));
207
 
208
+ add_filter("admin_footer", array($settings_instance, 'ga_events_feedback_form_html'));
209
+
210
  // Display settings link next to plugin listing on plugins page
211
  $plugin = plugin_basename(__FILE__);
212
  add_filter("plugin_action_links_$plugin",
223
  }
224
  }
225
 
226
+ function load_admin_scripts()
227
  {
228
 
229
  $ga_options = get_option('ga_events_options');
272
 
273
  function enqueue_admin_scripts($hook)
274
  {
275
+ $screen = get_current_screen();
276
+
277
+ if (strpos($hook, "wp-google-analytics-events") == false && $screen->id !== "plugins") {
278
  return;
279
  }
280
 
305
 
306
  function enqueue_admin_scripts_debug($hook)
307
  {
308
+ $screen = get_current_screen();
309
+
310
+ if (strpos($hook, "wp-google-analytics-events" ) == false && $screen->id != "plugins") {
311
  return;
312
  }
313
  // Localize plugin options in database for use in main JS script
370
  'ga_options',
371
  prepare_ga_options_for_frontend());
372
 
373
+
374
+ $this->localize_placeholders();
375
  /* ------------------------------------------------------------- *
376
  * Enqueue frontend scripts
377
  * -------------------------------------------------------------- */
400
  'ga_options',
401
  prepare_ga_options_for_frontend());
402
 
403
+ $this->localize_placeholders();
404
+
405
  /* --------------------------------------------------------------------- *
406
  * Enqueue frontend scripts
407
  * --------------------------------------------------------------------- */
433
  0);
434
  }
435
 
436
+ function localize_placeholders() {
437
+
438
+ global $wp_query;
439
+
440
+ $page_title = ! empty( $wp_query->post->post_title ) ? $wp_query->post->post_title : '';
441
+
442
+ $translation_array = array(
443
+ // home page is home page not page title
444
+ 'is_front_page' => is_front_page(),
445
+ 'page_title' => $page_title,
446
+ );
447
+
448
+ $ga_options = get_option( 'ga_events_options' );
449
+ $debug_mode = isset($ga_options[ 'script_debug_mode' ]) ? $ga_options[ 'script_debug_mode' ] : '0';
450
+
451
+ // These need to be conditional on GAE_SCRIPT_DEBUG
452
+ if ( GAE_SCRIPT_DEBUG || $debug_mode ) {
453
+ // gae_mapper is bundled with admin and frontend scripts
454
+ wp_localize_script( 'ga_events_main_script',
455
+ 'gaePlaceholders',
456
+ $translation_array );
457
+ } else {
458
+ wp_localize_script( 'admin_bundle',
459
+ 'gaePlaceholders',
460
+ $translation_array );
461
+
462
+ wp_localize_script( 'ga_events_frontend_bundle',
463
+ 'gaePlaceholders',
464
+ $translation_array );
465
+ }
466
+ }
467
 
468
  function isAdvancedModeOn()
469
  {
474
  return false;
475
 
476
  }
477
+
478
+ function wpflow_plugin_deactivation_handler() {
479
+ print (var_dump($_POST));
480
+ $current_plugin_version = GA_EVENTS_VERSION;
481
+ $current_user = wp_get_current_user();
482
+ $user_diaplay_name = $current_user->display_name;
483
+ $user_email = isset($current_user->user_email) && $current_user->user_email != "" ? $current_user->user_email : "" ;
484
+ $from = isset($user_diaplay_name) ? $user_diaplay_name." <".$user_email.">" : $user_email;
485
+
486
+ $headers[] = "Content-Type: text/html; charset=UTF-8";
487
+ $headers[] = "From: ".$from;
488
+ $headers[] = "Reply-To: ".$from;
489
+
490
+ $feedback = isset($_POST["feedback"]) ? sanitize_text_field($_POST["feedback"]) : "";
491
+ $helptext = isset($_POST["helpme-text"]) ? sanitize_text_field($_POST["helpme-text"]): "";
492
+ $site_info = home_url();
493
+
494
+ // Include version information
495
+ // Include wordpress version information
496
+
497
+ $text = "Feedback From for version: ".$current_plugin_version."<br>";
498
+ $text .= "Reason for deactivation: ".$feedback."<br>";
499
+ $text .= "Help me with: ".$helptext."<br>";
500
+ $text .= "website: ".$site_info."<br>";
501
+ $subject = $current_plugin_version." - Deactivation Feedback";
502
+ wp_mail( 'feedback@wpflow.com', $subject, $text, $headers );
503
+ error_log($text);
504
+
505
+ wp_die(); // All ajax handlers die when finished
506
+
507
+ }
508
  }
509
 
510
  /*
519
  unset($ga_options[$key_to_remove]);
520
  }
521
  }
522
+ if (! array_key_exists("force_snippet", $ga_options)) {
523
+ $ga_options['force_snippet'] = "none";
524
+ }
525
  return $ga_options;
526
  }
527
+
528
  }
529
 
530
 
include/Activation.php CHANGED
@@ -15,7 +15,12 @@ class GAEActivation
15
  'tracking_id' => '',
16
  'gtm_id' => '',
17
  'domain' => '',
18
- // Roles for which tracking is disabled
 
 
 
 
 
19
  'scroll_elements' => array(),
20
  'click_elements' => array(),
21
  );
@@ -62,7 +67,19 @@ class GAEActivation
62
  }
63
  }
64
 
65
- // last value in array_merge overwrites others
 
 
 
 
 
 
 
 
 
 
 
 
66
  if (isset($updated)) {
67
  // last value in array_merge overwrites others
68
  update_option('ga_events_options',
@@ -72,6 +89,11 @@ class GAEActivation
72
  GA_EVENTS_VERSION);
73
  }
74
 
 
 
 
 
 
75
  private static function version_2_6_0_upgrade($existing_values)
76
  {
77
  // Conditionally determine the desired snippet type based on existing
15
  'tracking_id' => '',
16
  'gtm_id' => '',
17
  'domain' => '',
18
+ 'tel_link_tracking' => '0',
19
+ 'email_link_tracking' => '0',
20
+ 'download_tracking' => '0',
21
+ 'download_tracking_type' => array("pdf", "mp3", "pptx", "docx"),
22
+ 'force_snippet' => "none",
23
+ // Roles for which tracking is disabled
24
  'scroll_elements' => array(),
25
  'click_elements' => array(),
26
  );
67
  }
68
  }
69
 
70
+
71
+ if (version_compare(GA_EVENTS_VERSION, $installed_version) > 0) {
72
+ if (version_compare("2.6.1", $installed_version) > 0) {
73
+ if (isset($updated)) {
74
+ $updated = static::version_2_6_1_upgrade($updated);
75
+ } else {
76
+ $updated = static::version_2_6_1_upgrade($existing_values);
77
+ }
78
+ }
79
+ }
80
+
81
+
82
+ // last value in array_merge overwrites others
83
  if (isset($updated)) {
84
  // last value in array_merge overwrites others
85
  update_option('ga_events_options',
89
  GA_EVENTS_VERSION);
90
  }
91
 
92
+ private static function version_2_6_1_upgrade($existing_values) {
93
+ $existing_values['download_tracking_type'] = array("pdf", "mp3", "pptx", "docx");
94
+ return $existing_values;
95
+ }
96
+
97
  private static function version_2_6_0_upgrade($existing_values)
98
  {
99
  // Conditionally determine the desired snippet type based on existing
include/Settings.php CHANGED
@@ -253,6 +253,28 @@ class GAESettings {
253
  'ga_events_main' );
254
 
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  // Advanced options checkbox
257
  add_settings_field( 'ga_events_advanced',
258
  '',
@@ -260,6 +282,13 @@ class GAESettings {
260
  'ga_events_options_group',
261
  'ga_events_main' );
262
 
 
 
 
 
 
 
 
263
  // Script debug mode
264
  add_settings_field( 'ga_events_script_debug_mode',
265
  '',
@@ -319,6 +348,23 @@ class GAESettings {
319
  $updated[ 'anonymizeip' ] = '0';
320
  }
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  // The case of the empty checkboxes - advanced mode
323
  if ( ! isset( $input[ 'advanced' ] ) ) {
324
  $updated[ 'advanced' ] = '0';
@@ -338,6 +384,15 @@ class GAESettings {
338
  return $updated;
339
  }
340
 
 
 
 
 
 
 
 
 
 
341
  /* ------------------------------------------------------------------------ *
342
  * Section Callbacks
343
  * ------------------------------------------------------------------------ */
@@ -440,6 +495,32 @@ class GAESettings {
440
  echo "<input id='gtm_id' name='ga_events_options[gtm_id]' type='text' value='$gtm_id' />";
441
  }
442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  function ga_events_setting_adv_input() {
444
  $options = get_option( 'ga_events_options' );
445
  $value = isset( $options[ 'advanced' ] ) ? $options[ 'advanced' ] : '0';
@@ -449,7 +530,34 @@ class GAESettings {
449
  false ) . " />";
450
  }
451
 
452
- function ga_events_setting_script_debug_mode_input() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  $options = get_option( 'ga_events_options' );
454
  $value = isset( $options[ 'script_debug_mode' ] ) ? $options[ 'script_debug_mode' ] : '0';
455
  echo "<label>Support Friendly Scripts " . $this->ga_tooltip( 'Uncheck for script minimization' ) . "</label>";
@@ -615,5 +723,5 @@ class GAESettings {
615
  return $value;
616
  }
617
 
618
- }
619
 
253
  'ga_events_main' );
254
 
255
 
256
+
257
+ // Download Tracking options checkbox
258
+ add_settings_field( 'ga_events_download_tracking',
259
+ '',
260
+ array($this, 'ga_events_setting_download_tracking_input'),
261
+ 'ga_events_options_group',
262
+ 'ga_events_main' );
263
+
264
+ // Email Links Tracking options checkbox
265
+ add_settings_field( 'email_link_tracking',
266
+ '',
267
+ array($this, 'ga_events_setting_email_link_tracking_input'),
268
+ 'ga_events_options_group',
269
+ 'ga_events_main' );
270
+
271
+ // // Tel Links Tracking options checkbox
272
+ // add_settings_field( 'tel_link_tracking',
273
+ // '',
274
+ // array($this, 'ga_events_setting_tel_link_tracking_input'),
275
+ // 'ga_events_options_group',
276
+ // 'ga_events_main' );
277
+
278
  // Advanced options checkbox
279
  add_settings_field( 'ga_events_advanced',
280
  '',
282
  'ga_events_options_group',
283
  'ga_events_main' );
284
 
285
+ // Force Snippet
286
+ add_settings_field( 'ga_events_force_tracking_code',
287
+ '',
288
+ array($this, 'ga_events_force_tracking_code_input'),
289
+ 'ga_events_options_group',
290
+ 'ga_events_main' );
291
+
292
  // Script debug mode
293
  add_settings_field( 'ga_events_script_debug_mode',
294
  '',
348
  $updated[ 'anonymizeip' ] = '0';
349
  }
350
 
351
+ // The case of the empty checkboxes - download tracking
352
+ if ( ! isset( $input[ 'download_tracking' ] ) ) {
353
+ $updated[ 'download_tracking' ] = '0';
354
+ }
355
+
356
+
357
+
358
+ // The case of the empty checkboxes - email links tracking
359
+ if ( ! isset( $input[ 'email_link_tracking' ] ) ) {
360
+ $updated[ 'email_link_tracking' ] = '0';
361
+ }
362
+
363
+ // // The case of the empty checkboxes - tel links tracking
364
+ // if ( ! isset( $input[ 'tel_link_tracking' ] ) ) {
365
+ // $updated[ 'tel_link_tracking' ] = '0';
366
+ // }
367
+
368
  // The case of the empty checkboxes - advanced mode
369
  if ( ! isset( $input[ 'advanced' ] ) ) {
370
  $updated[ 'advanced' ] = '0';
384
  return $updated;
385
  }
386
 
387
+ function ga_events_feedback_form_html() {
388
+ $screen = get_current_screen();
389
+ if ($screen->id == "plugins") {
390
+ if ( file_exists( GAE_PLUGIN_PATH . '/templates/feedback-modal.php' ) ) {
391
+ include GAE_PLUGIN_PATH . '/templates/feedback-modal.php';
392
+ }
393
+ }
394
+ }
395
+
396
  /* ------------------------------------------------------------------------ *
397
  * Section Callbacks
398
  * ------------------------------------------------------------------------ */
495
  echo "<input id='gtm_id' name='ga_events_options[gtm_id]' type='text' value='$gtm_id' />";
496
  }
497
 
498
+ function ga_events_setting_download_tracking_input() {
499
+ $options = get_option( 'ga_events_options' );
500
+ $value = isset( $options[ 'download_tracking' ] ) ? $options[ 'download_tracking' ] : '0';
501
+ echo "<label>Track Downloads (PDF, MP3, PPTX, DOCX): </label>";
502
+ echo "<input id='download_tracking' name='ga_events_options[download_tracking]' type='checkbox' value='1'" . checked( $value,
503
+ '1',
504
+ false ) . " />";
505
+ }
506
+ //
507
+ // function ga_events_setting_tel_link_tracking_input() {
508
+ // $options = get_option( 'ga_events_options' );
509
+ // $value = isset( $options[ 'tel_link_tracking' ] ) ? $options[ 'tel_link_tracking' ] : '0';
510
+ // echo "<label>Track Telephone Number Links (tel:): </label>";
511
+ // echo "<input id='tel_link_tracking' name='ga_events_options[tel_link_tracking]' type='checkbox' value='1'" . checked( $value,
512
+ // '1',
513
+ // false ) . " />";
514
+ // }
515
+ function ga_events_setting_email_link_tracking_input() {
516
+ $options = get_option( 'ga_events_options' );
517
+ $value = isset( $options[ 'email_link_tracking' ] ) ? $options[ 'email_link_tracking' ] : '0';
518
+ echo "<label>Track Email Links (mailto:): </label>";
519
+ echo "<input id='email_link_tracking' name='ga_events_options[email_link_tracking]' type='checkbox' value='1'" . checked( $value,
520
+ '1',
521
+ false ) . " />";
522
+ }
523
+
524
  function ga_events_setting_adv_input() {
525
  $options = get_option( 'ga_events_options' );
526
  $value = isset( $options[ 'advanced' ] ) ? $options[ 'advanced' ] : '0';
530
  false ) . " />";
531
  }
532
 
533
+
534
+ function ga_events_force_tracking_code_input() {
535
+
536
+ $options = get_option( 'ga_events_options' );
537
+ $track = isset( $options[ 'advanced' ] ) && $options[ 'advanced' ] == true;
538
+
539
+ /*
540
+ * TO DO Needs testing with upgrade
541
+ * Should have been set in upgrade function in wp-google-analytics-events-pro.php
542
+ */
543
+ $defaultOption = isset( $options[ 'force_snippet' ] ) ? $options[ 'force_snippet' ] : 'none';
544
+ echo $track ? "<div id='forcesnopperwrap'>" : "<div style='display:none;' id='forcesnopperwrap'>";
545
+
546
+ echo "<label>Force plugin to use this code snippet: " . $this->ga_tooltip( 'Please see docs for help with deciding this option' ) . "</label>";
547
+ ?>
548
+ <select id="force_snippet" name='ga_events_options[force_snippet]'>
549
+ <option value="gtm" <?php selected($defaultOption, 'gtm') ?>>Google Tag Manager Container</option>
550
+ <option value="gst" <?php selected($defaultOption, 'gst') ?>>Global Site Tag (gtag.js)</option>
551
+ <option value="universal" <?php selected($defaultOption, 'universal') ?>>Universal (analytics.js)</option>
552
+ <option value='none' <?php selected($defaultOption, 'none') ?>>None</option>
553
+ </select>
554
+ </div>
555
+ <?php
556
+ }
557
+
558
+
559
+
560
+ function ga_events_setting_script_debug_mode_input() {
561
  $options = get_option( 'ga_events_options' );
562
  $value = isset( $options[ 'script_debug_mode' ] ) ? $options[ 'script_debug_mode' ] : '0';
563
  echo "<label>Support Friendly Scripts " . $this->ga_tooltip( 'Uncheck for script minimization' ) . "</label>";
723
  return $value;
724
  }
725
 
726
+ }
727
 
include/Snippets.php CHANGED
@@ -2,11 +2,13 @@
2
 
3
  class GAESnippets {
4
 
5
- static function add_google_tag_manager_container() {
6
- $options = get_option( 'ga_events_options' );
7
- $gtm_id = isset( $options[ 'gtm_id' ] ) ? $options[ 'gtm_id' ] : '';
 
 
8
 
9
- echo <<<EOF
10
  <!-- Google Tag Manager -->
11
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
12
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
@@ -16,17 +18,19 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
16
  <!-- End Google Tag Manager -->
17
 
18
  EOF;
19
- // TODO discuss this implementtion with Yuval as it requires theme modification
20
- add_action( 'wp_after_body',
21
- 'add_google_tag_manager_noscript' );
22
- }
 
23
 
24
  static function add_google_tag_manager_noscript() {
25
-
 
26
  // This part is for running GA without JS on page. However this plugin requires JS, so the snippet is strictly redundant, although GA detetcts its absence
27
  echo <<<EOF
28
  <!-- Google Tag Manager (noscript) -->
29
- <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WPTPJ6G"
30
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
31
  <!-- End Google Tag Manager (noscript) -->
32
  EOF;
@@ -35,9 +39,10 @@ EOF;
35
  static function add_global_site_tag() {
36
  $options = get_option( 'ga_events_options' );
37
  $id = $options[ 'tracking_id' ];
38
- $anonymize_ip = $options[ 'anonymizeip' ];
39
- $anonymize_ip_string = (isset($anonymize_ip) && $anonymize_ip) ? "{ 'anonymize_ip': true }" : "{ 'anonymize_ip': false }";
40
- echo <<<EOF
 
41
  <!-- Global site tag (gtag.js) - Google Analytics -->
42
  <script async src="https://www.googletagmanager.com/gtag/js?id=$id"></script>
43
  <script>
@@ -51,20 +56,23 @@ EOF;
51
  </script>
52
 
53
  EOF;
 
54
  }
55
 
56
- static function add_universal_tag() {
57
- $options = get_option( 'ga_events_options' );
 
58
 
59
- $id = $options[ 'tracking_id' ];
60
- if ( isset( $options[ 'domain' ] ) && $options[ 'domain' ] != "" ) {
61
- $domain = $options[ 'domain' ];
62
- } else {
63
- $domain = 'auto';
64
- }
65
- $ga_create_call = (isset( $options[ 'anonymizeip' ] ) && $options[ 'anonymizeip' ]) ? "ga('create','$id', '$domain', {anonymizeIp: true});" : "ga('create','$id', '$domain');";
 
66
 
67
- echo <<<EOF
68
  <script>
69
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
70
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -75,6 +83,7 @@ ga('send', 'pageview');
75
  </script>
76
 
77
  EOF;
 
78
  }
79
 
80
  static function add_legacy_tag() {
@@ -82,17 +91,19 @@ EOF;
82
  $options = get_option( 'ga_events_options' );
83
 
84
  $id = $options[ 'tracking_id' ];
85
- if ( isset( $options[ 'domain' ] ) && $options[ 'domain' ] != "" ) {
86
- $domain = $options[ 'domain' ];
87
- } else {
88
- $domain = 'auto';
89
- }
90
- if ( $domain == 'auto' ) {
91
- $domain = $_SERVER[ 'SERVER_NAME' ];
92
- }
93
- $anon = (isset( $options[ 'anonymizeip' ] ) && $options[ 'anonymizeip' ]) ? "_gaq.push (['_gat._anonymizeIp'])" : "";
94
-
95
- echo <<<EOF
 
 
96
  <script type='text/javascript'>
97
  var _gaq = _gaq || [];
98
  _gaq.push(['_setAccount', '$id']);
@@ -108,6 +119,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga
108
  </script>
109
 
110
  EOF;
 
111
  }
112
 
113
  /*
2
 
3
  class GAESnippets {
4
 
5
+ static function add_google_tag_manager_container()
6
+ {
7
+ $options = get_option('ga_events_options');
8
+ $gtm_id = isset($options['gtm_id']) ? $options['gtm_id'] : '';
9
+ if (isset($gtm_id) && $gtm_id != "") {
10
 
11
+ echo <<<EOF
12
  <!-- Google Tag Manager -->
13
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
14
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
18
  <!-- End Google Tag Manager -->
19
 
20
  EOF;
21
+ // TODO discuss this implementtion with Yuval as it requires theme modification
22
+ add_action('wp_after_body',
23
+ 'add_google_tag_manager_noscript');
24
+ }
25
+ }
26
 
27
  static function add_google_tag_manager_noscript() {
28
+ $options = get_option('ga_events_options');
29
+ $gtm_id = isset($options['gtm_id']) ? $options['gtm_id'] : '';
30
  // This part is for running GA without JS on page. However this plugin requires JS, so the snippet is strictly redundant, although GA detetcts its absence
31
  echo <<<EOF
32
  <!-- Google Tag Manager (noscript) -->
33
+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=$gtm_id"
34
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
35
  <!-- End Google Tag Manager (noscript) -->
36
  EOF;
39
  static function add_global_site_tag() {
40
  $options = get_option( 'ga_events_options' );
41
  $id = $options[ 'tracking_id' ];
42
+ if (isset($id) && $id != "") {
43
+ $anonymize_ip = $options['anonymizeip'];
44
+ $anonymize_ip_string = (isset($anonymize_ip) && $anonymize_ip) ? "{ 'anonymize_ip': true }" : "{ 'anonymize_ip': false }";
45
+ echo <<<EOF
46
  <!-- Global site tag (gtag.js) - Google Analytics -->
47
  <script async src="https://www.googletagmanager.com/gtag/js?id=$id"></script>
48
  <script>
56
  </script>
57
 
58
  EOF;
59
+ }
60
  }
61
 
62
+ static function add_universal_tag()
63
+ {
64
+ $options = get_option('ga_events_options');
65
 
66
+ $id = $options['tracking_id'];
67
+ if (isset($id) && $id != "") {
68
+ if (isset($options['domain']) && $options['domain'] != "") {
69
+ $domain = $options['domain'];
70
+ } else {
71
+ $domain = 'auto';
72
+ }
73
+ $ga_create_call = (isset($options['anonymizeip']) && $options['anonymizeip']) ? "ga('create','$id', '$domain', {anonymizeIp: true});" : "ga('create','$id', '$domain');";
74
 
75
+ echo <<<EOF
76
  <script>
77
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
78
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
83
  </script>
84
 
85
  EOF;
86
+ }
87
  }
88
 
89
  static function add_legacy_tag() {
91
  $options = get_option( 'ga_events_options' );
92
 
93
  $id = $options[ 'tracking_id' ];
94
+ if (isset($id) && $id != "") {
95
+
96
+ if (isset($options['domain']) && $options['domain'] != "") {
97
+ $domain = $options['domain'];
98
+ } else {
99
+ $domain = 'auto';
100
+ }
101
+ if ($domain == 'auto') {
102
+ $domain = $_SERVER['SERVER_NAME'];
103
+ }
104
+ $anon = (isset($options['anonymizeip']) && $options['anonymizeip']) ? "_gaq.push (['_gat._anonymizeIp'])" : "";
105
+
106
+ echo <<<EOF
107
  <script type='text/javascript'>
108
  var _gaq = _gaq || [];
109
  _gaq.push(['_setAccount', '$id']);
119
  </script>
120
 
121
  EOF;
122
+ }
123
  }
124
 
125
  /*
include/install.php CHANGED
@@ -12,7 +12,8 @@ function ga_events_install() {
12
  'status' => '',
13
  'gtm_id' => '',
14
  'domain' => '',
15
- // Roles for which tracking is disabled
 
16
  'scroll_track_elements' => array(),
17
  'click_track_elements' => array(),
18
  // Roles with permission to modify plugin options
12
  'status' => '',
13
  'gtm_id' => '',
14
  'domain' => '',
15
+ 'force_snippet' => "none",
16
+ // Roles for which tracking is disabled
17
  'scroll_track_elements' => array(),
18
  'click_track_elements' => array(),
19
  // Roles with permission to modify plugin options
js/admin.js CHANGED
@@ -35,8 +35,16 @@ jQuery(document).ready(function($){
35
  at: "right top",
36
  collision: "none"
37
  }
38
- });
39
 
 
 
 
 
 
 
 
 
40
 
41
  $('.btn_upload').on('click', function (e){
42
  $('.settings_content').slideDown();
35
  at: "right top",
36
  collision: "none"
37
  }
38
+ })
39
 
40
+ $('#advanced:checkbox').change(function (){
41
+ var checked = $(this).is(':checked');
42
+ if (checked){
43
+ $('#forcesnopperwrap').show();
44
+ } else {
45
+ $('#forcesnopperwrap').hide();
46
+ }
47
+ });
48
 
49
  $('.btn_upload').on('click', function (e){
50
  $('.settings_content').slideDown();
js/ajax-settings.js CHANGED
@@ -17,6 +17,30 @@ var gaeAjax = ( function ( $ ) {
17
  $(".ga_main .edit a").click(openAndPoplulateEventModal);
18
  // Populate and Show the Delete event modal
19
  $(".ga_main .delete a").click(openAndPoplulateEventModal);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  });
21
 
22
 
@@ -73,6 +97,7 @@ var gaeAjax = ( function ( $ ) {
73
  }
74
  }
75
  }
 
76
  } )( jQuery );
77
 
78
 
17
  $(".ga_main .edit a").click(openAndPoplulateEventModal);
18
  // Populate and Show the Delete event modal
19
  $(".ga_main .delete a").click(openAndPoplulateEventModal);
20
+
21
+
22
+ $('.deactivate a[href*="wp-google-analytics-events"], #wpgae-modal-cancel a').click(function(e) {
23
+ e.preventDefault();
24
+ $("#wpgae-modal-content, #wpgae-modal-background").toggleClass("active");
25
+ $("#wpgae-just-deactivate").attr("href", this.href);
26
+ });
27
+
28
+ $('#wpgae-feedback-form').submit(function (e) {
29
+ e.preventDefault(); // avoid to execute the actual submit of the form.
30
+ var form = $(this);
31
+
32
+ $.ajax({
33
+ type: "POST",
34
+ url: wpflow_ajax.ajax_url,
35
+ data: form.serialize(), // serializes the form's elements.
36
+ success: function(data)
37
+ {
38
+ window.location = $("#wpgae-just-deactivate").attr("href");
39
+ }
40
+ });
41
+
42
+ });
43
+
44
  });
45
 
46
 
97
  }
98
  }
99
  }
100
+
101
  } )( jQuery );
102
 
103
 
js/dist/admin-scripts-min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(e,t,i){function a(e,t){this.$form=e,this.$input=t,this.reset(),t.on("change paste",this.reset.bind(this))}var n=function(){return!1},o=null,r={numHalted:0,haltValidation:function(t){this.numHalted++,e.formUtils.haltValidation=!0,t.unbind("submit",n).bind("submit",n).find('*[type="submit"]').addClass("disabled").attr("disabled","disabled")},unHaltValidation:function(t){this.numHalted--,0===this.numHalted&&(e.formUtils.haltValidation=!1,t.unbind("submit",n).find('*[type="submit"]').removeClass("disabled").removeAttr("disabled","disabled"))}};a.prototype.reset=function(){this.haltedFormValidation=!1,this.hasRun=!1,this.isRunning=!1,this.result=void 0},a.prototype.run=function(e,t){return"keyup"===e?null:this.isRunning?(o=e,this.haltedFormValidation||(r.haltValidation(),this.haltedFormValidation=!0),null):this.hasRun?this.result:(o=e,r.haltValidation(this.$form),this.haltedFormValidation=!0,this.isRunning=!0,this.$input.attr("disabled","disabled").addClass("async-validation"),this.$form.addClass("async-validation"),t(function(e){this.done(e)}.bind(this)),null)},a.prototype.done=function(e){this.result=e,this.hasRun=!0,this.isRunning=!1,this.$input.removeAttr("disabled").removeClass("async-validation"),this.$form.removeClass("async-validation"),this.haltedFormValidation&&(r.unHaltValidation(this.$form),"submit"===o?this.$form.trigger("submit"):this.$input.trigger("validation.revalidate"))},a.loadInstance=function(e,t,i){var n,o=t.get(0);return o.asyncValidators||(o.asyncValidators={}),o.asyncValidators[e]?n=o.asyncValidators[e]:(n=new a(i,t),o.asyncValidators[e]=n),n},e.formUtils=e.extend(e.formUtils||{},{asyncValidation:function(e,t,i){return this.warn("Use of deprecated function $.formUtils.asyncValidation, use $.formUtils.addAsyncValidator() instead"),a.loadInstance(e,t,i)},addAsyncValidator:function(t){var i=e.extend({},t),n=i.validatorFunction;i.async=!0,i.validatorFunction=function(e,t,o,r,s,l){return a.loadInstance(this.name,t,s).run(l,function(a){n.apply(i,[a,e,t,o,r,s,l])})},this.addValidator(i)}}),e(t).bind("validatorsLoaded formValidationSetup",function(t,i){i||(i=e("form")),i.find("[data-validation]").each(function(){var t=e(this);t.valAttr("async",!1),e.each(e.split(t.attr("data-validation")),function(i,a){var n=e.formUtils.validators["validate_"+a];n&&n.async&&t.valAttr("async","yes")})})})}(e,window),function(e,t){"use strict";function i(t){t&&"custom"===t.errorMessagePosition&&"function"==typeof t.errorMessageCustom&&(e.formUtils.warn("Use of deprecated function errorMessageCustom, use config.submitErrorMessageCallback instead"),t.submitErrorMessageCallback=function(e,i){t.errorMessageCustom(e,t.language.errorTitle,i,t)})}function a(t){if(t.errorMessagePosition&&"object"==typeof t.errorMessagePosition){e.formUtils.warn("Deprecated use of config parameter errorMessagePosition, use config.submitErrorMessageCallback instead");var i=t.errorMessagePosition;t.errorMessagePosition="top",t.submitErrorMessageCallback=function(){return i}}}function n(t){var i={se:"sv",cz:"cs",dk:"da"};if(t.lang in i){var a=i[t.lang];e.formUtils.warn('Deprecated use of lang code "'+t.lang+'" use "'+a+'" instead'),t.lang=a}}e.fn.validateForm=function(t,i){return e.formUtils.warn("Use of deprecated function $.validateForm, use $.isValid instead"),this.isValid(t,i,!0)},e(window).on("formValidationPluginInit",function(e,t){n(t),i(t),a(t)}).on("validatorsLoaded formValidationSetup",function(t,i){i||(i=e("form")),function(t){var i=t.find("[data-validation-if-checked]");i.length&&e.formUtils.warn('Detected use of attribute "data-validation-if-checked" which is deprecated. Use "data-validation-depends-on" provided by module "logic"'),i.on("beforeValidation",function(){var i=e(this),a=i.valAttr("if-checked"),n=e('input[name="'+a+'"]',t),o=n.is(":checked"),r=(e.formUtils.getValue(n)||"").toString(),s=i.valAttr("if-checked-value");(!o||s&&s!==r)&&i.valAttr("skipped",!0)})}(i)})}(e),function(e){"use strict";var t={resolveErrorMessage:function(e,t,i,a,n){var o=a.validationErrorMsgAttribute+"-"+i.replace("validate_",""),r=e.attr(o);return r||((r=e.attr(a.validationErrorMsgAttribute))||((r="function"!=typeof t.errorMessageKey?n[t.errorMessageKey]:n[t.errorMessageKey(a)])||(r=t.errorMessage))),r},getParentContainer:function(t){if(t.valAttr("error-msg-container"))return e(t.valAttr("error-msg-container"));var i=t.parent();return"checkbox"===t.attr("type")&&t.closest(".checkbox").length?i=t.closest(".checkbox").parent():"radio"===t.attr("type")&&t.closest(".radio").length&&(i=t.closest(".radio").parent()),i.closest(".input-group").length&&(i=i.closest(".input-group").parent()),i},applyInputErrorStyling:function(e,t){e.addClass(t.errorElementClass).removeClass(t.successElementClass),this.getParentContainer(e).addClass(t.inputParentClassOnError).removeClass(t.inputParentClassOnSuccess),""!==t.borderColorOnError&&e.css("border-color",t.borderColorOnError)},applyInputSuccessStyling:function(e,t){e.addClass(t.successElementClass),this.getParentContainer(e).addClass(t.inputParentClassOnSuccess)},removeInputStylingAndMessage:function(e,i){e.removeClass(i.successElementClass).removeClass(i.errorElementClass).css("border-color","");var a=t.getParentContainer(e);if(a.removeClass(i.inputParentClassOnError).removeClass(i.inputParentClassOnSuccess),"function"==typeof i.inlineErrorMessageCallback){var n=i.inlineErrorMessageCallback(e,!1,i);n&&n.html("")}else a.find("."+i.errorMessageClass).remove()},removeAllMessagesAndStyling:function(i,a){if("function"==typeof a.submitErrorMessageCallback){var n=a.submitErrorMessageCallback(i,!1,a);n&&n.html("")}else i.find("."+a.errorMessageClass+".alert").remove();i.find("."+a.errorElementClass+",."+a.successElementClass).each(function(){t.removeInputStylingAndMessage(e(this),a)})},setInlineMessage:function(t,i,a){this.applyInputErrorStyling(t,a);var n,o=document.getElementById(t.attr("name")+"_err_msg"),r=!1,s=function(a){e.formUtils.$win.trigger("validationErrorDisplay",[t,a]),a.html(i)},l=function(){var o=!1;r.find("."+a.errorMessageClass).each(function(){if(this.inputReferer===t[0])return o=e(this),!1}),o?i?s(o):o.remove():""!==i&&(n=e('<div class="'+a.errorMessageClass+' alert"></div>'),s(n),n[0].inputReferer=t[0],r.prepend(n))};if(o)e.formUtils.warn("Using deprecated element reference "+o.id),r=e(o),l();else if("function"==typeof a.inlineErrorMessageCallback){if(!(r=a.inlineErrorMessageCallback(t,i,a)))return;l()}else{var d=this.getParentContainer(t);0===(n=d.find("."+a.errorMessageClass+".help-block")).length&&(n=e("<span></span>").addClass("help-block").addClass(a.errorMessageClass)).appendTo(d),s(n)}},setMessageInTopOfForm:function(t,i,a,n){var o='<div class="{errorMessageClass} alert alert-danger"><strong>{errorTitle}</strong><ul>{fields}</ul></div>',r=!1;if("function"!=typeof a.submitErrorMessageCallback||(r=a.submitErrorMessageCallback(t,i,a))){var s={errorTitle:n.errorTitle,fields:"",errorMessageClass:a.errorMessageClass};e.each(i,function(e,t){s.fields+="<li>"+t+"</li>"}),e.each(s,function(e,t){o=o.replace("{"+e+"}",t)}),r?r.html(o):t.children().eq(0).before(e(o))}}};e.formUtils=e.extend(e.formUtils||{},{dialogs:t})}(e),function(e,t,i){"use strict";var a=0;e.fn.validateOnBlur=function(t,i){var a=this,n=this.find("*[data-validation]");return n.each(function(){var n=e(this);if(n.is("[type=radio]")){var o=a.find('[type=radio][name="'+n.attr("name")+'"]');o.bind("blur.validation",function(){n.validateInputOnBlur(t,i,!0,"blur")}),i.validateCheckboxRadioOnClick&&o.bind("click.validation",function(){n.validateInputOnBlur(t,i,!0,"click")})}}),n.bind("blur.validation",function(){e(this).validateInputOnBlur(t,i,!0,"blur")}),i.validateCheckboxRadioOnClick&&this.find("input[type=checkbox][data-validation],input[type=radio][data-validation]").bind("click.validation",function(){e(this).validateInputOnBlur(t,i,!0,"click")}),this},e.fn.validateOnEvent=function(t,i){if(0!==this.length)return("FORM"===this[0].nodeName?this.find("*[data-validation-event]"):this).each(function(){var a=e(this),n=a.valAttr("event");n&&a.unbind(n+".validation").bind(n+".validation",function(a){9!==(a||{}).keyCode&&e(this).validateInputOnBlur(t,i,!0,n)})}),this},e.fn.showHelpOnFocus=function(t){return t||(t="data-validation-help"),this.find("textarea,input").each(function(){var i=e(this),n="jquery_form_help_"+ ++a,o=i.attr(t);i.removeClass("has-help-text").unbind("focus.help").unbind("blur.help"),o&&i.addClass("has-help-txt").bind("focus.help",function(){var t=i.parent().find("."+n);0===t.length&&(t=e("<span />").addClass(n).addClass("help").addClass("help-block").text(o).hide(),i.after(t)),t.fadeIn()}).bind("blur.help",function(){e(this).parent().find("."+n).fadeOut("slow")})}),this},e.fn.validate=function(t,i,a){var n=e.extend({},e.formUtils.LANG,a||{});this.each(function(){var a=e(this),o=(a.closest("form").get(0)||{}).validationConfig||e.formUtils.defaultConfig();a.one("validation",function(e,i){"function"==typeof t&&t(i,this,e)}),a.validateInputOnBlur(n,e.extend({},o,i||{}),!0)})},e.fn.willPostponeValidation=function(){return(this.valAttr("suggestion-nr")||this.valAttr("postpone")||this.hasClass("hasDatepicker"))&&!t.postponedValidation},e.fn.validateInputOnBlur=function(i,a,n,o){if(e.formUtils.eventType=o,this.willPostponeValidation()){var r=this,s=this.valAttr("postpone")||200;return t.postponedValidation=function(){r.validateInputOnBlur(i,a,n,o),t.postponedValidation=!1},setTimeout(function(){t.postponedValidation&&t.postponedValidation()},s),this}i=e.extend({},e.formUtils.LANG,i||{}),e.formUtils.dialogs.removeInputStylingAndMessage(this,a);var l=this,d=l.closest("form"),u=e.formUtils.validateInput(l,i,a,d,o),c=function(){l.validateInputOnBlur(i,a,!1,"blur.revalidated")};return"blur"===o&&l.unbind("validation.revalidate",c).one("validation.revalidate",c),n&&l.removeKeyUpValidation(),u.shouldChangeDisplay&&(u.isValid?e.formUtils.dialogs.applyInputSuccessStyling(l,a):e.formUtils.dialogs.setInlineMessage(l,u.errorMsg,a)),!u.isValid&&n&&l.validateOnKeyUp(i,a),this},e.fn.validateOnKeyUp=function(t,i){return this.each(function(){var a=e(this);a.valAttr("has-keyup-event")||a.valAttr("has-keyup-event","true").bind("keyup.validation",function(e){9!==e.keyCode&&a.validateInputOnBlur(t,i,!1,"keyup")})}),this},e.fn.removeKeyUpValidation=function(){return this.each(function(){e(this).valAttr("has-keyup-event",!1).unbind("keyup.validation")}),this},e.fn.valAttr=function(e,t){return void 0===t?this.attr("data-validation-"+e):!1===t||null===t?this.removeAttr("data-validation-"+e):(e=e.length>0?"-"+e:"",this.attr("data-validation"+e,t))},e.fn.isValid=function(t,i,a){if(e.formUtils.isLoadingModules){var n=this;return setTimeout(function(){n.isValid(t,i,a)},200),null}i=e.extend({},e.formUtils.defaultConfig(),i||{}),t=e.extend({},e.formUtils.LANG,t||{}),a=!1!==a,e.formUtils.errorDisplayPreventedWhenHalted&&(delete e.formUtils.errorDisplayPreventedWhenHalted,a=!1);var o=function(t,n){e.inArray(t,s)<0&&s.push(t),l.push(n),n.valAttr("current-error",t),a&&e.formUtils.dialogs.applyInputErrorStyling(n,i)},r=[],s=[],l=[],d=this;if(a&&e.formUtils.dialogs.removeAllMessagesAndStyling(d,i),d.find("input,textarea,select").filter(':not([type="submit"],[type="button"])').each(function(){var a=e(this),n=a.attr("type"),s="radio"===n||"checkbox"===n,l=a.attr("name");if(!function(t,a){return"submit"===a||"button"===a||"reset"===a||e.inArray(t,i.ignore||[])>-1}(l,n)&&(!s||e.inArray(l,r)<0)){s&&r.push(l);var u=e.formUtils.validateInput(a,t,i,d,"submit");u.isValid?u.isValid&&u.shouldChangeDisplay&&(a.valAttr("current-error",!1),e.formUtils.dialogs.applyInputSuccessStyling(a,i)):o(u.errorMsg,a)}}),"function"==typeof i.onValidate){var u=i.onValidate(d);e.isArray(u)?e.each(u,function(e,t){o(t.message,t.element)}):u&&u.element&&u.message&&o(u.message,u.element)}return e.formUtils.isValidatingEntireForm=!1,l.length>0&&a&&("top"===i.errorMessagePosition?e.formUtils.dialogs.setMessageInTopOfForm(d,s,i,t):e.each(l,function(t,a){e.formUtils.dialogs.setInlineMessage(a,a.valAttr("current-error"),i)}),i.scrollToTopOnError&&e.formUtils.$win.scrollTop(d.offset().top-20)),!a&&e.formUtils.haltValidation&&(e.formUtils.errorDisplayPreventedWhenHalted=!0),0===l.length&&!e.formUtils.haltValidation},e.fn.restrictLength=function(t){return new e.formUtils.lengthRestriction(this,t),this},e.fn.addSuggestions=function(t){var i=!1;return this.find("input").each(function(){var a=e(this);(i=e.split(a.attr("data-suggestions"))).length>0&&!a.hasClass("has-suggestions")&&(e.formUtils.suggest(a,i,t),a.addClass("has-suggestions"))}),this}}(e,window),function(e){"use strict";e.formUtils=e.extend(e.formUtils||{},{isLoadingModules:!1,loadedModules:{},registerLoadedModule:function(t){this.loadedModules[e.trim(t).toLowerCase()]=!0},hasLoadedModule:function(t){return e.trim(t).toLowerCase()in this.loadedModules},loadModules:function(t,i,a){if(e.formUtils.isLoadingModules)setTimeout(function(){e.formUtils.loadModules(t,i,a)},100);else{var n=function(t,i){var n=e.split(t),o=n.length,r=function(){0===--o&&(e.formUtils.isLoadingModules=!1,"function"==typeof a&&a())};o>0&&(e.formUtils.isLoadingModules=!0);var s="?_="+(new Date).getTime(),l=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0];e.each(n,function(t,a){if(0===(a=e.trim(a)).length||e.formUtils.hasLoadedModule(a))r();else{var n=i+a+(".js"===a.slice(-3)?"":".js"),o=document.createElement("SCRIPT");"function"==typeof define&&define.amd?require([n+(".dev.js"===n.slice(-7)?s:"")],r):(o.type="text/javascript",o.onload=r,o.src=n+(".dev.js"===n.slice(-7)?s:""),o.onerror=function(){e.formUtils.warn("Unable to load form validation module "+n,!0),r()},o.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||(r(),this.onload=null,this.onreadystatechange=null)},l.appendChild(o))}})};if(i)n(t,i);else{var o=function(){var i=!1;return e('script[src*="form-validator"]').each(function(){if(!(this.src.split("form-validator")[1].split("node_modules").length>1))return"/"===(i=this.src.substr(0,this.src.lastIndexOf("/"))+"/")&&(i=""),!1}),!1!==i&&(n(t,i),!0)};o()||e(function(){o()||"function"==typeof a&&a()})}}}})}(e),function(e){"use strict";e.split=function(t,i,a){a=void 0===a||!0===a;var n=new RegExp("[,|"+(a?"\\s":"")+"-]\\s*","g");if("function"!=typeof i){if(!t)return[];var o=[];return e.each(t.split(i||n),function(t,i){(i=e.trim(i)).length&&o.push(i)}),o}t&&e.each(t.split(n),function(t,a){if((a=e.trim(a)).length)return i(a,t)})},e.validate=function(t){var i=e.extend(e.formUtils.defaultConfig(),{form:"form",validateOnEvent:!1,validateOnBlur:!0,validateCheckboxRadioOnClick:!0,showHelpOnFocus:!0,addSuggestions:!0,modules:"",onModulesLoaded:null,language:!1,onSuccess:!1,onError:!1,onElementValidate:!1});if(t=e.extend(i,t||{}),e(window).trigger("formValidationPluginInit",[t]),t.lang&&"en"!==t.lang){var a="lang/"+t.lang+".js";t.modules+=t.modules.length?","+a:a}e(t.form).each(function(i,a){a.validationConfig=t;var n=e(a);n.trigger("formValidationSetup",[n,t]),n.find(".has-help-txt").unbind("focus.validation").unbind("blur.validation"),n.removeClass("has-validation-callback").unbind("submit.validation").unbind("reset.validation").find("input[data-validation],textarea[data-validation]").unbind("blur.validation"),n.bind("submit.validation",function(i){var a=e(this),n=function(){return i.stopImmediatePropagation(),!1};if(e.formUtils.haltValidation)return n();if(e.formUtils.isLoadingModules)return setTimeout(function(){a.trigger("submit.validation")},200),n();var o=a.isValid(t.language,t);return e.formUtils.haltValidation?n():o&&"function"==typeof t.onSuccess?!1===t.onSuccess(a)?n():void 0:o||"function"!=typeof t.onError?!!o||n():(t.onError(a),n())}).bind("reset.validation",function(){e.formUtils.dialogs.removeAllMessagesAndStyling(n,t)}).addClass("has-validation-callback"),t.showHelpOnFocus&&n.showHelpOnFocus(),t.addSuggestions&&n.addSuggestions(),t.validateOnBlur&&(n.validateOnBlur(t.language,t),n.bind("html5ValidationAttrsFound",function(){n.validateOnBlur(t.language,t)})),t.validateOnEvent&&n.validateOnEvent(t.language,t)}),""!==t.modules&&e.formUtils.loadModules(t.modules,null,function(){"function"==typeof t.onModulesLoaded&&t.onModulesLoaded();var i="string"==typeof t.form?e(t.form):t.form;e.formUtils.$win.trigger("validatorsLoaded",[i,t])})}}(e),function(e,t){"use strict";var i=e(t);e.formUtils=e.extend(e.formUtils||{},{$win:i,defaultConfig:function(){return{ignore:[],errorElementClass:"error",successElementClass:"valid",borderColorOnError:"#b94a48",errorMessageClass:"form-error",validationRuleAttribute:"data-validation",validationErrorMsgAttribute:"data-validation-error-msg",errorMessagePosition:"inline",errorMessageTemplate:{container:'<div class="{errorMessageClass} alert alert-danger">{messages}</div>',messages:"<strong>{errorTitle}</strong><ul>{fields}</ul>",field:"<li>{msg}</li>"},scrollToTopOnError:!0,dateFormat:"yyyy-mm-dd",addValidClassOnAll:!1,decimalSeparator:".",inputParentClassOnError:"has-error",inputParentClassOnSuccess:"has-success",validateHiddenInputs:!1,inlineErrorMessageCallback:!1,submitErrorMessageCallback:!1}},validators:{},sanitizers:{},_events:{load:[],valid:[],invalid:[]},haltValidation:!1,addValidator:function(e){var t=0===e.name.indexOf("validate_")?e.name:"validate_"+e.name;void 0===e.validateOnKeyUp&&(e.validateOnKeyUp=!0),this.validators[t]=e},addSanitizer:function(e){this.sanitizers[e.name]=e},warn:function(e,i){"console"in t?"function"==typeof t.console.warn?t.console.warn(e):"function"==typeof t.console.log&&t.console.log(e):i&&alert(e)},getValue:function(e,t){var i=t?t.find(e):e;if(i.length>0){var a=i.eq(0).attr("type");return"radio"===a||"checkbox"===a?i.filter(":checked").val()||"":i.val()||""}return!1},validateInput:function(t,i,a,n,o){a=a||e.formUtils.defaultConfig(),i=i||e.formUtils.LANG,n.length||(n=t.parent());var r=this.getValue(t);t.valAttr("skipped",!1).one("beforeValidation",function(){(t.attr("disabled")||!t.is(":visible")&&!a.validateHiddenInputs)&&t.valAttr("skipped",1)}).trigger("beforeValidation",[r,i,a]);var s="true"===t.valAttr("optional"),l=!r&&s,d=t.attr(a.validationRuleAttribute),u=!0,c="",f={isValid:!0,shouldChangeDisplay:!0,errorMsg:""};if(!d||l||t.valAttr("skipped"))return f.shouldChangeDisplay=a.addValidClassOnAll,f;var h=t.valAttr("ignore");return h&&e.each(h.split(""),function(e,t){r=r.replace(new RegExp("\\"+t,"g"),"")}),e.split(d,function(s){0!==s.indexOf("validate_")&&(s="validate_"+s);var l=e.formUtils.validators[s];if(!l)throw new Error('Using undefined validator "'+s+'". Maybe you have forgotten to load the module that "'+s+'" belongs to?');if("validate_checkbox_group"===s&&(t=n.find('[name="'+t.attr("name")+'"]:eq(0)')),("keyup"!==o||l.validateOnKeyUp)&&(u=l.validatorFunction(r,t,a,i,n,o)),!u)return a.validateOnBlur&&t.validateOnKeyUp(i,a),c=e.formUtils.dialogs.resolveErrorMessage(t,l,s,a,i),!1}),!1===u?(t.trigger("validation",!1),f.errorMsg=c,f.isValid=!1,f.shouldChangeDisplay=!0):null===u?f.shouldChangeDisplay=!1:(t.trigger("validation",!0),f.shouldChangeDisplay=!0),"function"==typeof a.onElementValidate&&null!==c&&a.onElementValidate(f.isValid,t,n,c),t.trigger("afterValidation",[f,o]),f},parseDate:function(t,i,a){var n,o,r,s,l=i.replace(/[a-zA-Z]/gi,"").substring(0,1),d="^",u=i.split(l||null);if(e.each(u,function(e,t){d+=(e>0?"\\"+l:"")+"(\\d{"+t.length+"})"}),d+="$",a){var c=[];e.each(t.split(l),function(e,t){1===t.length&&(t="0"+t),c.push(t)}),t=c.join(l)}if(null===(n=t.match(new RegExp(d))))return!1;var f=function(t,i,a){for(var n=0;n<i.length;n++)if(i[n].substring(0,1)===t)return e.formUtils.parseDateInt(a[n+1]);return-1};return r=f("m",u,n),o=f("d",u,n),s=f("y",u,n),!(2===r&&o>28&&(s%4!=0||s%100==0&&s%400!=0)||2===r&&o>29&&(s%4==0||s%100!=0&&s%400==0)||r>12||0===r)&&!(this.isShortMonth(r)&&o>30||!this.isShortMonth(r)&&o>31||0===o)&&[s,r,o]},parseDateInt:function(e){return 0===e.indexOf("0")&&(e=e.replace("0","")),parseInt(e,10)},isShortMonth:function(e){return e%2==0&&e<7||e%2!=0&&e>7},lengthRestriction:function(t,i){var a=parseInt(i.text(),10),n=0,o=function(){var e=t.val().length;if(e>a){var o=t.scrollTop();t.val(t.val().substring(0,a)),t.scrollTop(o)}(n=a-e)<0&&(n=0),i.text(n)};e(t).bind("keydown keyup keypress focus blur",o).bind("cut paste",function(){setTimeout(o,100)}),e(document).bind("ready",o)},numericRangeCheck:function(t,i){var a=e.split(i),n=parseInt(i.substr(3),10);return 1===a.length&&-1===i.indexOf("min")&&-1===i.indexOf("max")&&(a=[i,i]),2===a.length&&(t<parseInt(a[0],10)||t>parseInt(a[1],10))?["out",a[0],a[1]]:0===i.indexOf("min")&&t<n?["min",n]:0===i.indexOf("max")&&t>n?["max",n]:["ok"]},_numSuggestionElements:0,_selectedSuggestion:null,_previousTypedVal:null,suggest:function(t,a,n){var o={css:{maxHeight:"150px",background:"#FFF",lineHeight:"150%",textDecoration:"underline",overflowX:"hidden",overflowY:"auto",border:"#CCC solid 1px",borderTop:"none",cursor:"pointer"},activeSuggestionCSS:{background:"#E9E9E9"}},r=function(e,t){var i=t.offset();e.css({width:t.outerWidth(),left:i.left+"px",top:i.top+t.outerHeight()+"px"})};n&&e.extend(o,n),o.css.position="absolute",o.css["z-index"]=9999,t.attr("autocomplete","off"),0===this._numSuggestionElements&&i.bind("resize",function(){e(".jquery-form-suggestions").each(function(){var t=e(this),i=t.attr("data-suggest-container");r(t,e(".suggestions-"+i).eq(0))})}),this._numSuggestionElements++;var s=function(t){var i=t.valAttr("suggestion-nr");e.formUtils._selectedSuggestion=null,e.formUtils._previousTypedVal=null,e(".jquery-form-suggestion-"+i).fadeOut("fast")};return t.data("suggestions",a).valAttr("suggestion-nr",this._numSuggestionElements).unbind("focus.suggest").bind("focus.suggest",function(){e(this).trigger("keyup"),e.formUtils._selectedSuggestion=null}).unbind("keyup.suggest").bind("keyup.suggest",function(){var i=e(this),a=[],n=e.trim(i.val()).toLocaleLowerCase();if(n!==e.formUtils._previousTypedVal){e.formUtils._previousTypedVal=n;var l=!1,d=i.valAttr("suggestion-nr"),u=e(".jquery-form-suggestion-"+d);if(u.scrollTop(0),""!==n){var c=n.length>2;e.each(i.data("suggestions"),function(e,t){var i=t.toLocaleLowerCase();return i===n?(a.push("<strong>"+t+"</strong>"),l=!0,!1):void((0===i.indexOf(n)||c&&i.indexOf(n)>-1)&&a.push(t.replace(new RegExp(n,"gi"),"<strong>$&</strong>")))})}l||0===a.length&&u.length>0?u.hide():a.length>0&&0===u.length?(u=e("<div></div>").css(o.css).appendTo("body"),t.addClass("suggestions-"+d),u.attr("data-suggest-container",d).addClass("jquery-form-suggestions").addClass("jquery-form-suggestion-"+d)):a.length>0&&!u.is(":visible")&&u.show(),a.length>0&&n.length!==a[0].length&&(r(u,i),u.html(""),e.each(a,function(t,a){e("<div></div>").append(a).css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"5px"}).addClass("form-suggest-element").appendTo(u).click(function(){i.focus(),i.val(e(this).text()),i.trigger("change"),s(i)})}))}}).unbind("keydown.validation").bind("keydown.validation",function(t){var i,a,n=t.keyCode?t.keyCode:t.which,r=e(this);if(13===n&&null!==e.formUtils._selectedSuggestion){if(i=r.valAttr("suggestion-nr"),(a=e(".jquery-form-suggestion-"+i)).length>0){var l=a.find("div").eq(e.formUtils._selectedSuggestion).text();r.val(l),r.trigger("change"),s(r),t.preventDefault()}}else{i=r.valAttr("suggestion-nr");var d=(a=e(".jquery-form-suggestion-"+i)).children();if(d.length>0&&e.inArray(n,[38,40])>-1){38===n?(null===e.formUtils._selectedSuggestion?e.formUtils._selectedSuggestion=d.length-1:e.formUtils._selectedSuggestion--,e.formUtils._selectedSuggestion<0&&(e.formUtils._selectedSuggestion=d.length-1)):40===n&&(null===e.formUtils._selectedSuggestion?e.formUtils._selectedSuggestion=0:e.formUtils._selectedSuggestion++,e.formUtils._selectedSuggestion>d.length-1&&(e.formUtils._selectedSuggestion=0));var u=a.innerHeight(),c=a.scrollTop(),f=a.children().eq(0).outerHeight()*e.formUtils._selectedSuggestion;return(f<c||f>c+u)&&a.scrollTop(f),d.removeClass("active-suggestion").css("background","none").eq(e.formUtils._selectedSuggestion).addClass("active-suggestion").css(o.activeSuggestionCSS),t.preventDefault(),!1}}}).unbind("blur.suggest").bind("blur.suggest",function(){s(e(this))}),t},LANG:{errorTitle:"Form submission failed!",requiredField:"This is a required field",requiredFields:"You have not answered all required fields",badTime:"You have not given a correct time",badEmail:"You have not given a correct e-mail address",badTelephone:"You have not given a correct phone number",badSecurityAnswer:"You have not given a correct answer to the security question",badDate:"You have not given a correct date",lengthBadStart:"The input value must be between ",lengthBadEnd:" characters",lengthTooLongStart:"The input value is longer than ",lengthTooShortStart:"The input value is shorter than ",notConfirmed:"Input values could not be confirmed",badDomain:"Incorrect domain value",badUrl:"The input value is not a correct URL",badCustomVal:"The input value is incorrect",andSpaces:" and spaces ",badInt:"The input value was not a correct number",badSecurityNumber:"Your social security number was incorrect",badUKVatAnswer:"Incorrect UK VAT Number",badUKNin:"Incorrect UK NIN",badUKUtr:"Incorrect UK UTR Number",badStrength:"The password isn't strong enough",badNumberOfSelectedOptionsStart:"You have to choose at least ",badNumberOfSelectedOptionsEnd:" answers",badAlphaNumeric:"The input value can only contain alphanumeric characters ",badAlphaNumericExtra:" and ",wrongFileSize:"The file you are trying to upload is too large (max %s)",wrongFileType:"Only files of type %s is allowed",groupCheckedRangeStart:"Please choose between ",groupCheckedTooFewStart:"Please choose at least ",groupCheckedTooManyStart:"Please choose a maximum of ",groupCheckedEnd:" item(s)",badCreditCard:"The credit card number is not correct",badCVV:"The CVV number was not correct",wrongFileDim:"Incorrect image dimensions,",imageTooTall:"the image can not be taller than",imageTooWide:"the image can not be wider than",imageTooSmall:"the image was too small",min:"min",max:"max",imageRatioNotAccepted:"Image ratio is not be accepted",badBrazilTelephoneAnswer:"The phone number entered is invalid",badBrazilCEPAnswer:"The CEP entered is invalid",badBrazilCPFAnswer:"The CPF entered is invalid",badPlPesel:"The PESEL entered is invalid",badPlNip:"The NIP entered is invalid",badPlRegon:"The REGON entered is invalid",badreCaptcha:"Please confirm that you are not a bot",passwordComplexityStart:"Password must contain at least ",passwordComplexitySeparator:", ",passwordComplexityUppercaseInfo:" uppercase letter(s)",passwordComplexityLowercaseInfo:" lowercase letter(s)",passwordComplexitySpecialCharsInfo:" special character(s)",passwordComplexityNumericCharsInfo:" numeric character(s)",passwordComplexityEnd:"."}})}(e,window),function(e){e.formUtils.addValidator({name:"email",validatorFunction:function(t){var i=t.toLowerCase().split("@"),a=i[0],n=i[1];if(a&&n){if(0===a.indexOf('"')){var o=a.length;if((a=a.replace(/\"/g,"")).length!==o-2)return!1}return e.formUtils.validators.validate_domain.validatorFunction(i[1])&&0!==a.indexOf(".")&&"."!==a.substring(a.length-1,a.length)&&-1===a.indexOf("..")&&!/[^\w\+\.\-\#\-\_\~\!\$\&\'\(\)\*\+\,\;\=\:]/.test(a)}return!1},errorMessage:"",errorMessageKey:"badEmail"}),e.formUtils.addValidator({name:"domain",validatorFunction:function(e){return e.length>0&&e.length<=253&&!/[^a-zA-Z0-9]/.test(e.slice(-2))&&!/[^a-zA-Z0-9]/.test(e.substr(0,1))&&!/[^a-zA-Z0-9\.\-]/.test(e)&&1===e.split("..").length&&e.split(".").length>1},errorMessage:"",errorMessageKey:"badDomain"}),e.formUtils.addValidator({name:"required",validatorFunction:function(t,i,a,n,o){switch(i.attr("type")){case"checkbox":return i.is(":checked");case"radio":return o.find('input[name="'+i.attr("name")+'"]').filter(":checked").length>0;default:return""!==e.trim(t)}},errorMessage:"",errorMessageKey:function(e){return"top"===e.errorMessagePosition||"function"==typeof e.errorMessagePosition?"requiredFields":"requiredField"}}),e.formUtils.addValidator({name:"length",validatorFunction:function(t,i,a,n){var o=i.valAttr("length"),r=i.attr("type");if(void 0===o)return alert('Please add attribute "data-validation-length" to '+i[0].nodeName+" named "+i.attr("name")),!0;var s,l="file"===r&&void 0!==i.get(0).files?i.get(0).files.length:t.length,d=e.formUtils.numericRangeCheck(l,o);switch(d[0]){case"out":this.errorMessage=n.lengthBadStart+o+n.lengthBadEnd,s=!1;break;case"min":this.errorMessage=n.lengthTooShortStart+d[1]+n.lengthBadEnd,s=!1;break;case"max":this.errorMessage=n.lengthTooLongStart+d[1]+n.lengthBadEnd,s=!1;break;default:s=!0}return s},errorMessage:"",errorMessageKey:""}),e.formUtils.addValidator({name:"url",validatorFunction:function(t){if(/^(https?|ftp):\/\/((((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|\[|\]|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)){var i=t.split("://")[1],a=i.indexOf("/");return a>-1&&(i=i.substr(0,a)),e.formUtils.validators.validate_domain.validatorFunction(i)}return!1},errorMessage:"",errorMessageKey:"badUrl"}),e.formUtils.addValidator({name:"number",validatorFunction:function(e,t,i){if(""!==e){var a,n,o=t.valAttr("allowing")||"",r=t.valAttr("decimal-separator")||i.decimalSeparator,s=!1,l=t.valAttr("step")||"",d=!1;if((t.attr("data-sanitize")||"").match(/(^|[\s])numberFormat([\s]|$)/i)){if(!window.numeral)throw new ReferenceError("The data-sanitize value numberFormat cannot be used without the numeral library. Please see Data Validation in http://www.formvalidator.net for more information.");e.length&&(e=String(numeral().unformat(e)))}if(-1===o.indexOf("number")&&(o+=",number"),-1===o.indexOf("negative")&&0===e.indexOf("-"))return!1;if(o.indexOf("range")>-1&&(a=parseFloat(o.substring(o.indexOf("[")+1,o.indexOf(";"))),n=parseFloat(o.substring(o.indexOf(";")+1,o.indexOf("]"))),s=!0),""!==l&&(d=!0),","===r){if(e.indexOf(".")>-1)return!1;e=e.replace(",",".")}if(""===e.replace(/[0-9-]/g,"")&&(!s||e>=a&&e<=n)&&(!d||e%l==0))return!0;if(o.indexOf("float")>-1&&null!==e.match(new RegExp("^([0-9-]+)\\.([0-9]+)$"))&&(!s||e>=a&&e<=n)&&(!d||e%l==0))return!0}return!1},errorMessage:"",errorMessageKey:"badInt"}),e.formUtils.addValidator({name:"alphanumeric",validatorFunction:function(t,i,a,n){var o="^([a-zA-Z0-9",r="]+)$",s=i.valAttr("allowing"),l="",d=!1;if(s){l=o+s+r;var u=s.replace(/\\/g,"");u.indexOf(" ")>-1&&(d=!0,u=u.replace(" ",""),u+=n.andSpaces||e.formUtils.LANG.andSpaces),n.badAlphaNumericAndExtraAndSpaces&&n.badAlphaNumericAndExtra?this.errorMessage=d?n.badAlphaNumericAndExtraAndSpaces+u:n.badAlphaNumericAndExtra+u+n.badAlphaNumericExtra:this.errorMessage=n.badAlphaNumeric+n.badAlphaNumericExtra+u}else l=o+r,this.errorMessage=n.badAlphaNumeric;return new RegExp(l).test(t)},errorMessage:"",errorMessageKey:""}),e.formUtils.addValidator({name:"custom",validatorFunction:function(e,t){return new RegExp(t.valAttr("regexp")).test(e)},errorMessage:"",errorMessageKey:"badCustomVal"}),e.formUtils.addValidator({name:"date",validatorFunction:function(t,i,a){var n=i.valAttr("format")||a.dateFormat||"yyyy-mm-dd",o="false"===i.valAttr("require-leading-zero");return!1!==e.formUtils.parseDate(t,n,o)},errorMessage:"",errorMessageKey:"badDate"}),e.formUtils.addValidator({name:"checkbox_group",validatorFunction:function(t,i,a,n,o){var r=!0,s=i.attr("name"),l=e('input[type=checkbox][name^="'+s+'"]',o),d=l.filter(":checked").length,u=i.valAttr("qty");if(void 0===u){var c=i.get(0).nodeName;alert('Attribute "data-validation-qty" is missing from '+c+" named "+i.attr("name"))}var f=e.formUtils.numericRangeCheck(d,u);switch(f[0]){case"out":this.errorMessage=n.groupCheckedRangeStart+u+n.groupCheckedEnd,r=!1;break;case"min":this.errorMessage=n.groupCheckedTooFewStart+f[1]+(n.groupCheckedTooFewEnd||n.groupCheckedEnd),r=!1;break;case"max":this.errorMessage=n.groupCheckedTooManyStart+f[1]+(n.groupCheckedTooManyEnd||n.groupCheckedEnd),r=!1;break;default:r=!0}if(!r){var h=function(){l.unbind("click",h),l.filter("*[data-validation]").validateInputOnBlur(n,a,!1,"blur")};l.bind("click",h)}return r}})}(e)}),function(e){"object"==typeof module&&"object"==typeof module.exports?e(require("jquery"),window,document):e(jQuery,window,document)}(function(e,t,i,a){var n=[],o=function(){return n.length?n[n.length-1]:null},r=function(){var e,t=!1;for(e=n.length-1;e>=0;e--)n[e].$blocker&&(n[e].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};e.modal=function(t,i){var a,r;if(this.$body=e("body"),this.options=e.extend({},e.modal.defaults,i),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;e.modal.isActive();)e.modal.close();if(n.push(this),t.is("a"))if(r=t.attr("href"),this.anchor=t,/^#/.test(r)){if(this.$elm=e(r),1!==this.$elm.length)return null;this.$body.append(this.$elm),this.open()}else this.$elm=e("<div>"),this.$body.append(this.$elm),a=function(e,t){t.elm.remove()},this.showSpinner(),t.trigger(e.modal.AJAX_SEND),e.get(r).done(function(i){if(e.modal.isActive()){t.trigger(e.modal.AJAX_SUCCESS);var n=o();n.$elm.empty().append(i).on(e.modal.CLOSE,a),n.hideSpinner(),n.open(),t.trigger(e.modal.AJAX_COMPLETE)}}).fail(function(){t.trigger(e.modal.AJAX_FAIL),o().hideSpinner(),n.pop(),t.trigger(e.modal.AJAX_COMPLETE)});else this.$elm=t,this.anchor=t,this.$body.append(this.$elm),this.open()},e.modal.prototype={constructor:e.modal,open:function(){var t=this;this.block(),this.anchor.blur(),this.options.doFade?setTimeout(function(){t.show()},this.options.fadeDuration*this.options.fadeDelay):this.show(),e(i).off("keydown.modal").on("keydown.modal",function(e){var t=o();27===e.which&&t.options.escapeClose&&t.close()}),this.options.clickClose&&this.$blocker.click(function(t){t.target===this&&e.modal.close()})},close:function(){n.pop(),this.unblock(),this.hide(),e.modal.isActive()||e(i).off("keydown.modal")},block:function(){this.$elm.trigger(e.modal.BEFORE_BLOCK,[this._ctx()]),this.$body.css("overflow","hidden"),this.$blocker=e('<div class="'+this.options.blockerClass+' blocker current"></div>').appendTo(this.$body),r(),this.options.doFade&&this.$blocker.css("opacity",0).animate({opacity:1},this.options.fadeDuration),this.$elm.trigger(e.modal.BLOCK,[this._ctx()])},unblock:function(t){!t&&this.options.doFade?this.$blocker.fadeOut(this.options.fadeDuration,this.unblock.bind(this,!0)):(this.$blocker.children().appendTo(this.$body),this.$blocker.remove(),this.$blocker=null,r(),e.modal.isActive()||this.$body.css("overflow",""))},show:function(){this.$elm.trigger(e.modal.BEFORE_OPEN,[this._ctx()]),this.options.showClose&&(this.closeButton=e('<a href="#close-modal" rel="modal:close" class="close-modal '+this.options.closeClass+'">'+this.options.closeText+"</a>"),this.$elm.append(this.closeButton)),this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker),this.options.doFade?this.$elm.css({opacity:0,display:"inline-block"}).animate({opacity:1},this.options.fadeDuration):this.$elm.css("display","inline-block"),this.$elm.trigger(e.modal.OPEN,[this._ctx()])},hide:function(){this.$elm.trigger(e.modal.BEFORE_CLOSE,[this._ctx()]),this.closeButton&&this.closeButton.remove();var t=this;this.options.doFade?this.$elm.fadeOut(this.options.fadeDuration,function(){t.$elm.trigger(e.modal.AFTER_CLOSE,[t._ctx()])}):this.$elm.hide(0,function(){t.$elm.trigger(e.modal.AFTER_CLOSE,[t._ctx()])}),this.$elm.trigger(e.modal.CLOSE,[this._ctx()])},showSpinner:function(){this.options.showSpinner&&(this.spinner=this.spinner||e('<div class="'+this.options.modalClass+'-spinner"></div>').append(this.options.spinnerHtml),this.$body.append(this.spinner),this.spinner.show())},hideSpinner:function(){this.spinner&&this.spinner.remove()},_ctx:function(){return{elm:this.$elm,$elm:this.$elm,$blocker:this.$blocker,options:this.options}}},e.modal.close=function(t){if(e.modal.isActive()){t&&t.preventDefault();var i=o();return i.close(),i.$elm}},e.modal.isActive=function(){return n.length>0},e.modal.getCurrent=o,e.modal.defaults={closeExisting:!0,escapeClose:!0,clickClose:!0,closeText:"Close",closeClass:"",modalClass:"modal",blockerClass:"jquery-modal",spinnerHtml:'<div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div>',showSpinner:!0,showClose:!0,fadeDuration:null,fadeDelay:1},e.modal.BEFORE_BLOCK="modal:before-block",e.modal.BLOCK="modal:block",e.modal.BEFORE_OPEN="modal:before-open",e.modal.OPEN="modal:open",e.modal.BEFORE_CLOSE="modal:before-close",e.modal.CLOSE="modal:close",e.modal.AFTER_CLOSE="modal:after-close",e.modal.AJAX_SEND="modal:ajax:send",e.modal.AJAX_SUCCESS="modal:ajax:success",e.modal.AJAX_FAIL="modal:ajax:fail",e.modal.AJAX_COMPLETE="modal:ajax:complete",e.fn.modal=function(t){return 1===this.length&&new e.modal(this,t),this},e(i).on("click.modal",'a[rel~="modal:close"]',e.modal.close),e(i).on("click.modal",'a[rel~="modal:open"]',function(t){t.preventDefault(),e(this).modal()})}),jQuery(document).ready(function(e){var t=e("#snippet_type"),i=e("#anonymizeip"),a=e("#anonymizeip")[0],n=e("#gtm_id");e("#script_debug_mode");function o(e){e.attr("disabled",!0)}function r(e){e.removeAttr("disabled")}function s(e,t){e.checked=t}e.widget.bridge("gaetooltip",e.ui.tooltip),e(".ga-tooltip").gaetooltip({position:{my:"left bottom-10",at:"right top",collision:"none"}}),e(".btn_upload").on("click",function(t){e(".settings_content").slideDown(),t.preventDefault()}),e(".btn_close").on("click",function(t){e(".settings_content").slideUp(),t.preventDefault()}),e(".popup").on("click",function(t){e(".popup").slideUp(),t.preventDefault()}),"none"!==t.val()&&"gtm"!==t.val()||(s(a,!1),o(i)),"gtm"===t.val()?r(n):o(n),t.change(function(){var t=e(this).val();"none"===t||"gtm"===t?(s(a,!1),o(i)):r(i),"gtm"===t?r(n):o(n)}),e(".btn_upload").on("click",function(t){e(".settings_content").slideDown(),t.preventDefault()}),e(".btn_close").on("click",function(t){e(".settings_content").slideUp(),t.preventDefault()}),e(".popup").on("click",function(t){e(".popup").slideUp(),t.preventDefault()}),e('input[name="ga_events_options[permitted_roles][]"][value="administrator"]').css({"pointer-events":"none",opacity:.5}).prop("checked",!0),e(".divs-istracktime:checkbox").change(function(){var t=e(this),i=t.is(":checked"),a=t.data("track"),n="#track-elem"+a,o="#eventValue"+a;i?(e(n).show(),e(o).attr("disabled",!0)):(e(n).hide(),e(o).removeAttr("disabled"))}),e("#empty-istracktime:checkbox").change(function(){e(this).is(":checked")?(e("#empty-trackelem").show(),e("#empty-eventValue").attr("disabled",!0)):(e("#empty-trackelem").hide(),e("#empty-eventValue").removeAttr("disabled"))}),e(".divs-istracktime").trigger("change"),jQuery("body").on("click",'a[href="admin.php?page=wp-google-analytics-events-upgrade"]',function(e){e.preventDefault(),window.open("https://wpflow.com/upgrade/?utm_source=wpadmin&utm_medium=banner&utm_campaign=nav","_blank")})});var gaeAjax=function(e){function t(t){t.preventDefault();var i=e(this).attr("id"),a="#"+e(this).data("action");e.ajax({type:"POST",url:wpflow_ajax.ajax_url,data:{post_id:i,action:"wpflow_get_event_json"},success:function(t){e(a).modal(),function(t,i){if(void 0!==i)for(var a in i)i.hasOwnProperty(a)&&(e(t+" #"+a).is(":checkbox")?"true"===i[a][0]?e(t+" #"+a).attr("checked",!0):e(t+" #"+a).removeAttr("checked",!1):e(t+" #"+a).val(i[a][0]))}(a,t.meta),e(a+" #event_id").val(i)},error:function(){alert("Error updating event")}})}function i(t){t.preventDefault();var i=e(this);e.ajax({type:"post",url:wpflow_ajax.ajax_url,data:i.serialize(),success:function(e){window.location.reload()}})}e(document).ready(function(e){if(void 0!==e.fn.modal.noConflict)e.fn.modal.noConflict();e.validate(),e(".wpgae-event-form").on("submit",i),e(".ga_main .edit a").click(t),e(".ga_main .delete a").click(t)})}(jQuery);
1
+ !function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(e,t,a){function i(e,t){this.$form=e,this.$input=t,this.reset(),t.on("change paste",this.reset.bind(this))}var n=function(){return!1},o=null,r={numHalted:0,haltValidation:function(t){this.numHalted++,e.formUtils.haltValidation=!0,t.unbind("submit",n).bind("submit",n).find('*[type="submit"]').addClass("disabled").attr("disabled","disabled")},unHaltValidation:function(t){this.numHalted--,0===this.numHalted&&(e.formUtils.haltValidation=!1,t.unbind("submit",n).find('*[type="submit"]').removeClass("disabled").removeAttr("disabled","disabled"))}};i.prototype.reset=function(){this.haltedFormValidation=!1,this.hasRun=!1,this.isRunning=!1,this.result=void 0},i.prototype.run=function(e,t){return"keyup"===e?null:this.isRunning?(o=e,this.haltedFormValidation||(r.haltValidation(),this.haltedFormValidation=!0),null):this.hasRun?this.result:(o=e,r.haltValidation(this.$form),this.haltedFormValidation=!0,this.isRunning=!0,this.$input.attr("disabled","disabled").addClass("async-validation"),this.$form.addClass("async-validation"),t(function(e){this.done(e)}.bind(this)),null)},i.prototype.done=function(e){this.result=e,this.hasRun=!0,this.isRunning=!1,this.$input.removeAttr("disabled").removeClass("async-validation"),this.$form.removeClass("async-validation"),this.haltedFormValidation&&(r.unHaltValidation(this.$form),"submit"===o?this.$form.trigger("submit"):this.$input.trigger("validation.revalidate"))},i.loadInstance=function(e,t,a){var n,o=t.get(0);return o.asyncValidators||(o.asyncValidators={}),o.asyncValidators[e]?n=o.asyncValidators[e]:(n=new i(a,t),o.asyncValidators[e]=n),n},e.formUtils=e.extend(e.formUtils||{},{asyncValidation:function(e,t,a){return this.warn("Use of deprecated function $.formUtils.asyncValidation, use $.formUtils.addAsyncValidator() instead"),i.loadInstance(e,t,a)},addAsyncValidator:function(t){var a=e.extend({},t),n=a.validatorFunction;a.async=!0,a.validatorFunction=function(e,t,o,r,s,l){return i.loadInstance(this.name,t,s).run(l,function(i){n.apply(a,[i,e,t,o,r,s,l])})},this.addValidator(a)}}),e(t).bind("validatorsLoaded formValidationSetup",function(t,a){a||(a=e("form")),a.find("[data-validation]").each(function(){var t=e(this);t.valAttr("async",!1),e.each(e.split(t.attr("data-validation")),function(a,i){var n=e.formUtils.validators["validate_"+i];n&&n.async&&t.valAttr("async","yes")})})})}(e,window),function(e,t){"use strict";function a(t){t&&"custom"===t.errorMessagePosition&&"function"==typeof t.errorMessageCustom&&(e.formUtils.warn("Use of deprecated function errorMessageCustom, use config.submitErrorMessageCallback instead"),t.submitErrorMessageCallback=function(e,a){t.errorMessageCustom(e,t.language.errorTitle,a,t)})}function i(t){if(t.errorMessagePosition&&"object"==typeof t.errorMessagePosition){e.formUtils.warn("Deprecated use of config parameter errorMessagePosition, use config.submitErrorMessageCallback instead");var a=t.errorMessagePosition;t.errorMessagePosition="top",t.submitErrorMessageCallback=function(){return a}}}function n(t){var a={se:"sv",cz:"cs",dk:"da"};if(t.lang in a){var i=a[t.lang];e.formUtils.warn('Deprecated use of lang code "'+t.lang+'" use "'+i+'" instead'),t.lang=i}}e.fn.validateForm=function(t,a){return e.formUtils.warn("Use of deprecated function $.validateForm, use $.isValid instead"),this.isValid(t,a,!0)},e(window).on("formValidationPluginInit",function(e,t){n(t),a(t),i(t)}).on("validatorsLoaded formValidationSetup",function(t,a){a||(a=e("form")),function(t){var a=t.find("[data-validation-if-checked]");a.length&&e.formUtils.warn('Detected use of attribute "data-validation-if-checked" which is deprecated. Use "data-validation-depends-on" provided by module "logic"'),a.on("beforeValidation",function(){var a=e(this),i=a.valAttr("if-checked"),n=e('input[name="'+i+'"]',t),o=n.is(":checked"),r=(e.formUtils.getValue(n)||"").toString(),s=a.valAttr("if-checked-value");(!o||s&&s!==r)&&a.valAttr("skipped",!0)})}(a)})}(e),function(e){"use strict";var t={resolveErrorMessage:function(e,t,a,i,n){var o=i.validationErrorMsgAttribute+"-"+a.replace("validate_",""),r=e.attr(o);return r||((r=e.attr(i.validationErrorMsgAttribute))||((r="function"!=typeof t.errorMessageKey?n[t.errorMessageKey]:n[t.errorMessageKey(i)])||(r=t.errorMessage))),r},getParentContainer:function(t){if(t.valAttr("error-msg-container"))return e(t.valAttr("error-msg-container"));var a=t.parent();return"checkbox"===t.attr("type")&&t.closest(".checkbox").length?a=t.closest(".checkbox").parent():"radio"===t.attr("type")&&t.closest(".radio").length&&(a=t.closest(".radio").parent()),a.closest(".input-group").length&&(a=a.closest(".input-group").parent()),a},applyInputErrorStyling:function(e,t){e.addClass(t.errorElementClass).removeClass(t.successElementClass),this.getParentContainer(e).addClass(t.inputParentClassOnError).removeClass(t.inputParentClassOnSuccess),""!==t.borderColorOnError&&e.css("border-color",t.borderColorOnError)},applyInputSuccessStyling:function(e,t){e.addClass(t.successElementClass),this.getParentContainer(e).addClass(t.inputParentClassOnSuccess)},removeInputStylingAndMessage:function(e,a){e.removeClass(a.successElementClass).removeClass(a.errorElementClass).css("border-color","");var i=t.getParentContainer(e);if(i.removeClass(a.inputParentClassOnError).removeClass(a.inputParentClassOnSuccess),"function"==typeof a.inlineErrorMessageCallback){var n=a.inlineErrorMessageCallback(e,!1,a);n&&n.html("")}else i.find("."+a.errorMessageClass).remove()},removeAllMessagesAndStyling:function(a,i){if("function"==typeof i.submitErrorMessageCallback){var n=i.submitErrorMessageCallback(a,!1,i);n&&n.html("")}else a.find("."+i.errorMessageClass+".alert").remove();a.find("."+i.errorElementClass+",."+i.successElementClass).each(function(){t.removeInputStylingAndMessage(e(this),i)})},setInlineMessage:function(t,a,i){this.applyInputErrorStyling(t,i);var n,o=document.getElementById(t.attr("name")+"_err_msg"),r=!1,s=function(i){e.formUtils.$win.trigger("validationErrorDisplay",[t,i]),i.html(a)},l=function(){var o=!1;r.find("."+i.errorMessageClass).each(function(){if(this.inputReferer===t[0])return o=e(this),!1}),o?a?s(o):o.remove():""!==a&&(n=e('<div class="'+i.errorMessageClass+' alert"></div>'),s(n),n[0].inputReferer=t[0],r.prepend(n))};if(o)e.formUtils.warn("Using deprecated element reference "+o.id),r=e(o),l();else if("function"==typeof i.inlineErrorMessageCallback){if(!(r=i.inlineErrorMessageCallback(t,a,i)))return;l()}else{var d=this.getParentContainer(t);0===(n=d.find("."+i.errorMessageClass+".help-block")).length&&(n=e("<span></span>").addClass("help-block").addClass(i.errorMessageClass)).appendTo(d),s(n)}},setMessageInTopOfForm:function(t,a,i,n){var o='<div class="{errorMessageClass} alert alert-danger"><strong>{errorTitle}</strong><ul>{fields}</ul></div>',r=!1;if("function"!=typeof i.submitErrorMessageCallback||(r=i.submitErrorMessageCallback(t,a,i))){var s={errorTitle:n.errorTitle,fields:"",errorMessageClass:i.errorMessageClass};e.each(a,function(e,t){s.fields+="<li>"+t+"</li>"}),e.each(s,function(e,t){o=o.replace("{"+e+"}",t)}),r?r.html(o):t.children().eq(0).before(e(o))}}};e.formUtils=e.extend(e.formUtils||{},{dialogs:t})}(e),function(e,t,a){"use strict";var i=0;e.fn.validateOnBlur=function(t,a){var i=this,n=this.find("*[data-validation]");return n.each(function(){var n=e(this);if(n.is("[type=radio]")){var o=i.find('[type=radio][name="'+n.attr("name")+'"]');o.bind("blur.validation",function(){n.validateInputOnBlur(t,a,!0,"blur")}),a.validateCheckboxRadioOnClick&&o.bind("click.validation",function(){n.validateInputOnBlur(t,a,!0,"click")})}}),n.bind("blur.validation",function(){e(this).validateInputOnBlur(t,a,!0,"blur")}),a.validateCheckboxRadioOnClick&&this.find("input[type=checkbox][data-validation],input[type=radio][data-validation]").bind("click.validation",function(){e(this).validateInputOnBlur(t,a,!0,"click")}),this},e.fn.validateOnEvent=function(t,a){if(0!==this.length)return("FORM"===this[0].nodeName?this.find("*[data-validation-event]"):this).each(function(){var i=e(this),n=i.valAttr("event");n&&i.unbind(n+".validation").bind(n+".validation",function(i){9!==(i||{}).keyCode&&e(this).validateInputOnBlur(t,a,!0,n)})}),this},e.fn.showHelpOnFocus=function(t){return t||(t="data-validation-help"),this.find("textarea,input").each(function(){var a=e(this),n="jquery_form_help_"+ ++i,o=a.attr(t);a.removeClass("has-help-text").unbind("focus.help").unbind("blur.help"),o&&a.addClass("has-help-txt").bind("focus.help",function(){var t=a.parent().find("."+n);0===t.length&&(t=e("<span />").addClass(n).addClass("help").addClass("help-block").text(o).hide(),a.after(t)),t.fadeIn()}).bind("blur.help",function(){e(this).parent().find("."+n).fadeOut("slow")})}),this},e.fn.validate=function(t,a,i){var n=e.extend({},e.formUtils.LANG,i||{});this.each(function(){var i=e(this),o=(i.closest("form").get(0)||{}).validationConfig||e.formUtils.defaultConfig();i.one("validation",function(e,a){"function"==typeof t&&t(a,this,e)}),i.validateInputOnBlur(n,e.extend({},o,a||{}),!0)})},e.fn.willPostponeValidation=function(){return(this.valAttr("suggestion-nr")||this.valAttr("postpone")||this.hasClass("hasDatepicker"))&&!t.postponedValidation},e.fn.validateInputOnBlur=function(a,i,n,o){if(e.formUtils.eventType=o,this.willPostponeValidation()){var r=this,s=this.valAttr("postpone")||200;return t.postponedValidation=function(){r.validateInputOnBlur(a,i,n,o),t.postponedValidation=!1},setTimeout(function(){t.postponedValidation&&t.postponedValidation()},s),this}a=e.extend({},e.formUtils.LANG,a||{}),e.formUtils.dialogs.removeInputStylingAndMessage(this,i);var l=this,d=l.closest("form"),u=e.formUtils.validateInput(l,a,i,d,o),c=function(){l.validateInputOnBlur(a,i,!1,"blur.revalidated")};return"blur"===o&&l.unbind("validation.revalidate",c).one("validation.revalidate",c),n&&l.removeKeyUpValidation(),u.shouldChangeDisplay&&(u.isValid?e.formUtils.dialogs.applyInputSuccessStyling(l,i):e.formUtils.dialogs.setInlineMessage(l,u.errorMsg,i)),!u.isValid&&n&&l.validateOnKeyUp(a,i),this},e.fn.validateOnKeyUp=function(t,a){return this.each(function(){var i=e(this);i.valAttr("has-keyup-event")||i.valAttr("has-keyup-event","true").bind("keyup.validation",function(e){9!==e.keyCode&&i.validateInputOnBlur(t,a,!1,"keyup")})}),this},e.fn.removeKeyUpValidation=function(){return this.each(function(){e(this).valAttr("has-keyup-event",!1).unbind("keyup.validation")}),this},e.fn.valAttr=function(e,t){return void 0===t?this.attr("data-validation-"+e):!1===t||null===t?this.removeAttr("data-validation-"+e):(e=e.length>0?"-"+e:"",this.attr("data-validation"+e,t))},e.fn.isValid=function(t,a,i){if(e.formUtils.isLoadingModules){var n=this;return setTimeout(function(){n.isValid(t,a,i)},200),null}a=e.extend({},e.formUtils.defaultConfig(),a||{}),t=e.extend({},e.formUtils.LANG,t||{}),i=!1!==i,e.formUtils.errorDisplayPreventedWhenHalted&&(delete e.formUtils.errorDisplayPreventedWhenHalted,i=!1);var o=function(t,n){e.inArray(t,s)<0&&s.push(t),l.push(n),n.valAttr("current-error",t),i&&e.formUtils.dialogs.applyInputErrorStyling(n,a)},r=[],s=[],l=[],d=this;if(i&&e.formUtils.dialogs.removeAllMessagesAndStyling(d,a),d.find("input,textarea,select").filter(':not([type="submit"],[type="button"])').each(function(){var i=e(this),n=i.attr("type"),s="radio"===n||"checkbox"===n,l=i.attr("name");if(!function(t,i){return"submit"===i||"button"===i||"reset"===i||e.inArray(t,a.ignore||[])>-1}(l,n)&&(!s||e.inArray(l,r)<0)){s&&r.push(l);var u=e.formUtils.validateInput(i,t,a,d,"submit");u.isValid?u.isValid&&u.shouldChangeDisplay&&(i.valAttr("current-error",!1),e.formUtils.dialogs.applyInputSuccessStyling(i,a)):o(u.errorMsg,i)}}),"function"==typeof a.onValidate){var u=a.onValidate(d);e.isArray(u)?e.each(u,function(e,t){o(t.message,t.element)}):u&&u.element&&u.message&&o(u.message,u.element)}return e.formUtils.isValidatingEntireForm=!1,l.length>0&&i&&("top"===a.errorMessagePosition?e.formUtils.dialogs.setMessageInTopOfForm(d,s,a,t):e.each(l,function(t,i){e.formUtils.dialogs.setInlineMessage(i,i.valAttr("current-error"),a)}),a.scrollToTopOnError&&e.formUtils.$win.scrollTop(d.offset().top-20)),!i&&e.formUtils.haltValidation&&(e.formUtils.errorDisplayPreventedWhenHalted=!0),0===l.length&&!e.formUtils.haltValidation},e.fn.restrictLength=function(t){return new e.formUtils.lengthRestriction(this,t),this},e.fn.addSuggestions=function(t){var a=!1;return this.find("input").each(function(){var i=e(this);(a=e.split(i.attr("data-suggestions"))).length>0&&!i.hasClass("has-suggestions")&&(e.formUtils.suggest(i,a,t),i.addClass("has-suggestions"))}),this}}(e,window),function(e){"use strict";e.formUtils=e.extend(e.formUtils||{},{isLoadingModules:!1,loadedModules:{},registerLoadedModule:function(t){this.loadedModules[e.trim(t).toLowerCase()]=!0},hasLoadedModule:function(t){return e.trim(t).toLowerCase()in this.loadedModules},loadModules:function(t,a,i){if(e.formUtils.isLoadingModules)setTimeout(function(){e.formUtils.loadModules(t,a,i)},100);else{var n=function(t,a){var n=e.split(t),o=n.length,r=function(){0===--o&&(e.formUtils.isLoadingModules=!1,"function"==typeof i&&i())};o>0&&(e.formUtils.isLoadingModules=!0);var s="?_="+(new Date).getTime(),l=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0];e.each(n,function(t,i){if(0===(i=e.trim(i)).length||e.formUtils.hasLoadedModule(i))r();else{var n=a+i+(".js"===i.slice(-3)?"":".js"),o=document.createElement("SCRIPT");"function"==typeof define&&define.amd?require([n+(".dev.js"===n.slice(-7)?s:"")],r):(o.type="text/javascript",o.onload=r,o.src=n+(".dev.js"===n.slice(-7)?s:""),o.onerror=function(){e.formUtils.warn("Unable to load form validation module "+n,!0),r()},o.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||(r(),this.onload=null,this.onreadystatechange=null)},l.appendChild(o))}})};if(a)n(t,a);else{var o=function(){var a=!1;return e('script[src*="form-validator"]').each(function(){if(!(this.src.split("form-validator")[1].split("node_modules").length>1))return"/"===(a=this.src.substr(0,this.src.lastIndexOf("/"))+"/")&&(a=""),!1}),!1!==a&&(n(t,a),!0)};o()||e(function(){o()||"function"==typeof i&&i()})}}}})}(e),function(e){"use strict";e.split=function(t,a,i){i=void 0===i||!0===i;var n=new RegExp("[,|"+(i?"\\s":"")+"-]\\s*","g");if("function"!=typeof a){if(!t)return[];var o=[];return e.each(t.split(a||n),function(t,a){(a=e.trim(a)).length&&o.push(a)}),o}t&&e.each(t.split(n),function(t,i){if((i=e.trim(i)).length)return a(i,t)})},e.validate=function(t){var a=e.extend(e.formUtils.defaultConfig(),{form:"form",validateOnEvent:!1,validateOnBlur:!0,validateCheckboxRadioOnClick:!0,showHelpOnFocus:!0,addSuggestions:!0,modules:"",onModulesLoaded:null,language:!1,onSuccess:!1,onError:!1,onElementValidate:!1});if(t=e.extend(a,t||{}),e(window).trigger("formValidationPluginInit",[t]),t.lang&&"en"!==t.lang){var i="lang/"+t.lang+".js";t.modules+=t.modules.length?","+i:i}e(t.form).each(function(a,i){i.validationConfig=t;var n=e(i);n.trigger("formValidationSetup",[n,t]),n.find(".has-help-txt").unbind("focus.validation").unbind("blur.validation"),n.removeClass("has-validation-callback").unbind("submit.validation").unbind("reset.validation").find("input[data-validation],textarea[data-validation]").unbind("blur.validation"),n.bind("submit.validation",function(a){var i=e(this),n=function(){return a.stopImmediatePropagation(),!1};if(e.formUtils.haltValidation)return n();if(e.formUtils.isLoadingModules)return setTimeout(function(){i.trigger("submit.validation")},200),n();var o=i.isValid(t.language,t);return e.formUtils.haltValidation?n():o&&"function"==typeof t.onSuccess?!1===t.onSuccess(i)?n():void 0:o||"function"!=typeof t.onError?!!o||n():(t.onError(i),n())}).bind("reset.validation",function(){e.formUtils.dialogs.removeAllMessagesAndStyling(n,t)}).addClass("has-validation-callback"),t.showHelpOnFocus&&n.showHelpOnFocus(),t.addSuggestions&&n.addSuggestions(),t.validateOnBlur&&(n.validateOnBlur(t.language,t),n.bind("html5ValidationAttrsFound",function(){n.validateOnBlur(t.language,t)})),t.validateOnEvent&&n.validateOnEvent(t.language,t)}),""!==t.modules&&e.formUtils.loadModules(t.modules,null,function(){"function"==typeof t.onModulesLoaded&&t.onModulesLoaded();var a="string"==typeof t.form?e(t.form):t.form;e.formUtils.$win.trigger("validatorsLoaded",[a,t])})}}(e),function(e,t){"use strict";var a=e(t);e.formUtils=e.extend(e.formUtils||{},{$win:a,defaultConfig:function(){return{ignore:[],errorElementClass:"error",successElementClass:"valid",borderColorOnError:"#b94a48",errorMessageClass:"form-error",validationRuleAttribute:"data-validation",validationErrorMsgAttribute:"data-validation-error-msg",errorMessagePosition:"inline",errorMessageTemplate:{container:'<div class="{errorMessageClass} alert alert-danger">{messages}</div>',messages:"<strong>{errorTitle}</strong><ul>{fields}</ul>",field:"<li>{msg}</li>"},scrollToTopOnError:!0,dateFormat:"yyyy-mm-dd",addValidClassOnAll:!1,decimalSeparator:".",inputParentClassOnError:"has-error",inputParentClassOnSuccess:"has-success",validateHiddenInputs:!1,inlineErrorMessageCallback:!1,submitErrorMessageCallback:!1}},validators:{},sanitizers:{},_events:{load:[],valid:[],invalid:[]},haltValidation:!1,addValidator:function(e){var t=0===e.name.indexOf("validate_")?e.name:"validate_"+e.name;void 0===e.validateOnKeyUp&&(e.validateOnKeyUp=!0),this.validators[t]=e},addSanitizer:function(e){this.sanitizers[e.name]=e},warn:function(e,a){"console"in t?"function"==typeof t.console.warn?t.console.warn(e):"function"==typeof t.console.log&&t.console.log(e):a&&alert(e)},getValue:function(e,t){var a=t?t.find(e):e;if(a.length>0){var i=a.eq(0).attr("type");return"radio"===i||"checkbox"===i?a.filter(":checked").val()||"":a.val()||""}return!1},validateInput:function(t,a,i,n,o){i=i||e.formUtils.defaultConfig(),a=a||e.formUtils.LANG,n.length||(n=t.parent());var r=this.getValue(t);t.valAttr("skipped",!1).one("beforeValidation",function(){(t.attr("disabled")||!t.is(":visible")&&!i.validateHiddenInputs)&&t.valAttr("skipped",1)}).trigger("beforeValidation",[r,a,i]);var s="true"===t.valAttr("optional"),l=!r&&s,d=t.attr(i.validationRuleAttribute),u=!0,c="",f={isValid:!0,shouldChangeDisplay:!0,errorMsg:""};if(!d||l||t.valAttr("skipped"))return f.shouldChangeDisplay=i.addValidClassOnAll,f;var h=t.valAttr("ignore");return h&&e.each(h.split(""),function(e,t){r=r.replace(new RegExp("\\"+t,"g"),"")}),e.split(d,function(s){0!==s.indexOf("validate_")&&(s="validate_"+s);var l=e.formUtils.validators[s];if(!l)throw new Error('Using undefined validator "'+s+'". Maybe you have forgotten to load the module that "'+s+'" belongs to?');if("validate_checkbox_group"===s&&(t=n.find('[name="'+t.attr("name")+'"]:eq(0)')),("keyup"!==o||l.validateOnKeyUp)&&(u=l.validatorFunction(r,t,i,a,n,o)),!u)return i.validateOnBlur&&t.validateOnKeyUp(a,i),c=e.formUtils.dialogs.resolveErrorMessage(t,l,s,i,a),!1}),!1===u?(t.trigger("validation",!1),f.errorMsg=c,f.isValid=!1,f.shouldChangeDisplay=!0):null===u?f.shouldChangeDisplay=!1:(t.trigger("validation",!0),f.shouldChangeDisplay=!0),"function"==typeof i.onElementValidate&&null!==c&&i.onElementValidate(f.isValid,t,n,c),t.trigger("afterValidation",[f,o]),f},parseDate:function(t,a,i){var n,o,r,s,l=a.replace(/[a-zA-Z]/gi,"").substring(0,1),d="^",u=a.split(l||null);if(e.each(u,function(e,t){d+=(e>0?"\\"+l:"")+"(\\d{"+t.length+"})"}),d+="$",i){var c=[];e.each(t.split(l),function(e,t){1===t.length&&(t="0"+t),c.push(t)}),t=c.join(l)}if(null===(n=t.match(new RegExp(d))))return!1;var f=function(t,a,i){for(var n=0;n<a.length;n++)if(a[n].substring(0,1)===t)return e.formUtils.parseDateInt(i[n+1]);return-1};return r=f("m",u,n),o=f("d",u,n),s=f("y",u,n),!(2===r&&o>28&&(s%4!=0||s%100==0&&s%400!=0)||2===r&&o>29&&(s%4==0||s%100!=0&&s%400==0)||r>12||0===r)&&!(this.isShortMonth(r)&&o>30||!this.isShortMonth(r)&&o>31||0===o)&&[s,r,o]},parseDateInt:function(e){return 0===e.indexOf("0")&&(e=e.replace("0","")),parseInt(e,10)},isShortMonth:function(e){return e%2==0&&e<7||e%2!=0&&e>7},lengthRestriction:function(t,a){var i=parseInt(a.text(),10),n=0,o=function(){var e=t.val().length;if(e>i){var o=t.scrollTop();t.val(t.val().substring(0,i)),t.scrollTop(o)}(n=i-e)<0&&(n=0),a.text(n)};e(t).bind("keydown keyup keypress focus blur",o).bind("cut paste",function(){setTimeout(o,100)}),e(document).bind("ready",o)},numericRangeCheck:function(t,a){var i=e.split(a),n=parseInt(a.substr(3),10);return 1===i.length&&-1===a.indexOf("min")&&-1===a.indexOf("max")&&(i=[a,a]),2===i.length&&(t<parseInt(i[0],10)||t>parseInt(i[1],10))?["out",i[0],i[1]]:0===a.indexOf("min")&&t<n?["min",n]:0===a.indexOf("max")&&t>n?["max",n]:["ok"]},_numSuggestionElements:0,_selectedSuggestion:null,_previousTypedVal:null,suggest:function(t,i,n){var o={css:{maxHeight:"150px",background:"#FFF",lineHeight:"150%",textDecoration:"underline",overflowX:"hidden",overflowY:"auto",border:"#CCC solid 1px",borderTop:"none",cursor:"pointer"},activeSuggestionCSS:{background:"#E9E9E9"}},r=function(e,t){var a=t.offset();e.css({width:t.outerWidth(),left:a.left+"px",top:a.top+t.outerHeight()+"px"})};n&&e.extend(o,n),o.css.position="absolute",o.css["z-index"]=9999,t.attr("autocomplete","off"),0===this._numSuggestionElements&&a.bind("resize",function(){e(".jquery-form-suggestions").each(function(){var t=e(this),a=t.attr("data-suggest-container");r(t,e(".suggestions-"+a).eq(0))})}),this._numSuggestionElements++;var s=function(t){var a=t.valAttr("suggestion-nr");e.formUtils._selectedSuggestion=null,e.formUtils._previousTypedVal=null,e(".jquery-form-suggestion-"+a).fadeOut("fast")};return t.data("suggestions",i).valAttr("suggestion-nr",this._numSuggestionElements).unbind("focus.suggest").bind("focus.suggest",function(){e(this).trigger("keyup"),e.formUtils._selectedSuggestion=null}).unbind("keyup.suggest").bind("keyup.suggest",function(){var a=e(this),i=[],n=e.trim(a.val()).toLocaleLowerCase();if(n!==e.formUtils._previousTypedVal){e.formUtils._previousTypedVal=n;var l=!1,d=a.valAttr("suggestion-nr"),u=e(".jquery-form-suggestion-"+d);if(u.scrollTop(0),""!==n){var c=n.length>2;e.each(a.data("suggestions"),function(e,t){var a=t.toLocaleLowerCase();return a===n?(i.push("<strong>"+t+"</strong>"),l=!0,!1):void((0===a.indexOf(n)||c&&a.indexOf(n)>-1)&&i.push(t.replace(new RegExp(n,"gi"),"<strong>$&</strong>")))})}l||0===i.length&&u.length>0?u.hide():i.length>0&&0===u.length?(u=e("<div></div>").css(o.css).appendTo("body"),t.addClass("suggestions-"+d),u.attr("data-suggest-container",d).addClass("jquery-form-suggestions").addClass("jquery-form-suggestion-"+d)):i.length>0&&!u.is(":visible")&&u.show(),i.length>0&&n.length!==i[0].length&&(r(u,a),u.html(""),e.each(i,function(t,i){e("<div></div>").append(i).css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"5px"}).addClass("form-suggest-element").appendTo(u).click(function(){a.focus(),a.val(e(this).text()),a.trigger("change"),s(a)})}))}}).unbind("keydown.validation").bind("keydown.validation",function(t){var a,i,n=t.keyCode?t.keyCode:t.which,r=e(this);if(13===n&&null!==e.formUtils._selectedSuggestion){if(a=r.valAttr("suggestion-nr"),(i=e(".jquery-form-suggestion-"+a)).length>0){var l=i.find("div").eq(e.formUtils._selectedSuggestion).text();r.val(l),r.trigger("change"),s(r),t.preventDefault()}}else{a=r.valAttr("suggestion-nr");var d=(i=e(".jquery-form-suggestion-"+a)).children();if(d.length>0&&e.inArray(n,[38,40])>-1){38===n?(null===e.formUtils._selectedSuggestion?e.formUtils._selectedSuggestion=d.length-1:e.formUtils._selectedSuggestion--,e.formUtils._selectedSuggestion<0&&(e.formUtils._selectedSuggestion=d.length-1)):40===n&&(null===e.formUtils._selectedSuggestion?e.formUtils._selectedSuggestion=0:e.formUtils._selectedSuggestion++,e.formUtils._selectedSuggestion>d.length-1&&(e.formUtils._selectedSuggestion=0));var u=i.innerHeight(),c=i.scrollTop(),f=i.children().eq(0).outerHeight()*e.formUtils._selectedSuggestion;return(f<c||f>c+u)&&i.scrollTop(f),d.removeClass("active-suggestion").css("background","none").eq(e.formUtils._selectedSuggestion).addClass("active-suggestion").css(o.activeSuggestionCSS),t.preventDefault(),!1}}}).unbind("blur.suggest").bind("blur.suggest",function(){s(e(this))}),t},LANG:{errorTitle:"Form submission failed!",requiredField:"This is a required field",requiredFields:"You have not answered all required fields",badTime:"You have not given a correct time",badEmail:"You have not given a correct e-mail address",badTelephone:"You have not given a correct phone number",badSecurityAnswer:"You have not given a correct answer to the security question",badDate:"You have not given a correct date",lengthBadStart:"The input value must be between ",lengthBadEnd:" characters",lengthTooLongStart:"The input value is longer than ",lengthTooShortStart:"The input value is shorter than ",notConfirmed:"Input values could not be confirmed",badDomain:"Incorrect domain value",badUrl:"The input value is not a correct URL",badCustomVal:"The input value is incorrect",andSpaces:" and spaces ",badInt:"The input value was not a correct number",badSecurityNumber:"Your social security number was incorrect",badUKVatAnswer:"Incorrect UK VAT Number",badUKNin:"Incorrect UK NIN",badUKUtr:"Incorrect UK UTR Number",badStrength:"The password isn't strong enough",badNumberOfSelectedOptionsStart:"You have to choose at least ",badNumberOfSelectedOptionsEnd:" answers",badAlphaNumeric:"The input value can only contain alphanumeric characters ",badAlphaNumericExtra:" and ",wrongFileSize:"The file you are trying to upload is too large (max %s)",wrongFileType:"Only files of type %s is allowed",groupCheckedRangeStart:"Please choose between ",groupCheckedTooFewStart:"Please choose at least ",groupCheckedTooManyStart:"Please choose a maximum of ",groupCheckedEnd:" item(s)",badCreditCard:"The credit card number is not correct",badCVV:"The CVV number was not correct",wrongFileDim:"Incorrect image dimensions,",imageTooTall:"the image can not be taller than",imageTooWide:"the image can not be wider than",imageTooSmall:"the image was too small",min:"min",max:"max",imageRatioNotAccepted:"Image ratio is not be accepted",badBrazilTelephoneAnswer:"The phone number entered is invalid",badBrazilCEPAnswer:"The CEP entered is invalid",badBrazilCPFAnswer:"The CPF entered is invalid",badPlPesel:"The PESEL entered is invalid",badPlNip:"The NIP entered is invalid",badPlRegon:"The REGON entered is invalid",badreCaptcha:"Please confirm that you are not a bot",passwordComplexityStart:"Password must contain at least ",passwordComplexitySeparator:", ",passwordComplexityUppercaseInfo:" uppercase letter(s)",passwordComplexityLowercaseInfo:" lowercase letter(s)",passwordComplexitySpecialCharsInfo:" special character(s)",passwordComplexityNumericCharsInfo:" numeric character(s)",passwordComplexityEnd:"."}})}(e,window),function(e){e.formUtils.addValidator({name:"email",validatorFunction:function(t){var a=t.toLowerCase().split("@"),i=a[0],n=a[1];if(i&&n){if(0===i.indexOf('"')){var o=i.length;if((i=i.replace(/\"/g,"")).length!==o-2)return!1}return e.formUtils.validators.validate_domain.validatorFunction(a[1])&&0!==i.indexOf(".")&&"."!==i.substring(i.length-1,i.length)&&-1===i.indexOf("..")&&!/[^\w\+\.\-\#\-\_\~\!\$\&\'\(\)\*\+\,\;\=\:]/.test(i)}return!1},errorMessage:"",errorMessageKey:"badEmail"}),e.formUtils.addValidator({name:"domain",validatorFunction:function(e){return e.length>0&&e.length<=253&&!/[^a-zA-Z0-9]/.test(e.slice(-2))&&!/[^a-zA-Z0-9]/.test(e.substr(0,1))&&!/[^a-zA-Z0-9\.\-]/.test(e)&&1===e.split("..").length&&e.split(".").length>1},errorMessage:"",errorMessageKey:"badDomain"}),e.formUtils.addValidator({name:"required",validatorFunction:function(t,a,i,n,o){switch(a.attr("type")){case"checkbox":return a.is(":checked");case"radio":return o.find('input[name="'+a.attr("name")+'"]').filter(":checked").length>0;default:return""!==e.trim(t)}},errorMessage:"",errorMessageKey:function(e){return"top"===e.errorMessagePosition||"function"==typeof e.errorMessagePosition?"requiredFields":"requiredField"}}),e.formUtils.addValidator({name:"length",validatorFunction:function(t,a,i,n){var o=a.valAttr("length"),r=a.attr("type");if(void 0===o)return alert('Please add attribute "data-validation-length" to '+a[0].nodeName+" named "+a.attr("name")),!0;var s,l="file"===r&&void 0!==a.get(0).files?a.get(0).files.length:t.length,d=e.formUtils.numericRangeCheck(l,o);switch(d[0]){case"out":this.errorMessage=n.lengthBadStart+o+n.lengthBadEnd,s=!1;break;case"min":this.errorMessage=n.lengthTooShortStart+d[1]+n.lengthBadEnd,s=!1;break;case"max":this.errorMessage=n.lengthTooLongStart+d[1]+n.lengthBadEnd,s=!1;break;default:s=!0}return s},errorMessage:"",errorMessageKey:""}),e.formUtils.addValidator({name:"url",validatorFunction:function(t){if(/^(https?|ftp):\/\/((((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|\[|\]|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)){var a=t.split("://")[1],i=a.indexOf("/");return i>-1&&(a=a.substr(0,i)),e.formUtils.validators.validate_domain.validatorFunction(a)}return!1},errorMessage:"",errorMessageKey:"badUrl"}),e.formUtils.addValidator({name:"number",validatorFunction:function(e,t,a){if(""!==e){var i,n,o=t.valAttr("allowing")||"",r=t.valAttr("decimal-separator")||a.decimalSeparator,s=!1,l=t.valAttr("step")||"",d=!1;if((t.attr("data-sanitize")||"").match(/(^|[\s])numberFormat([\s]|$)/i)){if(!window.numeral)throw new ReferenceError("The data-sanitize value numberFormat cannot be used without the numeral library. Please see Data Validation in http://www.formvalidator.net for more information.");e.length&&(e=String(numeral().unformat(e)))}if(-1===o.indexOf("number")&&(o+=",number"),-1===o.indexOf("negative")&&0===e.indexOf("-"))return!1;if(o.indexOf("range")>-1&&(i=parseFloat(o.substring(o.indexOf("[")+1,o.indexOf(";"))),n=parseFloat(o.substring(o.indexOf(";")+1,o.indexOf("]"))),s=!0),""!==l&&(d=!0),","===r){if(e.indexOf(".")>-1)return!1;e=e.replace(",",".")}if(""===e.replace(/[0-9-]/g,"")&&(!s||e>=i&&e<=n)&&(!d||e%l==0))return!0;if(o.indexOf("float")>-1&&null!==e.match(new RegExp("^([0-9-]+)\\.([0-9]+)$"))&&(!s||e>=i&&e<=n)&&(!d||e%l==0))return!0}return!1},errorMessage:"",errorMessageKey:"badInt"}),e.formUtils.addValidator({name:"alphanumeric",validatorFunction:function(t,a,i,n){var o="^([a-zA-Z0-9",r="]+)$",s=a.valAttr("allowing"),l="",d=!1;if(s){l=o+s+r;var u=s.replace(/\\/g,"");u.indexOf(" ")>-1&&(d=!0,u=u.replace(" ",""),u+=n.andSpaces||e.formUtils.LANG.andSpaces),n.badAlphaNumericAndExtraAndSpaces&&n.badAlphaNumericAndExtra?this.errorMessage=d?n.badAlphaNumericAndExtraAndSpaces+u:n.badAlphaNumericAndExtra+u+n.badAlphaNumericExtra:this.errorMessage=n.badAlphaNumeric+n.badAlphaNumericExtra+u}else l=o+r,this.errorMessage=n.badAlphaNumeric;return new RegExp(l).test(t)},errorMessage:"",errorMessageKey:""}),e.formUtils.addValidator({name:"custom",validatorFunction:function(e,t){return new RegExp(t.valAttr("regexp")).test(e)},errorMessage:"",errorMessageKey:"badCustomVal"}),e.formUtils.addValidator({name:"date",validatorFunction:function(t,a,i){var n=a.valAttr("format")||i.dateFormat||"yyyy-mm-dd",o="false"===a.valAttr("require-leading-zero");return!1!==e.formUtils.parseDate(t,n,o)},errorMessage:"",errorMessageKey:"badDate"}),e.formUtils.addValidator({name:"checkbox_group",validatorFunction:function(t,a,i,n,o){var r=!0,s=a.attr("name"),l=e('input[type=checkbox][name^="'+s+'"]',o),d=l.filter(":checked").length,u=a.valAttr("qty");if(void 0===u){var c=a.get(0).nodeName;alert('Attribute "data-validation-qty" is missing from '+c+" named "+a.attr("name"))}var f=e.formUtils.numericRangeCheck(d,u);switch(f[0]){case"out":this.errorMessage=n.groupCheckedRangeStart+u+n.groupCheckedEnd,r=!1;break;case"min":this.errorMessage=n.groupCheckedTooFewStart+f[1]+(n.groupCheckedTooFewEnd||n.groupCheckedEnd),r=!1;break;case"max":this.errorMessage=n.groupCheckedTooManyStart+f[1]+(n.groupCheckedTooManyEnd||n.groupCheckedEnd),r=!1;break;default:r=!0}if(!r){var h=function(){l.unbind("click",h),l.filter("*[data-validation]").validateInputOnBlur(n,i,!1,"blur")};l.bind("click",h)}return r}})}(e)}),function(e){"object"==typeof module&&"object"==typeof module.exports?e(require("jquery"),window,document):e(jQuery,window,document)}(function(e,t,a,i){var n=[],o=function(){return n.length?n[n.length-1]:null},r=function(){var e,t=!1;for(e=n.length-1;e>=0;e--)n[e].$blocker&&(n[e].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};e.modal=function(t,a){var i,r;if(this.$body=e("body"),this.options=e.extend({},e.modal.defaults,a),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;e.modal.isActive();)e.modal.close();if(n.push(this),t.is("a"))if(r=t.attr("href"),this.anchor=t,/^#/.test(r)){if(this.$elm=e(r),1!==this.$elm.length)return null;this.$body.append(this.$elm),this.open()}else this.$elm=e("<div>"),this.$body.append(this.$elm),i=function(e,t){t.elm.remove()},this.showSpinner(),t.trigger(e.modal.AJAX_SEND),e.get(r).done(function(a){if(e.modal.isActive()){t.trigger(e.modal.AJAX_SUCCESS);var n=o();n.$elm.empty().append(a).on(e.modal.CLOSE,i),n.hideSpinner(),n.open(),t.trigger(e.modal.AJAX_COMPLETE)}}).fail(function(){t.trigger(e.modal.AJAX_FAIL),o().hideSpinner(),n.pop(),t.trigger(e.modal.AJAX_COMPLETE)});else this.$elm=t,this.anchor=t,this.$body.append(this.$elm),this.open()},e.modal.prototype={constructor:e.modal,open:function(){var t=this;this.block(),this.anchor.blur(),this.options.doFade?setTimeout(function(){t.show()},this.options.fadeDuration*this.options.fadeDelay):this.show(),e(a).off("keydown.modal").on("keydown.modal",function(e){var t=o();27===e.which&&t.options.escapeClose&&t.close()}),this.options.clickClose&&this.$blocker.click(function(t){t.target===this&&e.modal.close()})},close:function(){n.pop(),this.unblock(),this.hide(),e.modal.isActive()||e(a).off("keydown.modal")},block:function(){this.$elm.trigger(e.modal.BEFORE_BLOCK,[this._ctx()]),this.$body.css("overflow","hidden"),this.$blocker=e('<div class="'+this.options.blockerClass+' blocker current"></div>').appendTo(this.$body),r(),this.options.doFade&&this.$blocker.css("opacity",0).animate({opacity:1},this.options.fadeDuration),this.$elm.trigger(e.modal.BLOCK,[this._ctx()])},unblock:function(t){!t&&this.options.doFade?this.$blocker.fadeOut(this.options.fadeDuration,this.unblock.bind(this,!0)):(this.$blocker.children().appendTo(this.$body),this.$blocker.remove(),this.$blocker=null,r(),e.modal.isActive()||this.$body.css("overflow",""))},show:function(){this.$elm.trigger(e.modal.BEFORE_OPEN,[this._ctx()]),this.options.showClose&&(this.closeButton=e('<a href="#close-modal" rel="modal:close" class="close-modal '+this.options.closeClass+'">'+this.options.closeText+"</a>"),this.$elm.append(this.closeButton)),this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker),this.options.doFade?this.$elm.css({opacity:0,display:"inline-block"}).animate({opacity:1},this.options.fadeDuration):this.$elm.css("display","inline-block"),this.$elm.trigger(e.modal.OPEN,[this._ctx()])},hide:function(){this.$elm.trigger(e.modal.BEFORE_CLOSE,[this._ctx()]),this.closeButton&&this.closeButton.remove();var t=this;this.options.doFade?this.$elm.fadeOut(this.options.fadeDuration,function(){t.$elm.trigger(e.modal.AFTER_CLOSE,[t._ctx()])}):this.$elm.hide(0,function(){t.$elm.trigger(e.modal.AFTER_CLOSE,[t._ctx()])}),this.$elm.trigger(e.modal.CLOSE,[this._ctx()])},showSpinner:function(){this.options.showSpinner&&(this.spinner=this.spinner||e('<div class="'+this.options.modalClass+'-spinner"></div>').append(this.options.spinnerHtml),this.$body.append(this.spinner),this.spinner.show())},hideSpinner:function(){this.spinner&&this.spinner.remove()},_ctx:function(){return{elm:this.$elm,$elm:this.$elm,$blocker:this.$blocker,options:this.options}}},e.modal.close=function(t){if(e.modal.isActive()){t&&t.preventDefault();var a=o();return a.close(),a.$elm}},e.modal.isActive=function(){return n.length>0},e.modal.getCurrent=o,e.modal.defaults={closeExisting:!0,escapeClose:!0,clickClose:!0,closeText:"Close",closeClass:"",modalClass:"modal",blockerClass:"jquery-modal",spinnerHtml:'<div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div>',showSpinner:!0,showClose:!0,fadeDuration:null,fadeDelay:1},e.modal.BEFORE_BLOCK="modal:before-block",e.modal.BLOCK="modal:block",e.modal.BEFORE_OPEN="modal:before-open",e.modal.OPEN="modal:open",e.modal.BEFORE_CLOSE="modal:before-close",e.modal.CLOSE="modal:close",e.modal.AFTER_CLOSE="modal:after-close",e.modal.AJAX_SEND="modal:ajax:send",e.modal.AJAX_SUCCESS="modal:ajax:success",e.modal.AJAX_FAIL="modal:ajax:fail",e.modal.AJAX_COMPLETE="modal:ajax:complete",e.fn.modal=function(t){return 1===this.length&&new e.modal(this,t),this},e(a).on("click.modal",'a[rel~="modal:close"]',e.modal.close),e(a).on("click.modal",'a[rel~="modal:open"]',function(t){t.preventDefault(),e(this).modal()})}),jQuery(document).ready(function(e){var t=e("#snippet_type"),a=e("#anonymizeip"),i=e("#anonymizeip")[0],n=e("#gtm_id");e("#script_debug_mode");function o(e){e.attr("disabled",!0)}function r(e){e.removeAttr("disabled")}function s(e,t){e.checked=t}e.widget.bridge("gaetooltip",e.ui.tooltip),e(".ga-tooltip").gaetooltip({position:{my:"left bottom-10",at:"right top",collision:"none"}}),e("#advanced:checkbox").change(function(){e(this).is(":checked")?e("#forcesnopperwrap").show():e("#forcesnopperwrap").hide()}),e(".btn_upload").on("click",function(t){e(".settings_content").slideDown(),t.preventDefault()}),e(".btn_close").on("click",function(t){e(".settings_content").slideUp(),t.preventDefault()}),e(".popup").on("click",function(t){e(".popup").slideUp(),t.preventDefault()}),"none"!==t.val()&&"gtm"!==t.val()||(s(i,!1),o(a)),"gtm"===t.val()?r(n):o(n),t.change(function(){var t=e(this).val();"none"===t||"gtm"===t?(s(i,!1),o(a)):r(a),"gtm"===t?r(n):o(n)}),e(".btn_upload").on("click",function(t){e(".settings_content").slideDown(),t.preventDefault()}),e(".btn_close").on("click",function(t){e(".settings_content").slideUp(),t.preventDefault()}),e(".popup").on("click",function(t){e(".popup").slideUp(),t.preventDefault()}),e('input[name="ga_events_options[permitted_roles][]"][value="administrator"]').css({"pointer-events":"none",opacity:.5}).prop("checked",!0),e(".divs-istracktime:checkbox").change(function(){var t=e(this),a=t.is(":checked"),i=t.data("track"),n="#track-elem"+i,o="#eventValue"+i;a?(e(n).show(),e(o).attr("disabled",!0)):(e(n).hide(),e(o).removeAttr("disabled"))}),e("#empty-istracktime:checkbox").change(function(){e(this).is(":checked")?(e("#empty-trackelem").show(),e("#empty-eventValue").attr("disabled",!0)):(e("#empty-trackelem").hide(),e("#empty-eventValue").removeAttr("disabled"))}),e(".divs-istracktime").trigger("change"),jQuery("body").on("click",'a[href="admin.php?page=wp-google-analytics-events-upgrade"]',function(e){e.preventDefault(),window.open("https://wpflow.com/upgrade/?utm_source=wpadmin&utm_medium=banner&utm_campaign=nav","_blank")})});var gaeAjax=function(e){function t(t){t.preventDefault();var a=e(this).attr("id"),i="#"+e(this).data("action");e.ajax({type:"POST",url:wpflow_ajax.ajax_url,data:{post_id:a,action:"wpflow_get_event_json"},success:function(t){e(i).modal(),function(t,a){if(void 0!==a)for(var i in a)a.hasOwnProperty(i)&&(e(t+" #"+i).is(":checkbox")?"true"===a[i][0]?e(t+" #"+i).attr("checked",!0):e(t+" #"+i).removeAttr("checked",!1):e(t+" #"+i).val(a[i][0]))}(i,t.meta),e(i+" #event_id").val(a)},error:function(){alert("Error updating event")}})}function a(t){t.preventDefault();var a=e(this);e.ajax({type:"post",url:wpflow_ajax.ajax_url,data:a.serialize(),success:function(e){window.location.reload()}})}e(document).ready(function(e){if(void 0!==e.fn.modal.noConflict)e.fn.modal.noConflict();e.validate(),e(".wpgae-event-form").on("submit",a),e(".ga_main .edit a").click(t),e(".ga_main .delete a").click(t),e('.deactivate a[href*="wp-google-analytics-events"], #wpgae-modal-cancel a').click(function(t){t.preventDefault(),e("#wpgae-modal-content, #wpgae-modal-background").toggleClass("active"),e("#wpgae-just-deactivate").attr("href",this.href)}),e("#wpgae-feedback-form").submit(function(t){t.preventDefault();var a=e(this);e.ajax({type:"POST",url:wpflow_ajax.ajax_url,data:a.serialize(),success:function(t){window.location=e("#wpgae-just-deactivate").attr("href")}})})})}(jQuery);
js/dist/admin-scripts.js CHANGED
@@ -52,8 +52,16 @@ jQuery(document).ready(function($){
52
  at: "right top",
53
  collision: "none"
54
  }
55
- });
56
 
 
 
 
 
 
 
 
 
57
 
58
  $('.btn_upload').on('click', function (e){
59
  $('.settings_content').slideDown();
@@ -197,6 +205,30 @@ var gaeAjax = ( function ( $ ) {
197
  $(".ga_main .edit a").click(openAndPoplulateEventModal);
198
  // Populate and Show the Delete event modal
199
  $(".ga_main .delete a").click(openAndPoplulateEventModal);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  });
201
 
202
 
@@ -253,6 +285,7 @@ var gaeAjax = ( function ( $ ) {
253
  }
254
  }
255
  }
 
256
  } )( jQuery );
257
 
258
 
52
  at: "right top",
53
  collision: "none"
54
  }
55
+ })
56
 
57
+ $('#advanced:checkbox').change(function (){
58
+ var checked = $(this).is(':checked');
59
+ if (checked){
60
+ $('#forcesnopperwrap').show();
61
+ } else {
62
+ $('#forcesnopperwrap').hide();
63
+ }
64
+ });
65
 
66
  $('.btn_upload').on('click', function (e){
67
  $('.settings_content').slideDown();
205
  $(".ga_main .edit a").click(openAndPoplulateEventModal);
206
  // Populate and Show the Delete event modal
207
  $(".ga_main .delete a").click(openAndPoplulateEventModal);
208
+
209
+
210
+ $('.deactivate a[href*="wp-google-analytics-events"], #wpgae-modal-cancel a').click(function(e) {
211
+ e.preventDefault();
212
+ $("#wpgae-modal-content, #wpgae-modal-background").toggleClass("active");
213
+ $("#wpgae-just-deactivate").attr("href", this.href);
214
+ });
215
+
216
+ $('#wpgae-feedback-form').submit(function (e) {
217
+ e.preventDefault(); // avoid to execute the actual submit of the form.
218
+ var form = $(this);
219
+
220
+ $.ajax({
221
+ type: "POST",
222
+ url: wpflow_ajax.ajax_url,
223
+ data: form.serialize(), // serializes the form's elements.
224
+ success: function(data)
225
+ {
226
+ window.location = $("#wpgae-just-deactivate").attr("href");
227
+ }
228
+ });
229
+
230
+ });
231
+
232
  });
233
 
234
 
285
  }
286
  }
287
  }
288
+
289
  } )( jQuery );
290
 
291
 
js/dist/frontend-scripts-min.js CHANGED
@@ -1 +1 @@
1
- var gaeMapper=function(){if("undefined"!=typeof ga_options){function e(e){var t="";return"class"===e.type?t+=".":"id"===e.type&&(t+="#"),t+=e.name}for(var t=[],a=ga_options.click_elements,n=0;n<a.length;n++){var o=a[n];newClickElement={},newClickElement.data={select:e(o),category:o.category,action:o.action,label:o.label,bounce:parseInt(o.non_interaction),evalue:o.value,link_click_delay:parseInt(ga_options.link_clicks_delay),universal:parseInt(ga_options.universal)},newClickElement.selector=newClickElement.data.select,t.push(newClickElement)}var r=[];return ga_options.scroll_elements.forEach(function(t){r.push({select:e(t),category:t.category,action:t.action,label:t.label,bounce:parseInt(t.non_interaction),evalue:t.value})}),{clickElementsFromDB:t,scrollElementsFromDB:r,advancedMode:ga_options.advanced,link_clicks_delay:ga_options.link_clicks_delay,snippet_type:ga_options.snippet_type,scriptDebugMode:ga_options.script_debug_mode}}}();gaEventsMain=function(e){"use strict";var t;function a(){for(var t=e(window).height(),a=e(document).scrollTop(),o=0;o<gaeMapper.scrollElementsFromDB.length;o++)if(!gaeMapper.scrollElementsFromDB[o].sent){var r=e(gaeMapper.scrollElementsFromDB[o].select);gaeMapper.scrollElementsFromDB[o].offset=r.offset(),gaeMapper.scrollElementsFromDB[o].offset&&a+t>=gaeMapper.scrollElementsFromDB[o].offset.top+r.height()&&(n(gaeMapper.scrollElementsFromDB[o].category,gaeMapper.scrollElementsFromDB[o].action,gaeMapper.scrollElementsFromDB[o].label,gaeMapper.scrollElementsFromDB[o].bounce,gaeMapper.scrollElementsFromDB[o].evalue),gaeMapper.scrollElementsFromDB[o].sent=!0)}}e(document).ready(function(){gaeMapper.clickElementsFromDB.forEach(function(t){e("body").on("click",t.selector,t.data,o)}),e(window).on("scroll",a)});var n=function(e,a,n,o,r){if(void 0===t)if("undefined"!=typeof ga)t=ga;else if("undefined"!=typeof _gaq)t=_gaq;else if("function"==typeof __gaTracker)t=__gaTracker;else if("function"==typeof gaplusu)t=gaplusu;else if("gtm"!==gaeMapper.snippet_type&&"undefined"==typeof dataLayer)return;e=e||"uncategorized",a=a||"",n=n||"";var l=r||"",i=o||!1;"gtm"==gaeMapper.snippet_type||"undefined"!=typeof dataLayer&&"undefined"==typeof gtag?dataLayer.push({event:"WPGAE",eventCategory:e,eventAction:a,eventLabel:n,eventValue:l,nonInteraction:i}):"gst"==gaeMapper.snippet_type||"undefined"!=typeof gtag?gtag("event",a,{event_category:e,event_label:n,value:l,non_interaction:i}):"universal"==gaeMapper.snippet_type||"undefined"!=typeof ga||"function"==typeof __gaTracker?l?t("send","event",e,a,n,l,{nonInteraction:i}):t("send","event",e,a,n,{nonInteraction:i}):"legacy"!=gaeMapper.snippet_type&&"undefined"==typeof _gaq||t.push(["_trackEvent",e,a,n,l,i])},o=function(e){if(n(e.data.category,e.data.action,e.data.label,e.data.bounce,e.data.evalue,this),void 0!==e.data.link_click_delay&&e.data.link_click_delay>0&&void 0!==e.target.href&&"A"==e.target.nodeName){e.preventDefault();var t,a=!1;e.target.target&&"_blank"===e.target.target.trim()&&(a=!0),a&&(t=window.open("","_blank"));var o=r(e);void 0!==o&&""!==o?window.location.hash=o:setTimeout(function(){a?t.location.href=e.target.href:window.location=e.target.href},parseInt(gaeMapper.link_clicks_delay))}},r=function(t){var a="";return 0===(a="A"!==t.target.tagName?e(t.target).parents("a").attr("href"):e(t.target).attr("href")).indexOf("#")?a:""}}(jQuery);
1
+ var gaeMapper=function(){if("undefined"!=typeof ga_options){function e(e){var n="";return"class"===e.type?n+=".":"id"===e.type&&(n+="#"),n+=e.name}for(var n=[],a=ga_options.click_elements,t=0;t<a.length;t++){var o=a[t];newClickElement={},newClickElement.data={select:e(o),category:o.category,action:o.action,label:o.label,bounce:parseInt(o.non_interaction),evalue:o.value,link_click_delay:parseInt(ga_options.link_clicks_delay),universal:parseInt(ga_options.universal)},newClickElement.selector=newClickElement.data.select,n.push(newClickElement)}var i=ga_options.scroll_elements,r=[];return void 0!==i&&i.forEach(function(n){r.push({select:e(n),category:n.category,action:n.action,label:n.label,bounce:parseInt(n.non_interaction),evalue:n.value})}),{clickElementsFromDB:n,scrollElementsFromDB:r,advancedMode:ga_options.advanced,forceSnippet:ga_options.force_snippet,emailLinksTracking:ga_options.email_link_tracking,telLinksTracking:ga_options.tel_link_tracking,downloadTracking:ga_options.download_tracking,downloadTrackingFileTypes:ga_options.download_tracking_type,link_clicks_delay:ga_options.link_clicks_delay,snippet_type:ga_options.snippet_type,isFrontPage:gaePlaceholders.is_front_page,pageTitle:gaePlaceholders.page_title,scriptDebugMode:ga_options.script_debug_mode}}}();gaEventsMain=function(e){"use strict";var n;function a(){for(var n=e(window).height(),a=e(document).scrollTop(),t=0;t<gaeMapper.scrollElementsFromDB.length;t++)if(!gaeMapper.scrollElementsFromDB[t].sent){var i=e(gaeMapper.scrollElementsFromDB[t].select);gaeMapper.scrollElementsFromDB[t].offset=i.offset(),gaeMapper.scrollElementsFromDB[t].offset&&a+n>=gaeMapper.scrollElementsFromDB[t].offset.top+i.height()&&(o(gaeMapper.scrollElementsFromDB[t].category,gaeMapper.scrollElementsFromDB[t].action,gaeMapper.scrollElementsFromDB[t].label,gaeMapper.scrollElementsFromDB[t].bounce,gaeMapper.scrollElementsFromDB[t].evalue),gaeMapper.scrollElementsFromDB[t].sent=!0)}}e(document).ready(function(){gaeMapper.clickElementsFromDB.forEach(function(n){e("body").on("click",n.selector,n.data,d)}),"1"===gaeMapper.downloadTracking&&gaeMapper.downloadTrackingFileTypes.forEach(function(n){var a=n.toLowerCase(),o=n.toUpperCase();e("body").on("click",'a[href$=".'+a+'"]',t),e("body").on("click",'a[href$=".'+o+'"]',t)}),"1"===gaeMapper.emailLinksTracking&&e("body").on("click",'a[href^="mailto:"]',function(e){e.preventDefault();var n=this.href.split(":").pop(),a=k();o(a,"Email Link",n,!1,""),u(this,e)}),"1"===gaeMapper.telLinksTracking&&e("body").on("click",'a[href^="tel:"]',function(e){e.preventDefault();var n=this.href.split(":").pop(),a=k();o(a,"Telephone Number Link",n,!1,""),u(this,e)}),e(window).on("scroll",a)});var t=function(e){e.preventDefault();var n=this.href.split("/").pop(),a=k();o(a,"Download",n,!1,""),u(this,e)},o=function(e,a,t,o,d){if(void 0===n)if("undefined"!=typeof ga)n=ga;else if("undefined"!=typeof _gaq)n=_gaq;else if("function"==typeof __gaTracker)n=__gaTracker;else if("function"==typeof gaplusu)n=gaplusu;else if("gtm"!==gaeMapper.snippet_type&&"undefined"==typeof dataLayer)return;e=e||"uncategorized",a=a||"",t=t||"";var u=d||"",_=o||!1;switch(gaeMapper.forceSnippet){case"none":r()?s(e,a,t,u,_):i()?p(e,a,t,u,_):l()?g(e,a,t,u,_):c()&&f(e,a,t,u,_);break;case"gtm":p(e,a,t,u,_);break;case"gst":s(e,a,t,u,_);break;case"universal":g(e,a,t,u,_)}},i=function(){return"gtm"===gaeMapper.snippet_type||"undefined"!=typeof dataLayer&&"undefined"==typeof gtag},r=function(){return"gst"===gaeMapper.snippet_type||"undefined"!=typeof gtag},l=function(){return"universal"===gaeMapper.snippet_type||"undefined"!=typeof ga||"function"==typeof __gaTracker},c=function(){return"legacy"===gaeMapper.snippet_type||"undefined"!=typeof _gaq},p=function(e,n,a,t,o){dataLayer.push({event:"WPGAE",eventCategory:e,eventAction:n,eventLabel:a,eventValue:t,nonInteraction:o})},s=function(e,n,a,t,o){gtag("event",n,{event_category:e,event_label:a,value:t,non_interaction:o})},g=function(e,a,t,o,i){o?n("send","event",e,a,t,o,{nonInteraction:i}):n("send","event",e,a,t,{nonInteraction:i})},f=function(e,a,t,o,i){n.push(["_trackEvent",e,a,t,o,i])},d=function(e){o(e.data.category,e.data.action,e.data.label,e.data.bounce,e.data.evalue,this),void 0!==e.data.link_click_delay&&e.data.link_click_delay>0&&void 0!==e.target.href&&"A"==e.target.nodeName&&u(this,e)},u=function(n,a){a.preventDefault();var t,o=e(n).attr("href"),i=function(n){var a=e(n).attr("target");return void 0!==a&&"_blank"===a.trim()}(n);i&&(t=window.open("","_blank"));var r=_(o);void 0!==r&&""!==r?window.location.hash=r:window.location.href!==o&&setTimeout(function(){i?t.location.href=o:window.location=o},parseInt(gaeMapper.link_clicks_delay),t)},_=function(e){return void 0!==e&&0===e.indexOf("#")?e:""};function k(){return"1"===gaeMapper.isFrontPage?"Home":void 0!==gaeMapper.pageTitle?gaeMapper.pageTitle:""}}(jQuery);
js/dist/frontend-scripts.js CHANGED
@@ -1,3 +1,5 @@
 
 
1
  /*
2
  * Main GA Events Plugin function
3
  *
@@ -72,16 +74,18 @@ var gaeMapper = (function () {
72
  var scrollElementsFromDB = [];
73
 
74
  // NB these will be assigned meaningful names in backend eventually
75
- scroll_elements_from_options.forEach(function (el) {
76
- scrollElementsFromDB.push({
77
- "select": makeSelector(el),
78
- "category": el.category,
79
- "action": el.action,
80
- "label": el.label,
81
- "bounce": parseInt(el.non_interaction),
82
- "evalue": el.value // "value" in DB. Change in project?
 
 
83
  });
84
- });
85
 
86
  // Scrollelements from DB section ends
87
 
@@ -92,8 +96,15 @@ var gaeMapper = (function () {
92
  clickElementsFromDB: clickElementsFromDB,
93
  scrollElementsFromDB: scrollElementsFromDB,
94
  advancedMode: ga_options.advanced,
 
 
 
 
 
95
  link_clicks_delay: ga_options.link_clicks_delay,
96
  snippet_type: ga_options.snippet_type,
 
 
97
  scriptDebugMode: ga_options.script_debug_mode,
98
  }
99
 
@@ -132,6 +143,9 @@ gaEventsMain = (function ($) {
132
  $('body').on('click', el.selector, el.data, click_event);
133
  });
134
 
 
 
 
135
  // Bind scroll events stored in the DB to the window
136
  $(window).on('scroll', bindScrollEventsFromDB);
137
  }
@@ -164,7 +178,59 @@ gaEventsMain = (function ($) {
164
  }
165
  }
166
  }
167
- } // End of bindScrollEvents
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
  /*
170
  * The main function for tracking events
@@ -179,7 +245,6 @@ gaEventsMain = (function ($) {
179
  * @returns {undefined}
180
  */
181
  var track_event = function (category, action, label, bounce, evalue) {
182
-
183
  if (typeof ga_element === "undefined") {
184
  if (typeof ga !== 'undefined') {
185
  ga_element = ga;
@@ -205,36 +270,103 @@ gaEventsMain = (function ($) {
205
 
206
  var event_value = !evalue ? '' : evalue;
207
  var event_bounce = !bounce ? false : bounce;
208
-
209
- // Push data from event to relevant API
210
- if (gaeMapper.snippet_type == 'gtm' || ( typeof dataLayer !== 'undefined' && typeof gtag === "undefined" )) {
211
- dataLayer.push({
212
- 'event': 'WPGAE',
213
- 'eventCategory': category,
214
- 'eventAction': action,
215
- 'eventLabel': label,
216
- 'eventValue': event_value,
217
- 'nonInteraction': event_bounce
218
- });
 
 
 
 
 
 
 
 
 
 
219
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- // We might want to call the tracking APIs as well as pushing to the data layer
222
- // in which case this should be if rather than else if
223
- else if (gaeMapper.snippet_type == 'gst' || typeof gtag != 'undefined') {
224
- gtag('event', action, {
225
- // Event parameters
226
- 'event_category': category, 'event_label': label, 'value': event_value, 'non_interaction': event_bounce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  });
228
- } else if (gaeMapper.snippet_type == 'universal' || typeof ga != 'undefined' || (typeof __gaTracker === "function")) {
229
- if (event_value) {
230
- ga_element('send', 'event', category, action, label, event_value, {'nonInteraction': event_bounce});
231
- } else {
232
- ga_element('send', 'event', category, action, label, {'nonInteraction': event_bounce});
233
- }
234
- } else if (gaeMapper.snippet_type == 'legacy' || typeof _gaq != 'undefined') {
235
- ga_element.push(['_trackEvent', category, action, label, event_value, event_bounce]);
236
  }
237
- }; // End of track_event function
 
 
 
 
 
238
 
239
  /**
240
  * Click event function
@@ -245,47 +377,61 @@ gaEventsMain = (function ($) {
245
  var click_event = function (event) {
246
 
247
  track_event(event.data.category, event.data.action, event.data.label, event.data.bounce, event.data.evalue, this);
248
-
249
  if (typeof event.data.link_click_delay !== 'undefined' && event.data.link_click_delay > 0 && typeof event.target.href !== 'undefined' && event.target.nodeName == "A") {
250
- event.preventDefault();
251
- var openInNewTab = false;
252
- if (event.target.target) {
253
- if (event.target.target.trim() === "_blank") {
254
- openInNewTab = true;
255
- }
256
- }
257
- var w;
258
- if (openInNewTab) {
259
- w = window.open('', '_blank');
260
- }
261
 
262
- var hash = isJustHashLink(event);
263
- if (typeof hash !== "undefined" && hash !== "") {
264
- window.location.hash = hash;
265
- } else {
266
- setTimeout(function () {
267
- if (openInNewTab) {
268
- w.location.href = event.target.href;
269
- } else {
270
- window.location = event.target.href;
271
- }
272
- }, parseInt(gaeMapper.link_clicks_delay));
273
  }
274
- }
 
275
 
 
 
 
276
 
277
- }; // End of click event function
278
- var isJustHashLink = function ( event ) {
279
- var url = "";
280
- if ( event.target.tagName !== "A" ) {
281
- url = $( event.target ).parents( "a" ).attr( "href" );
282
- } else {
283
- url = $( event.target ).attr( "href" );
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
- if ( url.indexOf( "#" ) === 0 ) {
 
 
 
286
  return url;
287
  }
288
  return "";
289
  };
290
 
 
 
 
 
 
 
 
 
 
 
 
291
  })(jQuery);
1
+ // noinspection JSVoidFunctionReturnValueUsed
2
+
3
  /*
4
  * Main GA Events Plugin function
5
  *
74
  var scrollElementsFromDB = [];
75
 
76
  // NB these will be assigned meaningful names in backend eventually
77
+ if (typeof scroll_elements_from_options !== "undefined") {
78
+ scroll_elements_from_options.forEach(function (el) {
79
+ scrollElementsFromDB.push({
80
+ "select": makeSelector(el),
81
+ "category": el.category,
82
+ "action": el.action,
83
+ "label": el.label,
84
+ "bounce": parseInt(el.non_interaction),
85
+ "evalue": el.value // "value" in DB. Change in project?
86
+ });
87
  });
88
+ }
89
 
90
  // Scrollelements from DB section ends
91
 
96
  clickElementsFromDB: clickElementsFromDB,
97
  scrollElementsFromDB: scrollElementsFromDB,
98
  advancedMode: ga_options.advanced,
99
+ forceSnippet: ga_options.force_snippet,
100
+ emailLinksTracking: ga_options.email_link_tracking,
101
+ telLinksTracking: ga_options.tel_link_tracking,
102
+ downloadTracking: ga_options.download_tracking,
103
+ downloadTrackingFileTypes: ga_options.download_tracking_type,
104
  link_clicks_delay: ga_options.link_clicks_delay,
105
  snippet_type: ga_options.snippet_type,
106
+ isFrontPage: gaePlaceholders.is_front_page,
107
+ pageTitle: gaePlaceholders.page_title,
108
  scriptDebugMode: ga_options.script_debug_mode,
109
  }
110
 
143
  $('body').on('click', el.selector, el.data, click_event);
144
  });
145
 
146
+ bindDownloadTrackingEvents();
147
+ bindEmailLinksTracking();
148
+ bindTelLinksTracking();
149
  // Bind scroll events stored in the DB to the window
150
  $(window).on('scroll', bindScrollEventsFromDB);
151
  }
178
  }
179
  }
180
  }
181
+ }
182
+
183
+ /**
184
+ * Binds Download Tracking
185
+ *
186
+ * @returns {undefined}
187
+ */
188
+ function bindDownloadTrackingEvents() {
189
+ if (gaeMapper.downloadTracking === "1") {
190
+ gaeMapper.downloadTrackingFileTypes.forEach(function (ftype) {
191
+ var lowercase = ftype.toLowerCase();
192
+ var uppercase = ftype.toUpperCase();
193
+
194
+ $('body').on('click', 'a[href$=".' + lowercase + '"]', trackFileDownloaded);
195
+ $('body').on('click', 'a[href$=".' + uppercase + '"]', trackFileDownloaded);
196
+ });
197
+ }
198
+ } // End of bindScrollEvents
199
+
200
+ function bindEmailLinksTracking() {
201
+ if (gaeMapper.emailLinksTracking === "1") {
202
+ $('body').on('click', 'a[href^="mailto:"]', function (e) {
203
+ e.preventDefault();
204
+ var label = this.href.split(':').pop();
205
+ var action = "Email Link";
206
+ var category = getPageName();
207
+ track_event(category,action,label,false, "");
208
+ handleLinks(this, e);
209
+ });
210
+ }
211
+ }
212
+
213
+ function bindTelLinksTracking() {
214
+ if (gaeMapper.telLinksTracking === "1") {
215
+ $('body').on('click', 'a[href^="tel:"]', function (e) {
216
+ e.preventDefault();
217
+ var label = this.href.split(':').pop();
218
+ var action = "Telephone Number Link";
219
+ var category = getPageName();
220
+ track_event(category,action,label,false, "");
221
+ handleLinks(this, e);
222
+ });
223
+ }
224
+ }
225
+
226
+ var trackFileDownloaded = function (e) {
227
+ e.preventDefault();
228
+ var label = this.href.split('/').pop();
229
+ var action = "Download";
230
+ var category = getPageName();
231
+ track_event(category,action,label,false, "");
232
+ handleLinks(this, e);
233
+ };
234
 
235
  /*
236
  * The main function for tracking events
245
  * @returns {undefined}
246
  */
247
  var track_event = function (category, action, label, bounce, evalue) {
 
248
  if (typeof ga_element === "undefined") {
249
  if (typeof ga !== 'undefined') {
250
  ga_element = ga;
270
 
271
  var event_value = !evalue ? '' : evalue;
272
  var event_bounce = !bounce ? false : bounce;
273
+ switch (gaeMapper.forceSnippet) {
274
+ case "none":
275
+ if (useGlobalSiteTagSnippet()) {
276
+ globalSiteTagEvent(category, action, label, event_value, event_bounce);
277
+ } else if (useGoogleTagManagerSnippet()) {
278
+ googleTagManagerEvent(category, action, label, event_value, event_bounce);
279
+ } else if (useUniversalTrackingSnippet()) {
280
+ universalTrackingEvent(category, action, label, event_value, event_bounce);
281
+ } else if (useLegacySnippet()) {
282
+ legacyTrackingEvent(category, action, label, event_value, event_bounce);
283
+ }
284
+ break;
285
+ case "gtm":
286
+ googleTagManagerEvent(category, action, label, event_value, event_bounce);
287
+ break;
288
+ case "gst":
289
+ globalSiteTagEvent(category, action, label, event_value, event_bounce);
290
+ break;
291
+ case "universal":
292
+ universalTrackingEvent(category, action, label, event_value, event_bounce);
293
+ break;
294
  }
295
+ }; // End of track_event function
296
+
297
+ var useGoogleTagManagerSnippet = function () {
298
+ return (
299
+ gaeMapper.snippet_type === "gtm" ||
300
+ (typeof dataLayer !== "undefined" && typeof gtag === "undefined")
301
+ );
302
+ };
303
+
304
+ var useGlobalSiteTagSnippet = function () {
305
+ return gaeMapper.snippet_type === "gst" || typeof gtag !== "undefined";
306
+ };
307
+
308
+ var useUniversalTrackingSnippet = function () {
309
+ return (
310
+ gaeMapper.snippet_type === "universal" ||
311
+ typeof ga !== "undefined" ||
312
+ typeof __gaTracker === "function"
313
+ );
314
+ };
315
+
316
+ var useLegacySnippet = function () {
317
+ return gaeMapper.snippet_type === "legacy" || typeof _gaq !== "undefined";
318
+ };
319
+
320
+ // Use the Google Tag Manager object to send an event
321
+ var googleTagManagerEvent = function (
322
+ category,
323
+ action,
324
+ label,
325
+ value,
326
+ bounce
327
+ ) {
328
+ dataLayer.push({
329
+ event: "WPGAE",
330
+ eventCategory: category,
331
+ eventAction: action,
332
+ eventLabel: label,
333
+ eventValue: value,
334
+ nonInteraction: bounce,
335
+ });
336
+ };
337
 
338
+ var globalSiteTagEvent = function (category, action, label, value, bounce) {
339
+ gtag("event", action, {
340
+ // Event parameters
341
+ event_category: category,
342
+ event_label: label,
343
+ value: value,
344
+ non_interaction: bounce,
345
+ });
346
+ };
347
+
348
+ var universalTrackingEvent = function (
349
+ category,
350
+ action,
351
+ label,
352
+ value,
353
+ bounce
354
+ ) {
355
+ if (value) {
356
+ ga_element("send", "event", category, action, label, value, {
357
+ nonInteraction: bounce,
358
+ });
359
+ } else {
360
+ ga_element("send", "event", category, action, label, {
361
+ nonInteraction: bounce,
362
  });
 
 
 
 
 
 
 
 
363
  }
364
+ };
365
+
366
+ var legacyTrackingEvent = function (category, action, label, value, bounce) {
367
+ ga_element.push(["_trackEvent", category, action, label, value, bounce]);
368
+ };
369
+
370
 
371
  /**
372
  * Click event function
377
  var click_event = function (event) {
378
 
379
  track_event(event.data.category, event.data.action, event.data.label, event.data.bounce, event.data.evalue, this);
 
380
  if (typeof event.data.link_click_delay !== 'undefined' && event.data.link_click_delay > 0 && typeof event.target.href !== 'undefined' && event.target.nodeName == "A") {
381
+ handleLinks(this, event);
382
+ }
383
+ }; // End of click event function
 
 
 
 
 
 
 
 
384
 
385
+
386
+ var isNewTab = function (self) {
387
+ var target = $(self).attr("target")
388
+ if (typeof target !== "undefined" && target.trim() === "_blank") {
389
+ return true;
 
 
 
 
 
 
390
  }
391
+ return false;
392
+ }
393
 
394
+ var handleLinks = function (self, event) {
395
+ event.preventDefault();
396
+ var link = $(self).attr("href");
397
 
398
+
399
+ var w;
400
+ var openInNewTab = isNewTab(self)
401
+ if (openInNewTab) {
402
+ w = window.open('', '_blank');
403
+ }
404
+
405
+ var hash = isJustHashLink(link);
406
+ if (typeof hash !== "undefined" && hash !== "") {
407
+ window.location.hash = hash;
408
+ } else if (window.location.href !== link){
409
+ setTimeout(function () {
410
+ if (openInNewTab) {
411
+ w.location.href = link;
412
+ } else {
413
+ window.location = link;
414
+ }
415
+ }, parseInt(gaeMapper.link_clicks_delay), w);
416
  }
417
+ }
418
+
419
+ var isJustHashLink = function ( url ) {
420
+ if ( typeof url !== "undefined" && url.indexOf( "#" ) === 0 ) {
421
  return url;
422
  }
423
  return "";
424
  };
425
 
426
+ function getPageName () {
427
+ if ("1" === gaeMapper.isFrontPage) {
428
+ return "Home";
429
+ } else {
430
+ if (typeof gaeMapper.pageTitle !== "undefined") {
431
+ return gaeMapper.pageTitle;
432
+ }
433
+ }
434
+ return "";
435
+ }
436
+
437
  })(jQuery);
js/main.js CHANGED
@@ -1,3 +1,5 @@
 
 
1
  /*
2
  * Main GA Events Plugin function
3
  *
@@ -72,16 +74,18 @@ var gaeMapper = (function () {
72
  var scrollElementsFromDB = [];
73
 
74
  // NB these will be assigned meaningful names in backend eventually
75
- scroll_elements_from_options.forEach(function (el) {
76
- scrollElementsFromDB.push({
77
- "select": makeSelector(el),
78
- "category": el.category,
79
- "action": el.action,
80
- "label": el.label,
81
- "bounce": parseInt(el.non_interaction),
82
- "evalue": el.value // "value" in DB. Change in project?
 
 
83
  });
84
- });
85
 
86
  // Scrollelements from DB section ends
87
 
@@ -92,8 +96,15 @@ var gaeMapper = (function () {
92
  clickElementsFromDB: clickElementsFromDB,
93
  scrollElementsFromDB: scrollElementsFromDB,
94
  advancedMode: ga_options.advanced,
 
 
 
 
 
95
  link_clicks_delay: ga_options.link_clicks_delay,
96
  snippet_type: ga_options.snippet_type,
 
 
97
  scriptDebugMode: ga_options.script_debug_mode,
98
  }
99
 
@@ -132,6 +143,9 @@ gaEventsMain = (function ($) {
132
  $('body').on('click', el.selector, el.data, click_event);
133
  });
134
 
 
 
 
135
  // Bind scroll events stored in the DB to the window
136
  $(window).on('scroll', bindScrollEventsFromDB);
137
  }
@@ -164,7 +178,59 @@ gaEventsMain = (function ($) {
164
  }
165
  }
166
  }
167
- } // End of bindScrollEvents
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
  /*
170
  * The main function for tracking events
@@ -179,7 +245,6 @@ gaEventsMain = (function ($) {
179
  * @returns {undefined}
180
  */
181
  var track_event = function (category, action, label, bounce, evalue) {
182
-
183
  if (typeof ga_element === "undefined") {
184
  if (typeof ga !== 'undefined') {
185
  ga_element = ga;
@@ -205,36 +270,103 @@ gaEventsMain = (function ($) {
205
 
206
  var event_value = !evalue ? '' : evalue;
207
  var event_bounce = !bounce ? false : bounce;
208
-
209
- // Push data from event to relevant API
210
- if (gaeMapper.snippet_type == 'gtm' || ( typeof dataLayer !== 'undefined' && typeof gtag === "undefined" )) {
211
- dataLayer.push({
212
- 'event': 'WPGAE',
213
- 'eventCategory': category,
214
- 'eventAction': action,
215
- 'eventLabel': label,
216
- 'eventValue': event_value,
217
- 'nonInteraction': event_bounce
218
- });
 
 
 
 
 
 
 
 
 
 
219
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- // We might want to call the tracking APIs as well as pushing to the data layer
222
- // in which case this should be if rather than else if
223
- else if (gaeMapper.snippet_type == 'gst' || typeof gtag != 'undefined') {
224
- gtag('event', action, {
225
- // Event parameters
226
- 'event_category': category, 'event_label': label, 'value': event_value, 'non_interaction': event_bounce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  });
228
- } else if (gaeMapper.snippet_type == 'universal' || typeof ga != 'undefined' || (typeof __gaTracker === "function")) {
229
- if (event_value) {
230
- ga_element('send', 'event', category, action, label, event_value, {'nonInteraction': event_bounce});
231
- } else {
232
- ga_element('send', 'event', category, action, label, {'nonInteraction': event_bounce});
233
- }
234
- } else if (gaeMapper.snippet_type == 'legacy' || typeof _gaq != 'undefined') {
235
- ga_element.push(['_trackEvent', category, action, label, event_value, event_bounce]);
236
  }
237
- }; // End of track_event function
 
 
 
 
 
238
 
239
  /**
240
  * Click event function
@@ -245,47 +377,61 @@ gaEventsMain = (function ($) {
245
  var click_event = function (event) {
246
 
247
  track_event(event.data.category, event.data.action, event.data.label, event.data.bounce, event.data.evalue, this);
248
-
249
  if (typeof event.data.link_click_delay !== 'undefined' && event.data.link_click_delay > 0 && typeof event.target.href !== 'undefined' && event.target.nodeName == "A") {
250
- event.preventDefault();
251
- var openInNewTab = false;
252
- if (event.target.target) {
253
- if (event.target.target.trim() === "_blank") {
254
- openInNewTab = true;
255
- }
256
- }
257
- var w;
258
- if (openInNewTab) {
259
- w = window.open('', '_blank');
260
- }
261
 
262
- var hash = isJustHashLink(event);
263
- if (typeof hash !== "undefined" && hash !== "") {
264
- window.location.hash = hash;
265
- } else {
266
- setTimeout(function () {
267
- if (openInNewTab) {
268
- w.location.href = event.target.href;
269
- } else {
270
- window.location = event.target.href;
271
- }
272
- }, parseInt(gaeMapper.link_clicks_delay));
273
  }
274
- }
 
275
 
 
 
 
276
 
277
- }; // End of click event function
278
- var isJustHashLink = function ( event ) {
279
- var url = "";
280
- if ( event.target.tagName !== "A" ) {
281
- url = $( event.target ).parents( "a" ).attr( "href" );
282
- } else {
283
- url = $( event.target ).attr( "href" );
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
- if ( url.indexOf( "#" ) === 0 ) {
 
 
 
286
  return url;
287
  }
288
  return "";
289
  };
290
 
 
 
 
 
 
 
 
 
 
 
 
291
  })(jQuery);
1
+ // noinspection JSVoidFunctionReturnValueUsed
2
+
3
  /*
4
  * Main GA Events Plugin function
5
  *
74
  var scrollElementsFromDB = [];
75
 
76
  // NB these will be assigned meaningful names in backend eventually
77
+ if (typeof scroll_elements_from_options !== "undefined") {
78
+ scroll_elements_from_options.forEach(function (el) {
79
+ scrollElementsFromDB.push({
80
+ "select": makeSelector(el),
81
+ "category": el.category,
82
+ "action": el.action,
83
+ "label": el.label,
84
+ "bounce": parseInt(el.non_interaction),
85
+ "evalue": el.value // "value" in DB. Change in project?
86
+ });
87
  });
88
+ }
89
 
90
  // Scrollelements from DB section ends
91
 
96
  clickElementsFromDB: clickElementsFromDB,
97
  scrollElementsFromDB: scrollElementsFromDB,
98
  advancedMode: ga_options.advanced,
99
+ forceSnippet: ga_options.force_snippet,
100
+ emailLinksTracking: ga_options.email_link_tracking,
101
+ telLinksTracking: ga_options.tel_link_tracking,
102
+ downloadTracking: ga_options.download_tracking,
103
+ downloadTrackingFileTypes: ga_options.download_tracking_type,
104
  link_clicks_delay: ga_options.link_clicks_delay,
105
  snippet_type: ga_options.snippet_type,
106
+ isFrontPage: gaePlaceholders.is_front_page,
107
+ pageTitle: gaePlaceholders.page_title,
108
  scriptDebugMode: ga_options.script_debug_mode,
109
  }
110
 
143
  $('body').on('click', el.selector, el.data, click_event);
144
  });
145
 
146
+ bindDownloadTrackingEvents();
147
+ bindEmailLinksTracking();
148
+ bindTelLinksTracking();
149
  // Bind scroll events stored in the DB to the window
150
  $(window).on('scroll', bindScrollEventsFromDB);
151
  }
178
  }
179
  }
180
  }
181
+ }
182
+
183
+ /**
184
+ * Binds Download Tracking
185
+ *
186
+ * @returns {undefined}
187
+ */
188
+ function bindDownloadTrackingEvents() {
189
+ if (gaeMapper.downloadTracking === "1") {
190
+ gaeMapper.downloadTrackingFileTypes.forEach(function (ftype) {
191
+ var lowercase = ftype.toLowerCase();
192
+ var uppercase = ftype.toUpperCase();
193
+
194
+ $('body').on('click', 'a[href$=".' + lowercase + '"]', trackFileDownloaded);
195
+ $('body').on('click', 'a[href$=".' + uppercase + '"]', trackFileDownloaded);
196
+ });
197
+ }
198
+ } // End of bindScrollEvents
199
+
200
+ function bindEmailLinksTracking() {
201
+ if (gaeMapper.emailLinksTracking === "1") {
202
+ $('body').on('click', 'a[href^="mailto:"]', function (e) {
203
+ e.preventDefault();
204
+ var label = this.href.split(':').pop();
205
+ var action = "Email Link";
206
+ var category = getPageName();
207
+ track_event(category,action,label,false, "");
208
+ handleLinks(this, e);
209
+ });
210
+ }
211
+ }
212
+
213
+ function bindTelLinksTracking() {
214
+ if (gaeMapper.telLinksTracking === "1") {
215
+ $('body').on('click', 'a[href^="tel:"]', function (e) {
216
+ e.preventDefault();
217
+ var label = this.href.split(':').pop();
218
+ var action = "Telephone Number Link";
219
+ var category = getPageName();
220
+ track_event(category,action,label,false, "");
221
+ handleLinks(this, e);
222
+ });
223
+ }
224
+ }
225
+
226
+ var trackFileDownloaded = function (e) {
227
+ e.preventDefault();
228
+ var label = this.href.split('/').pop();
229
+ var action = "Download";
230
+ var category = getPageName();
231
+ track_event(category,action,label,false, "");
232
+ handleLinks(this, e);
233
+ };
234
 
235
  /*
236
  * The main function for tracking events
245
  * @returns {undefined}
246
  */
247
  var track_event = function (category, action, label, bounce, evalue) {
 
248
  if (typeof ga_element === "undefined") {
249
  if (typeof ga !== 'undefined') {
250
  ga_element = ga;
270
 
271
  var event_value = !evalue ? '' : evalue;
272
  var event_bounce = !bounce ? false : bounce;
273
+ switch (gaeMapper.forceSnippet) {
274
+ case "none":
275
+ if (useGlobalSiteTagSnippet()) {
276
+ globalSiteTagEvent(category, action, label, event_value, event_bounce);
277
+ } else if (useGoogleTagManagerSnippet()) {
278
+ googleTagManagerEvent(category, action, label, event_value, event_bounce);
279
+ } else if (useUniversalTrackingSnippet()) {
280
+ universalTrackingEvent(category, action, label, event_value, event_bounce);
281
+ } else if (useLegacySnippet()) {
282
+ legacyTrackingEvent(category, action, label, event_value, event_bounce);
283
+ }
284
+ break;
285
+ case "gtm":
286
+ googleTagManagerEvent(category, action, label, event_value, event_bounce);
287
+ break;
288
+ case "gst":
289
+ globalSiteTagEvent(category, action, label, event_value, event_bounce);
290
+ break;
291
+ case "universal":
292
+ universalTrackingEvent(category, action, label, event_value, event_bounce);
293
+ break;
294
  }
295
+ }; // End of track_event function
296
+
297
+ var useGoogleTagManagerSnippet = function () {
298
+ return (
299
+ gaeMapper.snippet_type === "gtm" ||
300
+ (typeof dataLayer !== "undefined" && typeof gtag === "undefined")
301
+ );
302
+ };
303
+
304
+ var useGlobalSiteTagSnippet = function () {
305
+ return gaeMapper.snippet_type === "gst" || typeof gtag !== "undefined";
306
+ };
307
+
308
+ var useUniversalTrackingSnippet = function () {
309
+ return (
310
+ gaeMapper.snippet_type === "universal" ||
311
+ typeof ga !== "undefined" ||
312
+ typeof __gaTracker === "function"
313
+ );
314
+ };
315
+
316
+ var useLegacySnippet = function () {
317
+ return gaeMapper.snippet_type === "legacy" || typeof _gaq !== "undefined";
318
+ };
319
+
320
+ // Use the Google Tag Manager object to send an event
321
+ var googleTagManagerEvent = function (
322
+ category,
323
+ action,
324
+ label,
325
+ value,
326
+ bounce
327
+ ) {
328
+ dataLayer.push({
329
+ event: "WPGAE",
330
+ eventCategory: category,
331
+ eventAction: action,
332
+ eventLabel: label,
333
+ eventValue: value,
334
+ nonInteraction: bounce,
335
+ });
336
+ };
337
 
338
+ var globalSiteTagEvent = function (category, action, label, value, bounce) {
339
+ gtag("event", action, {
340
+ // Event parameters
341
+ event_category: category,
342
+ event_label: label,
343
+ value: value,
344
+ non_interaction: bounce,
345
+ });
346
+ };
347
+
348
+ var universalTrackingEvent = function (
349
+ category,
350
+ action,
351
+ label,
352
+ value,
353
+ bounce
354
+ ) {
355
+ if (value) {
356
+ ga_element("send", "event", category, action, label, value, {
357
+ nonInteraction: bounce,
358
+ });
359
+ } else {
360
+ ga_element("send", "event", category, action, label, {
361
+ nonInteraction: bounce,
362
  });
 
 
 
 
 
 
 
 
363
  }
364
+ };
365
+
366
+ var legacyTrackingEvent = function (category, action, label, value, bounce) {
367
+ ga_element.push(["_trackEvent", category, action, label, value, bounce]);
368
+ };
369
+
370
 
371
  /**
372
  * Click event function
377
  var click_event = function (event) {
378
 
379
  track_event(event.data.category, event.data.action, event.data.label, event.data.bounce, event.data.evalue, this);
 
380
  if (typeof event.data.link_click_delay !== 'undefined' && event.data.link_click_delay > 0 && typeof event.target.href !== 'undefined' && event.target.nodeName == "A") {
381
+ handleLinks(this, event);
382
+ }
383
+ }; // End of click event function
 
 
 
 
 
 
 
 
384
 
385
+
386
+ var isNewTab = function (self) {
387
+ var target = $(self).attr("target")
388
+ if (typeof target !== "undefined" && target.trim() === "_blank") {
389
+ return true;
 
 
 
 
 
 
390
  }
391
+ return false;
392
+ }
393
 
394
+ var handleLinks = function (self, event) {
395
+ event.preventDefault();
396
+ var link = $(self).attr("href");
397
 
398
+
399
+ var w;
400
+ var openInNewTab = isNewTab(self)
401
+ if (openInNewTab) {
402
+ w = window.open('', '_blank');
403
+ }
404
+
405
+ var hash = isJustHashLink(link);
406
+ if (typeof hash !== "undefined" && hash !== "") {
407
+ window.location.hash = hash;
408
+ } else if (window.location.href !== link){
409
+ setTimeout(function () {
410
+ if (openInNewTab) {
411
+ w.location.href = link;
412
+ } else {
413
+ window.location = link;
414
+ }
415
+ }, parseInt(gaeMapper.link_clicks_delay), w);
416
  }
417
+ }
418
+
419
+ var isJustHashLink = function ( url ) {
420
+ if ( typeof url !== "undefined" && url.indexOf( "#" ) === 0 ) {
421
  return url;
422
  }
423
  return "";
424
  };
425
 
426
+ function getPageName () {
427
+ if ("1" === gaeMapper.isFrontPage) {
428
+ return "Home";
429
+ } else {
430
+ if (typeof gaeMapper.pageTitle !== "undefined") {
431
+ return gaeMapper.pageTitle;
432
+ }
433
+ }
434
+ return "";
435
+ }
436
+
437
  })(jQuery);
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === WP Google Analytics Events ===
2
  Contributors: yuvalo
3
  Tags: analytics, google, events, ga, google analytics, tracking
4
- Tested up to: 5.3
5
- Stable tag: 2.6.0
6
  License: GPLv2
7
  Requires at least: 3.0
8
 
@@ -47,7 +47,7 @@ Here are some of the things you can do with WP Google Analytics Events:
47
 
48
  ## Documentation
49
  * [What is event tracking?](https://wpflow.com/what-is-google-analytics-event-tracking/)
50
- * [Basic Configuration](https://wpflow.com/knowledgebase/basic-configuration/)
51
  * [How To Use WP Google Analytics Events Click Tracking Tab](https://wpflow.com/knowledgebase/use-wp-google-analytics-events-click-tracking-tab/)
52
  * [Scroll Tracking](https://wpflow.com/knowledgebase/scroll-tracking/)
53
  * [Google Tag Manager Support](https://wpflow.com/knowledgebase/google-tag-manager-support/)
@@ -106,6 +106,9 @@ If you are looking for more in-depth support, we encourage you to check out [WP
106
  2. Google Analytics real time events screenshot-4.png
107
 
108
  == Changelog ==
 
 
 
109
  = Version 2.6.0 =
110
  1. Complete plugin rewrite
111
  2. New user interface for click and scroll tracking settings
1
  === WP Google Analytics Events ===
2
  Contributors: yuvalo
3
  Tags: analytics, google, events, ga, google analytics, tracking
4
+ Tested up to: 5.7.2
5
+ Stable tag: 2.6.1
6
  License: GPLv2
7
  Requires at least: 3.0
8
 
47
 
48
  ## Documentation
49
  * [What is event tracking?](https://wpflow.com/what-is-google-analytics-event-tracking/)
50
+ * [Basic Configuration](https://wpflow.com/knowledgebase/basic-configuration/)
51
  * [How To Use WP Google Analytics Events Click Tracking Tab](https://wpflow.com/knowledgebase/use-wp-google-analytics-events-click-tracking-tab/)
52
  * [Scroll Tracking](https://wpflow.com/knowledgebase/scroll-tracking/)
53
  * [Google Tag Manager Support](https://wpflow.com/knowledgebase/google-tag-manager-support/)
106
  2. Google Analytics real time events screenshot-4.png
107
 
108
  == Changelog ==
109
+ = Version 2.6.1 =
110
+ 1. Added the force Google Analytics snippet option in the General Settings tab.
111
+ 2. Added tracking for email and download links.
112
  = Version 2.6.0 =
113
  1. Complete plugin rewrite
114
  2. New user interface for click and scroll tracking settings
templates/feedback-modal.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ?>
3
+ <div id="wpgae-modal-content">
4
+ <div id="wpgae-modal-cancel"><a href>Cancel</a></div>
5
+ <h2>Sorry to see you go. How can we do better?</h2>
6
+ <form id="wpgae-feedback-form" class="wpgae-feedback-modal">
7
+ <div>
8
+ <div>
9
+ <div class="inside">
10
+ <fieldset>
11
+ <div class="wpgae_event_form_fields">
12
+ <input name="feedback" value="I went with a different plugin" type="radio" />
13
+ <label for="feedback">I went with a different plugin.</label>
14
+ </div>
15
+ <div class="wpgae_event_form_fields">
16
+ <input name="feedback" value="No support for my use case" type="radio" />
17
+ <label for="feedback">No support for my use case.</label>
18
+ </div>
19
+ <div class="wpgae_event_form_fields">
20
+ <input name="feedback" value="I'm just doing maintenance work" type="radio" />
21
+ <label for="feedback">I'm just doing maintenance work</label>
22
+ </div>
23
+ <div class="wpgae_event_form_fields">
24
+ <input name="feedback" value="I couldn't get the plugin to work" type="radio" />
25
+ <label for="feedback">I couldn't get the plugin to work</label>
26
+ </div>
27
+ <div class="wpgae_event_form_fields">
28
+ <input name="feedback" value="I need your help with" type="radio" checked />
29
+ <label for="feedback">I need your help with:</label>
30
+ </div>
31
+ <div class="wpgae_event_form_fields">
32
+ <textarea name="helpme-text" rows="2" cols="40" style="margin-left: 22px; resize: none;"/></textarea>
33
+ </div>
34
+ </fieldset>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ <div id="wpgae_form_buttons">
39
+ <?php wp_nonce_field("wpflow_add_event", "ajax_nonce"); ?>
40
+ <input type="hidden" name="action" value="wpflow_deactivate_event">
41
+ <input type="submit" class="button button-large button-primary delete" value="Send Feedback and Deactivate">
42
+ <a id="wpgae-just-deactivate" class="button button-secondary button-large" href="#" rel="modal:close">Just Deactivate</a>
43
+ </div>
44
+ </form>
45
+ </div>
46
+
47
+
48
+ <style>
49
+ #wpgae-modal-cancel {
50
+ right: 15px;
51
+ position: absolute;
52
+ }
53
+ #wpgae_form_buttons {
54
+ margin-top: 20px;
55
+ }
56
+ #wpgae-feedback-form {
57
+ margin-left: 10px;
58
+ }
59
+
60
+ #wpgae-modal-content h2 {
61
+ margin-left: 10px;
62
+ }
63
+
64
+ #wpgae-modal-content {
65
+ background-color: white;
66
+ border-radius: 10px;
67
+ -webkit-border-radius: 10px;
68
+ -moz-border-radius: 10px;
69
+ box-shadow: 0 0 20px 0 #222;
70
+ -webkit-box-shadow: 0 0 20px 0 #222;
71
+ -moz-box-shadow: 0 0 20px 0 #222;
72
+ display: none;
73
+ height: 300px;
74
+ left: 50%;
75
+ margin: -120px 0 0 -160px;
76
+ padding: 10px;
77
+ position: fixed;
78
+ top: 40%;
79
+ width: 550px;
80
+ z-index: 1000;
81
+ line-height: 22px;
82
+ vertical-align: middle;
83
+ font-size: 14px;
84
+ }
85
+
86
+ #wpgae-modal-content.active {
87
+ display: block;
88
+ }​
89
+ </style>
90
+
91
+ <script>jQuery(function(){
92
+
93
+
94
+ });</script>