Hotjar - Version 1.0.0

Version Description

Download this release

Release Info

Developer hotjar
Plugin Icon wp plugin Hotjar
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

LICENSE ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Hotjar Plugin for WordPress
2
+ Copyright (C) 2019 Hotjar Ltd.
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
admin/static/hotjar-admin.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #business-info-wrap {
2
+ margin: 2rem;
3
+ }
4
+
5
+ #hotjar-form-area {
6
+ display: inline-block;
7
+ border: 1px solid #ccc;
8
+ padding: 0.5rem 1rem;
9
+ margin-top: 1.5rem;
10
+ }
11
+
12
+ .hotjar-logo {
13
+ display: block;
14
+ width: 80px;
15
+ margin-bottom: 1rem;
16
+ }
17
+
18
+ .hotjar-tagline {
19
+ display: block;
20
+ width: 350px;
21
+ margin-left: -9px;
22
+ }
admin/static/hotjar_logo_2x.png ADDED
Binary file
admin/static/tagline_2x.png ADDED
Binary file
admin/views/settings.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // No direct access to this file
4
+ defined( 'ABSPATH' ) or die();
5
+
6
+ ?>
7
+
8
+ <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
9
+
10
+ <?php if ( get_option('hotjar_site_id') == '' ): ?>
11
+ <div id="message" class="notice notice-warning is-dismissible">
12
+ <p><strong><?php echo sprintf( __('Hotjar script is disabled.') ); ?></strong></p>
13
+ </div>
14
+ <?php else: ?>
15
+ <div id="message" class="notice notice-success is-dismissible">
16
+ <p><strong><?php echo sprintf( __('Hotjar script installed for Site ID ' . get_option('hotjar_site_id') . '. <a href="%s" target="_blank">Click here to verify your install</a>.'), get_site_url() . '?hjVerifyInstall=' . get_option('hotjar_site_id') ); ?></strong></p>
17
+ </div>
18
+ <?php endif; ?>
19
+
20
+ <?php endif; ?>
21
+
22
+
23
+ <div id="business-info-wrap" class="wrap">
24
+
25
+ <div class="wp-header">
26
+ <img src="<?php echo plugins_url( '../static/hotjar_logo_2x.png', __FILE__ ); ?>" alt="Hotjar" class="hotjar-logo">
27
+ <img src="<?php echo plugins_url( '../static/tagline_2x.png', __FILE__ ); ?>" alt="<?php echo __('The fast & visual way to understand your users.'); ?>" class="hotjar-tagline">
28
+ </div>
29
+
30
+
31
+
32
+ <form method="post" action="options.php">
33
+ <?php settings_fields( 'hotjar' );
34
+ do_settings_sections('hotjar'); ?>
35
+
36
+ <div id="hotjar-form-area">
37
+ <p><?php
38
+ $url = 'https://insights.hotjar.com/site/list';
39
+ $link = sprintf( wp_kses( __( 'Visit your <a href="%s" target="_blank">Hotjar site list</a> to find your unique Hotjar ID.', 'wp-hotjar' ), array( 'a' => array( 'href' => array(), 'target' => '_blank' ) ) ), esc_url( $url ) );
40
+ echo $link;
41
+ ?></p>
42
+ <p><?php echo sprintf( __('Input your Hotjar ID into the field below to connect your Hotjar and WordPress accounts.')); ?></p>
43
+
44
+ <table class="form-table">
45
+ <tbody>
46
+ <tr>
47
+ <th scope="row">
48
+ <label for="hotjar_site_id"><?php esc_html_e( 'Hotjar ID', 'hotjar' ); ?></label>
49
+ </th>
50
+
51
+ <td>
52
+ <input type="number" name="hotjar_site_id" id="hotjar_site_id" value="<?php echo esc_attr( get_option('hotjar_site_id') ); ?>" />
53
+ <p class="description" id="wp_hotjar_site_id_description"><?php esc_html_e( '(Leave blank to disable)', 'hotjar' ); ?></p>
54
+ </td>
55
+ </tr>
56
+ </tbody>
57
+
58
+ </table>
59
+ </div>
60
+
61
+ <?php submit_button(); ?>
62
+
63
+ </form>
64
+ </div>
hotjar.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Hotjar
4
+ * Description: The fast & visual way to understand your users.
5
+ * Author: Hotjar
6
+ * Author URI: https://www.hotjar.com/
7
+ * Version: 1.0.0
8
+ * License: GPLv3
9
+ * License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
+ * Text Domain: hotjar
11
+ *
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit;
16
+ }
17
+
18
+
19
+ add_action( 'plugins_loaded', 'hotjar_plugin_init' );
20
+
21
+ function hotjar_plugin_init() {
22
+
23
+ if ( ! class_exists( 'WP_Hotjar' ) ) :
24
+
25
+ class WP_Hotjar {
26
+ /**
27
+ * @var Const Plugin Version Number
28
+ */
29
+ const VERSION = '1.0.0';
30
+
31
+ /**
32
+ * @var Singleton The reference the *Singleton* instance of this class
33
+ */
34
+ private static $instance;
35
+
36
+ /**
37
+ * Returns the *Singleton* instance of this class.
38
+ *
39
+ * @return Singleton The *Singleton* instance.
40
+ */
41
+ public static function get_instance() {
42
+ if ( null === self::$instance ) {
43
+ self::$instance = new self();
44
+ }
45
+ return self::$instance;
46
+ }
47
+
48
+ private function __clone() {}
49
+
50
+ private function __wakeup() {}
51
+
52
+ /**
53
+ * Protected constructor to prevent creating a new instance of the
54
+ * *Singleton* via the `new` operator from outside of this class.
55
+ */
56
+ private function __construct() {
57
+ add_action( 'admin_init', array( $this, 'install' ) );
58
+ $this->init();
59
+ }
60
+
61
+ /**
62
+ * Init the plugin after plugins_loaded so environment variables are set.
63
+ *
64
+ * @since 1.0.0
65
+ */
66
+ public function init() {
67
+ require_once( dirname( __FILE__ ) . '/includes/class-hotjar.php' );
68
+ $hotjar = new Hotjar();
69
+ $hotjar->init();
70
+ }
71
+
72
+ /**
73
+ * Updates the plugin version in db
74
+ *
75
+ * @since 1.0.0
76
+ */
77
+ public function update_plugin_version() {
78
+ delete_option( 'hotjar_version' );
79
+ update_option( 'hotjar_version', self::VERSION );
80
+ }
81
+
82
+ /**
83
+ * Handles upgrade routines.
84
+ *
85
+ * @since 1.0.0
86
+ */
87
+ public function install() {
88
+ if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) {
89
+ return;
90
+ }
91
+
92
+ if ( ( self::VERSION !== get_option( 'hotjar_version' ) ) ) {
93
+
94
+ $this->update_plugin_version();
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Adds plugin action links.
100
+ *
101
+ * @since 1.0.0
102
+ */
103
+ public function plugin_action_links( $links ) {
104
+ $plugin_links = array(
105
+ '<a href="admin.php?page=hotjar-settings">Settings</a>',
106
+ '<a href="https://www.hotjar.com/">Support</a>',
107
+ );
108
+ return array_merge( $plugin_links, $links );
109
+ }
110
+ }
111
+
112
+ WP_Hotjar::get_instance();
113
+ endif;
114
+ }
includes/class-hotjar.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ class Hotjar {
7
+
8
+ public function __construct()
9
+ {
10
+
11
+ }
12
+
13
+ public function init()
14
+ {
15
+ $this->init_admin();
16
+ $this->enqueue_script();
17
+ $this->enqueue_admin_styles();
18
+ }
19
+
20
+ public function init_admin() {
21
+ register_setting( 'hotjar', 'hotjar_site_id' );
22
+ add_action( 'admin_menu', array( $this, 'create_nav_page' ) );
23
+ }
24
+
25
+ public function create_nav_page() {
26
+ add_options_page(
27
+ esc_html__( 'Hotjar', 'hotjar' ),
28
+ esc_html__( 'Hotjar', 'hotjar' ),
29
+ 'manage_options',
30
+ 'hotjar_settings',
31
+ array($this,'admin_view')
32
+ );
33
+ }
34
+
35
+ public static function admin_view()
36
+ {
37
+ require_once plugin_dir_path( __FILE__ ) . '/../admin/views/settings.php';
38
+ }
39
+
40
+ public static function hotjar_script()
41
+ {
42
+ $hotjar_site_id = get_option( 'hotjar_site_id' );
43
+ $is_admin = is_admin();
44
+
45
+ $hotjar_site_id = trim($hotjar_site_id);
46
+ if (!$hotjar_site_id) {
47
+ return;
48
+ }
49
+
50
+ if ( $is_admin ) {
51
+ return;
52
+ }
53
+
54
+ echo "
55
+ <script>
56
+ (function(h,o,t,j,a,r){
57
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
58
+ h._hjSettings={hjid:" . $hotjar_site_id . ",hjsv:5};
59
+ a=o.getElementsByTagName('head')[0];
60
+ r=o.createElement('script');r.async=1;
61
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
62
+ a.appendChild(r);
63
+ })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
64
+ </script>
65
+ ";
66
+ }
67
+
68
+ private function enqueue_script() {
69
+ add_action( 'wp_head', array($this, 'hotjar_script') );
70
+ }
71
+
72
+ private function enqueue_admin_styles() {
73
+ add_action( 'admin_enqueue_scripts', array($this, 'hotjar_admin_styles' ) );
74
+ }
75
+
76
+ public static function hotjar_admin_styles() {
77
+ wp_register_style( 'hotjar_custom_admin_style', plugins_url( '../admin/static/hotjar-admin.css', __FILE__ ), array(), '20190701', 'all' );
78
+ wp_enqueue_style( 'hotjar_custom_admin_style' );
79
+ }
80
+
81
+ }
82
+
83
+ ?>
readme.txt ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Hotjar ===
2
+ Contributors: hotjar
3
+ Tags: hotjar,insights,visual,heatmaps,recordings,funnels,analytics
4
+ Requires at least: 3.0.1
5
+ Tested up to: 5.0.0
6
+ Stable tag: 1.0.0
7
+ License: GPLv3
8
+ License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
9
+
10
+ The fast & visual way to understand your users.
11
+
12
+ == Description ==
13
+
14
+ Hotjar is the fast & visual way to understand your users, providing everything your team needs to uncover insights
15
+ and make the right changes to your site. Connect all the dots with one powerful solution providing:
16
+
17
+ * **Heatmaps** - Understand what users want, care about and do on your site by visually representing their clicks, taps and scrolling behavior – which are the strongest indicators of visitor motivation and desire.
18
+ * **Visitor Recordings** - Eliminate guesswork with Recordings of real visitor behavior on your site. By seeing your visitor’s clicks, taps and mouse movements you can identify usability issues on the fly and issues they encounter.
19
+ * **Conversion Funnels** - Find the biggest opportunities for improvement and testing by identifying on which page and at which step most visitors are leaving your site.
20
+ * **Form Analysis** - Improve online form completion rates by discovering which fields take too long to fill, which are left blank, and why your visitors abandon your form and page.
21
+ * **Feedback Polls** - Improving the performance and experience of your website starts with understanding what your visitors want and what's preventing them from achieving it. Target questions to specific visitors anywhere on your web and mobile site.
22
+ * **Incoming Feedback** - Give your visitors an easy way to leave instant visual feedback on your website or app. See what people love and hate, identify issues, and find opportunities for growth.
23
+ * **Surveys** - Build your own responsive surveys using an easy editor. Collect responses in real-time from any device. Distribute your surveys using web links, emails or invite your visitors just before they abandon your site to uncover their objections or concerns.
24
+ * **Recruit Test Users** - Recruit the best possible participants for user research and testing directly from your site. Collect profiling information, contact details and offer a gift in exchange for their help.
25
+
26
+ This plugin provides a simple installation of Hotjar on your WordPress site, giving you immediate access to all
27
+ Hotjar features.
28
+
29
+ == Installation ==
30
+
31
+ The Hotjar plugin is available to install via the WordPress plugin library. You can install it directly from within
32
+ your WordPress dashboard. Alternatively, you can install manually -
33
+
34
+ 1. Download the Hotjar plugin as a zip file.
35
+ 1. Upload the folder `hotjar` to the `/wp-content/plugins/` directory
36
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
37
+
38
+ After installation, configure the plugin by visiting Settings -> Hotjar and entering your unique Hotjar Site ID.
39
+ You can find your Site ID from [the Sites & Organisations list](https://insights.hotjar.com/site/list) in Insights.
40
+
41
+ == Frequently Asked Questions ==
42
+
43
+ = Do I need a Hotjar account to use this plugin? =
44
+
45
+ Yes. You can [sign up for a free Hotjar account](https://insights.hotjar.com/register) which provides access
46
+ to all our features including heatmaps, recordings and feedback tools.
47
+
48
+ = I've set up Hotjar, what now? =
49
+
50
+ You can enable, disable and enable all the Hotjar features from within the [Insights app](https://insights.hotjar.com).
51
+ Any changes will be reflected immediately on the site(s) where you have the Hotjar script installed.
52
+
53
+ For more information on getting started with Hotjar [visit our help center](https://help.hotjar.com/hc/en-us).
54
+
55
+ = Where can I find out more about Hotjar? =
56
+
57
+ [Visit our website](https://www.hotjar.com/) to learn more about Hotjar and how you can use it to
58
+ start gaining insights into how users use your site.
59
+
60
+ = What are the Hotjar Terms of Service? =
61
+
62
+ The full [terms of service are available here](https://www.hotjar.com/legal/policies/terms-of-service) together with
63
+ other legal and privacy documentation. If you have further questions do not hesitate to reach our to our
64
+ support.
65
+
66
+ = Is Hotjar GDPR compliant? =
67
+
68
+ Yes. We have built Hotjar to provide [privacy by design](https://www.hotjar.com/privacy/gdpr-compliance) and are fully
69
+ compliant with the GDPR. See our
70
+ [GDPR documentation](https://www.hotjar.com/legal/compliance/gdpr-commitment) for more information.
71
+
72
+ = Can my users opt-out? =
73
+
74
+ Yes. Hotjar respects the Do Not Track header and users can also opt-out on a per-browser basis by
75
+ visiting [Hotjar opt out](https://www.hotjar.com/legal/compliance/opt-out).
76
+
77
+ = How do I remove Hotjar from my site? =
78
+
79
+ You can uninstall this plugin at any time to remove Hotjar from your site. Data which has been collected can be
80
+ removed through the Insights interface, or by deleting your site or account. For more information see our
81
+ [data retention documentation.](https://help.hotjar.com/hc/en-us/articles/115011640427-Data-Retention).
82
+
83
+ == Screenshots ==
84
+
85
+ 1. The settings interface. Add your unique Hotjar Site ID to the empty field, and Save Changes to install the Hotjar
86
+ script for that site.
87
+ 2. After saving you will see this success message. Click the link to verify your installation was successful.
88
+ 3. Success! If you see this message Hotjar is installed on your site. Visit [Insights](https://insights.hotjar.com) to
89
+ configure the Hotjar tools on your site.
90
+
91
+ == Changelog ==
92
+
93
+ = 1.0 =
94
+ * Initial release.
95
+