Version Description
New Admin Menu added.
=
Download this release
Release Info
Developer | crazyegg |
Plugin | Crazy Egg |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 2.0
- crazyegg-heatmap-tracking.php +68 -69
- images/icon.png +0 -0
- readme.txt +17 -24
- views/options.php +19 -0
crazyegg-heatmap-tracking.php
CHANGED
@@ -1,90 +1,89 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name:
|
4 |
-
Plugin URI: http://www.crazyegg.com
|
5 |
-
Description:
|
6 |
-
Version:
|
7 |
-
Author:
|
8 |
Author URI: http://www.crazyegg.com
|
9 |
License: GPL
|
10 |
*/
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
function
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
-
}
|
29 |
|
30 |
-
function
|
31 |
-
|
32 |
-
|
33 |
-
}
|
34 |
|
35 |
-
function
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
|
40 |
-
function
|
41 |
-
|
42 |
-
|
43 |
-
|
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
|
72 |
-
|
73 |
-
if (!empty($account_number)) {
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
78 |
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
|
86 |
-
</script>
|
87 |
-
';
|
88 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Crazy Egg
|
4 |
+
Plugin URI: http://www.crazyegg.com
|
5 |
+
Description: The easiest way to add the Crazy Egg tracking script to your WordPress blog!
|
6 |
+
Version: 2.0
|
7 |
+
Author: Crazy Egg
|
8 |
Author URI: http://www.crazyegg.com
|
9 |
License: GPL
|
10 |
*/
|
11 |
|
12 |
+
class CrazyEgg {
|
13 |
+
var $longName = 'Crazy Egg for WordPress Options';
|
14 |
+
var $shortName = 'Crazy Egg';
|
15 |
+
var $uniqueID = 'crazyegg-heatmap-tracking';
|
16 |
|
17 |
+
function __construct() {
|
18 |
+
register_deactivation_hook(__FILE__, array( $this, 'delete_option' ) );
|
19 |
+
add_action( 'wp_head', array( $this, 'add_script' ) );
|
20 |
+
if ( is_admin() ) {
|
21 |
+
add_action( 'admin_menu', array( $this, 'admin_menu_page' ) );
|
22 |
+
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
23 |
+
add_filter( 'plugin_action_links_'.plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
|
24 |
+
add_action( 'wp_loaded', array( $this, 'migration_check' ) );
|
25 |
+
}
|
26 |
+
}
|
27 |
|
28 |
+
public function delete_option() {
|
29 |
+
delete_option('crazy_egg_tracking_script');
|
30 |
+
}
|
31 |
|
32 |
+
public function add_script() {
|
33 |
+
echo get_option('crazy_egg_tracking_script');
|
34 |
+
}
|
35 |
|
36 |
+
public function admin_menu_page() {
|
37 |
+
add_menu_page(
|
38 |
+
$this->longName,
|
39 |
+
$this->shortName,
|
40 |
+
'administrator',
|
41 |
+
$this->uniqueID,
|
42 |
+
array( $this, 'admin_options'),
|
43 |
+
plugins_url('images/icon.png', __FILE__)
|
44 |
+
);
|
45 |
}
|
|
|
46 |
|
47 |
+
public function register_settings() {
|
48 |
+
register_setting( 'crazy-egg-options', 'crazy_egg_tracking_script' );
|
49 |
+
}
|
|
|
50 |
|
51 |
+
public function admin_options() {
|
52 |
+
include 'views/options.php';
|
53 |
+
}
|
|
|
54 |
|
55 |
+
public function add_settings_link( $links ) {
|
56 |
+
$settings_link = array( '<a href="admin.php?page=crazyegg-heatmap-tracking">Settings'.'</a>' );
|
57 |
+
return array_merge( $links, $settings_link );
|
58 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
public function migration_check() {
|
61 |
+
$accountNumber = get_option("cht_account_number");
|
|
|
62 |
|
63 |
+
if ($accountNumber) {
|
64 |
+
$accountPath = str_pad($accountNumber, 8, "0", STR_PAD_LEFT);
|
65 |
+
$accountPath = substr($accountPath,0,4).'/'.substr($accountPath,4,8);
|
66 |
+
$accountPath = "pages/scripts/".$accountPath.".js";
|
67 |
+
$scriptHost = "script.crazyegg.com";
|
68 |
|
69 |
+
$migrationScript = '<script type="text/javascript">
|
70 |
+
setTimeout(function(){var a=document.createElement("script");
|
71 |
+
var b=document.getElementsByTagName(\'script\')[0];
|
72 |
+
a.src=document.location.protocol+"//'.$scriptHost.'/'.$accountPath.'";
|
73 |
+
a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
|
74 |
+
</script>
|
75 |
+
';
|
76 |
|
77 |
+
update_option('crazy_egg_tracking_script', $migrationScript);
|
78 |
+
delete_option('cht_account_number');
|
79 |
+
}
|
80 |
+
}
|
|
|
|
|
|
|
81 |
}
|
82 |
+
|
83 |
+
add_action( 'init', 'CrazyEggForWordPress' );
|
84 |
+
function CrazyEggForWordPress() {
|
85 |
+
global $CrazyEggForWordPress;
|
86 |
+
|
87 |
+
$CrazyEggForWordPress = new CrazyEgg();
|
88 |
}
|
89 |
?>
|
images/icon.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -1,37 +1,30 @@
|
|
1 |
-
===
|
2 |
Contributors: crazyegg
|
3 |
-
Tags: crazyegg,
|
4 |
-
Requires at least: 2.
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.1
|
7 |
|
8 |
-
The
|
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 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
== Frequently Asked Questions ==
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
This plugin should be compatible with all older versions of WordPress up until plugins were first introduced.
|
25 |
|
26 |
== Changelog ==
|
27 |
-
|
28 |
-
|
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.
|
1 |
+
=== Crazy Egg ===
|
2 |
Contributors: crazyegg
|
3 |
+
Tags: analytics, click, crazyegg, crazy egg, heat maps, heatmap, heatmaps, marketing, reports, tracking, traffic, visitor recordings
|
4 |
+
Requires at least: 2.7
|
5 |
+
Tested up to: 4.7.2
|
|
|
6 |
|
7 |
+
The easiest, free way to add your Crazy Egg tracking script to your WordPress site. The official Crazy Egg Plugin for WordPress.
|
8 |
|
9 |
== Description ==
|
10 |
+
Crazy Egg is a free plugin that allows you to painlessly add Crazy Egg's tracking script to your WordPress site. The tracking script lets Crazy Egg track your visitors.
|
|
|
11 |
|
12 |
== Installation ==
|
13 |
+
1. Install Crazy Egg through the [WordPress.org](https://www.wordpress.org) plugin repository or by [uploading the files to your server](http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/).
|
14 |
+
2. [Sign])https://app.crazyegg.com/login) into your Crazy Egg account and copy your [tracking script](https://app.crazyegg.com/instructions).
|
15 |
+
3. Click the Crazy Egg tab in the left admin menu.
|
16 |
+
4. Paste your tracking script in the provided field and click Save Changes.
|
17 |
|
18 |
== Frequently Asked Questions ==
|
19 |
+
= Do I need a Crazy Egg account? =
|
20 |
+
Yes, a Crazy Egg account is needed. You can sign up for a free trial at [crazyegg.com](https://www.crazyegg.com).
|
21 |
|
22 |
+
== Screenshots ==
|
23 |
+
1. Quick, simple and easy way of installing Crazy Egg on your WordPress site.
|
|
|
24 |
|
25 |
== Changelog ==
|
26 |
+
= 2.0 =
|
27 |
+
New Admin Menu added.
|
|
|
|
|
|
|
|
|
28 |
|
29 |
== Upgrade Notice ==
|
30 |
+
Note: This upgrade will require that you copy and paste your tracking script into the provided field. Your WordPress site will not track if this step is skipped.
|
|
|
|
views/options.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h1>Crazy Egg for WordPress</h1>
|
3 |
+
<p>Grab your Crazy Egg tracking script <a href="https://app.crazyegg.com/instructions" target="_blank">here</a>, and paste it below.</p>
|
4 |
+
<form action="options.php" method="post">
|
5 |
+
<?php
|
6 |
+
settings_fields( 'crazy-egg-options' );
|
7 |
+
do_settings_sections( 'crazy-egg' );
|
8 |
+
?>
|
9 |
+
<table class="form-table">
|
10 |
+
<tr valign="top">
|
11 |
+
<th>Your Tracking Script:</th>
|
12 |
+
<td>
|
13 |
+
<textarea name="crazy_egg_tracking_script" rows="8" cols="80"><?php echo esc_attr( get_option('crazy_egg_tracking_script') ); ?></textarea>
|
14 |
+
</td>
|
15 |
+
</tr>
|
16 |
+
</table>
|
17 |
+
<?php submit_button(); ?>
|
18 |
+
</form>
|
19 |
+
</div>
|