-
Notifications
You must be signed in to change notification settings - Fork 2
/
email_tracking.php
34 lines (27 loc) · 988 Bytes
/
email_tracking.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* PHP wrapper for the email tracking Javascript, suitable for use in
* WordPress.
*
* Created by Guido W. Pettinari on 09.11.2016.
* Part of WordPress Analytics:
* https://github.com/coccoinomane/wordpress_analytics
*/
function wpan_email_tracking () {
/* Extract the email tracking options from the database */
$options = wpan_get_options ();
$ga_tracker = isset ( $options ['tracker_name'] ) ? $options ['tracker_name'] : '';
$debug = isset ( $options['debug'] ) ? $options['debug'] : '';
/* Script path & url */
$script_path = WPAN_PLUGIN_DIR . 'js/email_tracking.js';
$script_url = WPAN_PLUGIN_URL . 'js/email_tracking.js';
$script_versioned = $script_url . '?ver=' . filemtime($script_path);
/* Load the script */
echo "<script src='$script_versioned' "
. "gaTracker='$ga_tracker' "
. "debug='$debug' "
. "defer='defer'"
. "> "
. "</script>\n";
}
?>