Crazy Egg - Version 1.1

Version Description

  • New domain added for tracking script.
Download this release

Release Info

Developer crazyegg
Plugin Icon 128x128 Crazy Egg
Version 1.1
Comparing to
See all releases

Version 1.1

Files changed (2) hide show
  1. crazyegg-heatmap-tracking.php +90 -0
  2. readme.txt +37 -0
crazyegg-heatmap-tracking.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Crazyegg-Heatmap-Tracking
4
+ Plugin URI: http://www.crazyegg.com/
5
+ Description: Enables Crazyegg.com heatmap tracking on your WordPress site.
6
+ Version: 1.1
7
+ Author: Crazyegg
8
+ Author URI: http://www.crazyegg.com
9
+ License: GPL
10
+ */
11
+
12
+ /* Puts code on Wordpress pages */
13
+ add_action('wp_footer', 'crazyegg_tracking_code');
14
+
15
+ /* Runs when plugin is activated */
16
+ register_activation_hook(__FILE__, 'cht_install');
17
+
18
+ /* Runs on plugin deactivation*/
19
+ register_deactivation_hook(__FILE__, 'cht_remove' );
20
+
21
+ if (is_admin()) {
22
+ /* Call the html code */
23
+ add_action('admin_menu', 'cht_admin_menu');
24
+
25
+ function cht_admin_menu() {
26
+ add_options_page('Crazyegg Heatmap Tracking', 'Crazyegg Heatmap Tracking', 'administrator', 'crazyegg-heatmap-tracking', 'cht_html_page');
27
+ }
28
+ }
29
+
30
+ function cht_install() {
31
+ /* Creates new database field */
32
+ add_option("cht_account_number", '', '', 'yes');
33
+ }
34
+
35
+ function cht_remove() {
36
+ /* Deletes the database field */
37
+ delete_option('cht_account_number');
38
+ }
39
+
40
+ function cht_html_page() {
41
+ ?>
42
+ <div class="wrap">
43
+ <div id="icon-plugins" class="icon32"></div>
44
+ <h2>Crazyegg Heatmap Tracking</h2>
45
+ <form method="POST" action="options.php">
46
+ <?php wp_nonce_field('update-options'); ?>
47
+ <table class="form-table">
48
+ <tr valign="top">
49
+ <th scope="row">
50
+ <label for="cht_account_number">Account Number</label>
51
+ </th>
52
+ <td>
53
+ <input id="cht_account_number" name="cht_account_number" value="<?php echo get_option('cht_account_number'); ?>" class="regular-text" />
54
+ <span class="description">(ex. 00111111)</span>
55
+ </td>
56
+ </tr>
57
+ </table>
58
+ <p style="width: 80%;">This is your numerical CrazyEgg account ID, it is 8 digits long. The easy way to find it is by logging in to your CrazyEgg account and clicking the "What's my code" link located at the top of your Dashboard.</p>
59
+ <p style="width: 80%;">Or it would be shown to you immediately after creating a Snapshot on your Dashboard.</p>
60
+ <p><a href="http://www.crazyegg.com" target="_blank">http://www.crazyegg.com</a></p>
61
+ <input type="hidden" name="action" value="update" />
62
+ <input type="hidden" name="page_options" value="cht_account_number" />
63
+ <p class="submit">
64
+ <input class="button-primary" type="submit" name="Save" value="<?php _e('Save'); ?>" />
65
+ </p>
66
+ </form>
67
+ </div>
68
+ <?php
69
+ }
70
+
71
+ function crazyegg_tracking_code() {
72
+ $account_number = get_option("cht_account_number");
73
+ if (!empty($account_number)) {
74
+
75
+ $account_path = str_pad($account_number, 8, "0", STR_PAD_LEFT);
76
+ $account_path = substr($account_path,0,4).'/'.substr($account_path,4,8);
77
+ $account_path = "pages/scripts/".$account_path.".js";
78
+
79
+ $script_host = "script.crazyegg.com";
80
+
81
+ echo '<script type="text/javascript">
82
+ setTimeout(function(){var a=document.createElement("script");
83
+ var b=document.getElementsByTagName(\'script\')[0];
84
+ a.src=document.location.protocol+"//'.$script_host.'/'.$account_path.'";
85
+ a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
86
+ </script>
87
+ ';
88
+ }
89
+ }
90
+ ?>
readme.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Crazyegg Heatmap Tracking ===
2
+ Contributors: crazyegg
3
+ Tags: crazyegg, traffic, tracking, clicktracking
4
+ Requires at least: 2.0.2
5
+ Tested up to: 4.6.1
6
+ Stable tag: 1.1
7
+
8
+ The official Crazyegg.com heatmap tracking plugin for Wordpress.
9
+
10
+ == Description ==
11
+
12
+ This plugin enables Crazyegg.com heatmap tracking on your WordPress site, with a limited amount of configuration.
13
+
14
+ == Installation ==
15
+
16
+ 1. Upload the `crazyegg-heatmap-tracking` directory into the `/wp-content/plugins/` directory on your server.
17
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
18
+ 3. Using the "WordPress *General* Settings" menu, navigate to Crazyegg Heatmap Tracking and enter your Crazyegg.com Account Number.
19
+
20
+ == Frequently Asked Questions ==
21
+
22
+ = Do I have to have Wordpress newer than 2.7? =
23
+
24
+ This plugin should be compatible with all older versions of WordPress up until plugins were first introduced.
25
+
26
+ == Changelog ==
27
+
28
+ = 1.1 =
29
+ * New domain added for tracking script.
30
+
31
+ = 1.0 =
32
+ * The first version of this plugin.
33
+
34
+ == Upgrade Notice ==
35
+
36
+ = 1.0 =
37
+ This is needed.