WhatsApp me - Version 1.4.3

Version Description

  • NEW support for Google Analytics Global Site Tag (gtag.js).
  • CHANGE events label now is the destination URL to match general behavior.
  • UPDATED International Telephone Input library
Download this release

Release Info

Developer creapuntome
Plugin Icon 128x128 WhatsApp me
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.4.2 to 1.4.3

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: whatsapp, button, chat, support, contact
5
Requires at least: 3.0.1
6
Tested up to: 4.9.4
7
Requires PHP: 5.3
8
- Stable tag: 1.4.2
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -45,6 +45,10 @@ You can change the position of the button so that nothing covers it by adding th
45
`.whatsappme { z-index:9999; }`
46
Greater values of z-index are left over, the default value is 400.
47
48
== Screenshots ==
49
50
1. WhatsApp me settings.
@@ -54,6 +58,11 @@ Greater values of z-index are left over, the default value is 400.
54
55
== Changelog ==
56
57
= 1.4.2 =
58
* FIX JavaScript error introduced on v1.4.1.
59
5
Requires at least: 3.0.1
6
Tested up to: 4.9.4
7
Requires PHP: 5.3
8
+ Stable tag: 1.4.3
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
45
`.whatsappme { z-index:9999; }`
46
Greater values of z-index are left over, the default value is 400.
47
48
+ = What about GDPR? =
49
+
50
+ WhatsApp me don't save any personal data and don't use cookies.
51
+
52
== Screenshots ==
53
54
1. WhatsApp me settings.
58
59
== Changelog ==
60
61
+ = 1.4.3 =
62
+ * NEW support for Google Analytics Global Site Tag (gtag.js).
63
+ * CHANGE events label now is the destination URL to match general behavior.
64
+ * UPDATED International Telephone Input library
65
+
66
= 1.4.2 =
67
* FIX JavaScript error introduced on v1.4.1.
68
admin/class-whatsappme-admin.php CHANGED
@@ -53,13 +53,13 @@ class WhatsAppMe_Admin {
53
* Initialize the class and set its properties.
54
*
55
* @since 1.0.0
56
- * @param string $plugin_name The name of this plugin.
57
- * @param string $version The version of this plugin.
58
*/
59
public function __construct( $plugin_name, $version ) {
60
61
- $this->plugin_name = $plugin_name;
62
- $this->version = $version;
63
$this->enhanced_phone = true;
64
$this->get_settings();
65
@@ -100,7 +100,7 @@ class WhatsAppMe_Admin {
100
public function enqueue_styles($hook) {
101
102
if ( 'settings_page_whatsappme' == $hook && $this->enhanced_phone ) {
103
- wp_enqueue_style( 'intl-tel-input', 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.9/css/intlTelInput.css', array(), null, 'all' );
104
}
105
106
}
@@ -113,7 +113,7 @@ class WhatsAppMe_Admin {
113
public function enqueue_scripts($hook) {
114
115
if ( 'settings_page_whatsappme' == $hook && $this->enhanced_phone ) {
116
- wp_enqueue_script( 'intl-tel-input', 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.9/js/intlTelInput.min.js', array( 'jquery' ), null, true );
117
wp_enqueue_script( 'whatsappme-admin', plugin_dir_url( __FILE__ ) . 'js/whatsappme.js', array( 'intl-tel-input' ), $this->version, true );
118
}
119
53
* Initialize the class and set its properties.
54
*
55
* @since 1.0.0
56
+ * @param string $plugin_name The name of this plugin.
57
+ * @param string $version The version of this plugin.
58
*/
59
public function __construct( $plugin_name, $version ) {
60
61
+ $this->plugin_name = $plugin_name;
62
+ $this->version = $version;
63
$this->enhanced_phone = true;
64
$this->get_settings();
65
100
public function enqueue_styles($hook) {
101
102
if ( 'settings_page_whatsappme' == $hook && $this->enhanced_phone ) {
103
+ wp_enqueue_style( 'intl-tel-input', 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.15/css/intlTelInput.css', array(), null, 'all' );
104
}
105
106
}
113
public function enqueue_scripts($hook) {
114
115
if ( 'settings_page_whatsappme' == $hook && $this->enhanced_phone ) {
116
+ wp_enqueue_script( 'intl-tel-input', 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.15/js/intlTelInput.min.js', array( 'jquery' ), null, true );
117
wp_enqueue_script( 'whatsappme-admin', plugin_dir_url( __FILE__ ) . 'js/whatsappme.js', array( 'intl-tel-input' ), $this->version, true );
118
}
119
public/js/whatsappme.js CHANGED
@@ -7,7 +7,7 @@
7
var wame_settings = $whatsappme.data('settings');
8
9
// In some strange cases data settings are empty
10
- if (typeof(wame_settings) == 'undefined') {
11
try {
12
wame_settings = JSON.parse($whatsappme.attr('data-settings'));
13
} catch (error) {
@@ -52,20 +52,30 @@
52
}
53
54
$('.whatsappme__button').click(function () {
55
$whatsappme.removeClass('whatsappme--dialog');
56
localStorage.whatsappme_click = 'yes';
57
58
- // Send Google Analytics event
59
- if (typeof (ga) !== 'undefined') {
60
ga('send', 'event', {
61
- eventCategory: 'WhatsAppMe',
62
- eventAction: 'click',
63
- eventLabel: window.location.toString(),
64
- transport: 'beacon'
65
});
66
}
67
68
- whatsapp_open(wame_settings.telephone, wame_settings.message_send);
69
});
70
71
$('.whatsappme__close').click(function () {
@@ -74,14 +84,14 @@
74
});
75
}
76
77
- // Open WhatsApp link with optional message
78
- function whatsapp_open(phone, message) {
79
var link = 'https://api.whatsapp.com/send?phone=' + phone;
80
if (typeof (message) == 'string' && message != '') {
81
link += '&text=' + encodeURIComponent(message);
82
}
83
84
- window.open(link, 'whatsappme');
85
}
86
87
});
7
var wame_settings = $whatsappme.data('settings');
8
9
// In some strange cases data settings are empty
10
+ if (typeof (wame_settings) == 'undefined') {
11
try {
12
wame_settings = JSON.parse($whatsappme.attr('data-settings'));
13
} catch (error) {
52
}
53
54
$('.whatsappme__button').click(function () {
55
+ var link = whatsapp_link(wame_settings.telephone, wame_settings.message_send);
56
+
57
$whatsappme.removeClass('whatsappme--dialog');
58
localStorage.whatsappme_click = 'yes';
59
60
+ if (typeof gtag == 'function') {
61
+ // Send event (Global Site Tag - gtag.js)
62
+ gtag('event', 'click', {
63
+ 'event_category': 'WhatsAppMe',
64
+ 'event_label': link,
65
+ 'transport_type': 'beacon'
66
+ });
67
+ } else if (typeof ga == 'function') {
68
+ // Send event (Universal Analtics - analytics.js)
69
ga('send', 'event', {
70
+ 'eventCategory': 'WhatsAppMe',
71
+ 'eventAction': 'click',
72
+ 'eventLabel': link,
73
+ 'transport': 'beacon'
74
});
75
}
76
77
+ // Open WhatsApp link
78
+ window.open(link, 'whatsappme');
79
});
80
81
$('.whatsappme__close').click(function () {
84
});
85
}
86
87
+ // Return WhatsApp link with optional message
88
+ function whatsapp_link(phone, message) {
89
var link = 'https://api.whatsapp.com/send?phone=' + phone;
90
if (typeof (message) == 'string' && message != '') {
91
link += '&text=' + encodeURIComponent(message);
92
}
93
94
+ return link;
95
}
96
97
});
whatsappme.php CHANGED
@@ -9,7 +9,7 @@
9
* Plugin Name: WhatsApp me
10
* Plugin URI: https://crea.me/productos/whatsapp-me/
11
* Description: Add support to your clients directly with WhatsApp.
12
- * Version: 1.4.2
13
* Author: Creame
14
* Author URI: https://crea.me
15
* License: GPL-2.0+
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
* Currently plugin version.
28
* Start at version 1.0.0 and use SemVer - https://semver.org
29
*/
30
- define( 'WHATSAPPME_VERSION', '1.4.2' );
31
32
/**
33
* The core plugin class that is used to define internationalization,
9
* Plugin Name: WhatsApp me
10
* Plugin URI: https://crea.me/productos/whatsapp-me/
11
* Description: Add support to your clients directly with WhatsApp.
12
+ * Version: 1.4.3
13
* Author: Creame
14
* Author URI: https://crea.me
15
* License: GPL-2.0+
27
* Currently plugin version.
28
* Start at version 1.0.0 and use SemVer - https://semver.org
29
*/
30
+ define( 'WHATSAPPME_VERSION', '1.4.3' );
31
32
/**
33
* The core plugin class that is used to define internationalization,