Version Description
- ! BACKWARD INCOMPATIBLE CHANGE ! - Names of Tag Manager click events has been changed to comply with naming conventions:
- ContactFormSubmitted -> gtm4wp.contactForm7Submitted
- DownloadClick -> gtm4wp.downloadClick
- EmailClick -> gtm4wp.emailClick
- OutboundClick -> gtm4wp.outboundClick
- AddProductToCart -> gtm4wp.addProductToCart
- Updated: click events are now disabled by default to reflect recently released Tag Manager auto events. I do not plan to remove this functionality. You can decide which solution you would like to use :-)
- Updated: language template (pot) file and Hungarian translation
- Added: new form move events to track how visitors interact with your (comment, contact, etc.) forms
- Added: event names to admin options page so that you know what events to use in Google Tag Manager
- Added: Google Tag Manager icon to admin settings page
- Added: Settings link to admin plugins page
- Fixed: null value in visitorType dataLayer variable if no logged in user exists (now 'visitor-logged-out')
Download this release
Release Info
Developer | duracelltomi |
Plugin | DuracellTomi's Google Tag Manager for WordPress |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.2
- admin/admin.php +27 -5
- admin/images/tag_manager-32.png +0 -0
- admin/images/tag_manager-64.png +0 -0
- common/readoptions.php +5 -3
- duracelltomi-google-tag-manager-for-wordpress.php +5 -4
- js/admin-tabcreator.js +1 -1
- js/gtm4wp-contact-form-7-tracker.js +1 -1
- js/gtm4wp-download-tracker.js +2 -2
- js/gtm4wp-email-link-tracker.js +2 -2
- js/gtm4wp-form-move-tracker.js +50 -0
- js/gtm4wp-outbound-click-tracker.js +3 -3
- js/gtm4wp-woocommerce-tracker.js +2 -2
- languages/en.pot +15 -3
- languages/gtm4wp-lang-hu_HU.mo +0 -0
- languages/gtm4wp-lang-hu_HU.po +32 -7
- public/frontend.php +5 -1
- readme.txt +27 -6
admin/admin.php
CHANGED
@@ -58,11 +58,11 @@ $GLOBALS["gtm4wp_includefieldtexts"] = array(
|
|
58 |
|
59 |
$GLOBALS["gtm4wp_eventfieldtexts"] = array(
|
60 |
GTM4WP_OPTION_EVENTS_OUTBOUND => array(
|
61 |
-
"label" => __( "Outbound link click events", GTM4WP_TEXTDOMAIN ),
|
62 |
"description" => __( "Check this option to include a Tag Manager event when a visitor clicks on a link directing the visitor out of your website.", GTM4WP_TEXTDOMAIN )
|
63 |
),
|
64 |
GTM4WP_OPTION_EVENTS_DOWNLOADS => array(
|
65 |
-
"label" => __( "Download click events", GTM4WP_TEXTDOMAIN ),
|
66 |
"description" => __( "Check this option to include a Tag Manager event when a visitors clicks on a link that leads to a downloadable file on your website.", GTM4WP_TEXTDOMAIN )
|
67 |
),
|
68 |
GTM4WP_OPTION_EVENTS_DWLEXT => array(
|
@@ -70,9 +70,13 @@ $GLOBALS["gtm4wp_eventfieldtexts"] = array(
|
|
70 |
"description" => __( "Enter a comma separated list of extensions to track when 'Include download click events' option is set.", GTM4WP_TEXTDOMAIN )
|
71 |
),
|
72 |
GTM4WP_OPTION_EVENTS_EMAILCLICKS => array(
|
73 |
-
"label" => __( "Email click events", GTM4WP_TEXTDOMAIN ),
|
74 |
"description" => __( "Check this option to include a Tag Manager event when a visitor clicks on an email link.", GTM4WP_TEXTDOMAIN )
|
75 |
),
|
|
|
|
|
|
|
|
|
76 |
);
|
77 |
|
78 |
$GLOBALS["gtm4wp_integratefieldtexts"] = array(
|
@@ -106,6 +110,9 @@ function gtm4wp_admin_output_section( $args ) {
|
|
106 |
|
107 |
case GTM4WP_ADMIN_GROUP_EVENTS: {
|
108 |
_e( "Fire tags in Google Tag Manager on special events on your website", GTM4WP_TEXTDOMAIN );
|
|
|
|
|
|
|
109 |
|
110 |
break;
|
111 |
}
|
@@ -348,7 +355,7 @@ function gtm4wp_admin_init() {
|
|
348 |
array(
|
349 |
"label_for" => GTM4WP_ADMIN_GROUP_INFO,
|
350 |
"description" => '<strong>Thomas Geiger</strong><br />
|
351 |
-
Website: <a href="http://www.duracelltomi.com/
|
352 |
<a href="https://www.linkedin.com/in/duracelltomi" target="_blank">Me on LinkedIn</a><br />
|
353 |
<a href="http://www.linkedin.com/company/jabjab-online-marketing-ltd-" target="_blank">JabJab Online Marketing on LinkedIn</a>'
|
354 |
)
|
@@ -357,9 +364,10 @@ function gtm4wp_admin_init() {
|
|
357 |
}
|
358 |
|
359 |
function gtm4wp_show_admin_page() {
|
|
|
360 |
?>
|
361 |
<div class="wrap">
|
362 |
-
<div id="icon
|
363 |
<h2><?php _e( 'Google Tag Manager for WordPress options', GTM4WP_TEXTDOMAIN ); ?></h2>
|
364 |
<form action="options.php" method="post">
|
365 |
<?php settings_fields( GTM4WP_ADMIN_GROUP ); ?>
|
@@ -438,8 +446,22 @@ function gtm4wp_show_warning() {
|
|
438 |
|
439 |
}
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
add_action( 'admin_init', 'gtm4wp_admin_init' );
|
442 |
add_action( 'admin_menu', 'gtm4wp_add_admin_page' );
|
443 |
add_action( 'admin_enqueue_scripts', 'gtm4wp_add_admin_js' );
|
444 |
add_action( 'admin_notices', 'gtm4wp_show_warning' );
|
445 |
add_action( 'admin_head', 'gtm4wp_admin_head' );
|
|
58 |
|
59 |
$GLOBALS["gtm4wp_eventfieldtexts"] = array(
|
60 |
GTM4WP_OPTION_EVENTS_OUTBOUND => array(
|
61 |
+
"label" => __( "Outbound link click events (gtm4wp.outboundClick)", GTM4WP_TEXTDOMAIN ),
|
62 |
"description" => __( "Check this option to include a Tag Manager event when a visitor clicks on a link directing the visitor out of your website.", GTM4WP_TEXTDOMAIN )
|
63 |
),
|
64 |
GTM4WP_OPTION_EVENTS_DOWNLOADS => array(
|
65 |
+
"label" => __( "Download click events (gtm4wp.downloadClick)", GTM4WP_TEXTDOMAIN ),
|
66 |
"description" => __( "Check this option to include a Tag Manager event when a visitors clicks on a link that leads to a downloadable file on your website.", GTM4WP_TEXTDOMAIN )
|
67 |
),
|
68 |
GTM4WP_OPTION_EVENTS_DWLEXT => array(
|
70 |
"description" => __( "Enter a comma separated list of extensions to track when 'Include download click events' option is set.", GTM4WP_TEXTDOMAIN )
|
71 |
),
|
72 |
GTM4WP_OPTION_EVENTS_EMAILCLICKS => array(
|
73 |
+
"label" => __( "Email click events (gtm4wp.emailClick)", GTM4WP_TEXTDOMAIN ),
|
74 |
"description" => __( "Check this option to include a Tag Manager event when a visitor clicks on an email link.", GTM4WP_TEXTDOMAIN )
|
75 |
),
|
76 |
+
GTM4WP_OPTION_EVENTS_FORMMOVE => array(
|
77 |
+
"label" => __( "Form fill events (gtm4wp.formElementEnter & gtm4wp.formElementLeave)", GTM4WP_TEXTDOMAIN ),
|
78 |
+
"description" => __( "Check this option to include a Tag Manager event when a visitor moves between elements of a form (comment, contact, etc).", GTM4WP_TEXTDOMAIN )
|
79 |
+
)
|
80 |
);
|
81 |
|
82 |
$GLOBALS["gtm4wp_integratefieldtexts"] = array(
|
110 |
|
111 |
case GTM4WP_ADMIN_GROUP_EVENTS: {
|
112 |
_e( "Fire tags in Google Tag Manager on special events on your website", GTM4WP_TEXTDOMAIN );
|
113 |
+
echo '<p style="font-weight: bold;">';
|
114 |
+
_e( 'In October 2013 Google released a new feature called <a href="https://support.google.com/tagmanager/answer/3415369?hl=en" target="_blank">auto event tracking</a>. It is up to you how you use click events either using Google\'s solution or the settings below.', GTM4WP_TEXTDOMAIN );
|
115 |
+
echo '</p>';
|
116 |
|
117 |
break;
|
118 |
}
|
355 |
array(
|
356 |
"label_for" => GTM4WP_ADMIN_GROUP_INFO,
|
357 |
"description" => '<strong>Thomas Geiger</strong><br />
|
358 |
+
Website: <a href="http://www.duracelltomi.com/" target="_blank">duracelltomi.com</a><br />
|
359 |
<a href="https://www.linkedin.com/in/duracelltomi" target="_blank">Me on LinkedIn</a><br />
|
360 |
<a href="http://www.linkedin.com/company/jabjab-online-marketing-ltd-" target="_blank">JabJab Online Marketing on LinkedIn</a>'
|
361 |
)
|
364 |
}
|
365 |
|
366 |
function gtm4wp_show_admin_page() {
|
367 |
+
global $gtp4wp_plugin_url;
|
368 |
?>
|
369 |
<div class="wrap">
|
370 |
+
<div id="gtm4wp-icon" class="icon32" style="background-image: url(<?php echo $gtp4wp_plugin_url; ?>admin/images/tag_manager-32.png);"><br /></div>
|
371 |
<h2><?php _e( 'Google Tag Manager for WordPress options', GTM4WP_TEXTDOMAIN ); ?></h2>
|
372 |
<form action="options.php" method="post">
|
373 |
<?php settings_fields( GTM4WP_ADMIN_GROUP ); ?>
|
446 |
|
447 |
}
|
448 |
|
449 |
+
function gtm4wp_add_plugin_action_links( $links, $file ) {
|
450 |
+
global $gtp4wp_plugin_basename;
|
451 |
+
|
452 |
+
if ( $file != $gtp4wp_plugin_basename )
|
453 |
+
return $links;
|
454 |
+
|
455 |
+
$settings_link = '<a href="' . menu_page_url( GTM4WP_ADMINSLUG, false ) . '">' . esc_html( __( 'Settings' ) ) . '</a>';
|
456 |
+
|
457 |
+
array_unshift( $links, $settings_link );
|
458 |
+
|
459 |
+
return $links;
|
460 |
+
}
|
461 |
+
|
462 |
add_action( 'admin_init', 'gtm4wp_admin_init' );
|
463 |
add_action( 'admin_menu', 'gtm4wp_add_admin_page' );
|
464 |
add_action( 'admin_enqueue_scripts', 'gtm4wp_add_admin_js' );
|
465 |
add_action( 'admin_notices', 'gtm4wp_show_warning' );
|
466 |
add_action( 'admin_head', 'gtm4wp_admin_head' );
|
467 |
+
add_filter( 'plugin_action_links', 'gtm4wp_add_plugin_action_links', 10, 2 );
|
admin/images/tag_manager-32.png
ADDED
Binary file
|
admin/images/tag_manager-64.png
ADDED
Binary file
|
common/readoptions.php
CHANGED
@@ -18,6 +18,7 @@ define( 'GTM4WP_OPTION_EVENTS_OUTBOUND', 'event-outbound' );
|
|
18 |
define( 'GTM4WP_OPTION_EVENTS_DOWNLOADS', 'event-downloads' );
|
19 |
define( 'GTM4WP_OPTION_EVENTS_DWLEXT', 'event-download-extensions' );
|
20 |
define( 'GTM4WP_OPTION_EVENTS_EMAILCLICKS', 'event-email-clicks' );
|
|
|
21 |
|
22 |
define( 'GTM4WP_OPTION_INTEGRATE_WPCF7', 'integrate-wpcf7' );
|
23 |
define( 'GTM4WP_OPTION_INTEGRATE_WOOCOMMERCE', 'integrate-woocommerce' );
|
@@ -40,10 +41,11 @@ $gtm4wp_defaultoptions = array(
|
|
40 |
GTM4WP_OPTION_INCLUDE_POSTTITLE => false,
|
41 |
GTM4WP_OPTION_INCLUDE_SEARCHDATA => false,
|
42 |
|
43 |
-
GTM4WP_OPTION_EVENTS_OUTBOUND =>
|
44 |
-
GTM4WP_OPTION_EVENTS_DOWNLOADS =>
|
45 |
GTM4WP_OPTION_EVENTS_DWLEXT => "pdf,doc,docx,xls,xlsx,ppt,pptx,zip,rar,gz,tar",
|
46 |
-
GTM4WP_OPTION_EVENTS_EMAILCLICKS =>
|
|
|
47 |
|
48 |
GTM4WP_OPTION_INTEGRATE_WPCF7 => true,
|
49 |
GTM4WP_OPTION_INTEGRATE_WOOCOMMERCE => false,
|
18 |
define( 'GTM4WP_OPTION_EVENTS_DOWNLOADS', 'event-downloads' );
|
19 |
define( 'GTM4WP_OPTION_EVENTS_DWLEXT', 'event-download-extensions' );
|
20 |
define( 'GTM4WP_OPTION_EVENTS_EMAILCLICKS', 'event-email-clicks' );
|
21 |
+
define( 'GTM4WP_OPTION_EVENTS_FORMMOVE', 'event-form-move' );
|
22 |
|
23 |
define( 'GTM4WP_OPTION_INTEGRATE_WPCF7', 'integrate-wpcf7' );
|
24 |
define( 'GTM4WP_OPTION_INTEGRATE_WOOCOMMERCE', 'integrate-woocommerce' );
|
41 |
GTM4WP_OPTION_INCLUDE_POSTTITLE => false,
|
42 |
GTM4WP_OPTION_INCLUDE_SEARCHDATA => false,
|
43 |
|
44 |
+
GTM4WP_OPTION_EVENTS_OUTBOUND => false,
|
45 |
+
GTM4WP_OPTION_EVENTS_DOWNLOADS => false,
|
46 |
GTM4WP_OPTION_EVENTS_DWLEXT => "pdf,doc,docx,xls,xlsx,ppt,pptx,zip,rar,gz,tar",
|
47 |
+
GTM4WP_OPTION_EVENTS_EMAILCLICKS => false,
|
48 |
+
GTM4WP_OPTION_EVENTS_FORMMOVE => true,
|
49 |
|
50 |
GTM4WP_OPTION_INTEGRATE_WPCF7 => true,
|
51 |
GTM4WP_OPTION_INTEGRATE_WOOCOMMERCE => false,
|
duracelltomi-google-tag-manager-for-wordpress.php
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: DuracellTomi's Google Tag Manager for Wordpress
|
4 |
-
Version: 0.
|
5 |
-
Plugin URI: http://www.duracelltomi.com/google-tag-manager-for-wordpress
|
6 |
Description: The first Google Tag Manager plugin for WordPress with business goals in mind
|
7 |
Author: Thomas Geiger
|
8 |
Author URI: http://www.duracelltomi.com/
|
9 |
*/
|
10 |
|
11 |
-
define( 'GTM4WP_VERSION', '0.
|
12 |
define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
|
13 |
define( 'GTM4WP_TEXTDOMAIN', 'gtm4wp-lang' );
|
14 |
|
15 |
-
$gtp4wp_plugin_url
|
|
|
16 |
require_once( GTM4WP_PATH."/common/readoptions.php" );
|
17 |
|
18 |
function gtm4wp_init() {
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: DuracellTomi's Google Tag Manager for Wordpress
|
4 |
+
Version: 0.2
|
5 |
+
Plugin URI: http://www.duracelltomi.com/google-tag-manager-for-wordpress/
|
6 |
Description: The first Google Tag Manager plugin for WordPress with business goals in mind
|
7 |
Author: Thomas Geiger
|
8 |
Author URI: http://www.duracelltomi.com/
|
9 |
*/
|
10 |
|
11 |
+
define( 'GTM4WP_VERSION', '0.2' );
|
12 |
define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
|
13 |
define( 'GTM4WP_TEXTDOMAIN', 'gtm4wp-lang' );
|
14 |
|
15 |
+
$gtp4wp_plugin_url = plugin_dir_url( __FILE__ );
|
16 |
+
$gtp4wp_plugin_basename = plugin_basename( __FILE__ );
|
17 |
require_once( GTM4WP_PATH."/common/readoptions.php" );
|
18 |
|
19 |
function gtm4wp_init() {
|
js/admin-tabcreator.js
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
.prepend('<h2 class="nav-tab-wrapper">' + admintabs.join('') + '</h2>');
|
13 |
|
14 |
jQuery(".nav-tab-wrapper a")
|
15 |
-
.
|
16 |
jQuery(".nav-tab-wrapper a.nav-tab-active")
|
17 |
.removeClass("nav-tab-active");
|
18 |
|
12 |
.prepend('<h2 class="nav-tab-wrapper">' + admintabs.join('') + '</h2>');
|
13 |
|
14 |
jQuery(".nav-tab-wrapper a")
|
15 |
+
.on("click", function() {
|
16 |
jQuery(".nav-tab-wrapper a.nav-tab-active")
|
17 |
.removeClass("nav-tab-active");
|
18 |
|
js/gtm4wp-contact-form-7-tracker.js
CHANGED
@@ -2,7 +2,7 @@ jQuery( function() {
|
|
2 |
jQuery( ".wpcf7" )
|
3 |
.on( 'mailsent.wpcf7', function(){
|
4 |
window[ gtm4wp_datalayer_name ].push({
|
5 |
-
'event': '
|
6 |
});
|
7 |
});
|
8 |
});
|
2 |
jQuery( ".wpcf7" )
|
3 |
.on( 'mailsent.wpcf7', function(){
|
4 |
window[ gtm4wp_datalayer_name ].push({
|
5 |
+
'event': 'gtm4wp.contactForm7Submitted'
|
6 |
});
|
7 |
});
|
8 |
});
|
js/gtm4wp-download-tracker.js
CHANGED
@@ -3,9 +3,9 @@ function track_downloads(track_extensions) {
|
|
3 |
|
4 |
for ( var i = 0; i < gtm4wp_extensions_to_track.length; i++ ) {
|
5 |
jQuery( "a[href$=\\." + gtm4wp_extensions_to_track[i].toLowerCase() + "], a[href$=\\." + gtm4wp_extensions_to_track[i].toUpperCase() + "]" )
|
6 |
-
.
|
7 |
window[ gtm4wp_datalayer_name ].push({
|
8 |
-
'event': '
|
9 |
'linkhref': jQuery( this ).attr( "href" )
|
10 |
});
|
11 |
})
|
3 |
|
4 |
for ( var i = 0; i < gtm4wp_extensions_to_track.length; i++ ) {
|
5 |
jQuery( "a[href$=\\." + gtm4wp_extensions_to_track[i].toLowerCase() + "], a[href$=\\." + gtm4wp_extensions_to_track[i].toUpperCase() + "]" )
|
6 |
+
.on( "click", function() {
|
7 |
window[ gtm4wp_datalayer_name ].push({
|
8 |
+
'event': 'gtm4wp.downloadClick',
|
9 |
'linkhref': jQuery( this ).attr( "href" )
|
10 |
});
|
11 |
})
|
js/gtm4wp-email-link-tracker.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
jQuery( function() {
|
2 |
jQuery( "a[href^=mailto]" )
|
3 |
-
.
|
4 |
var gtm4wp_linkparts = jQuery( this ).attr( "href" ).split( ":" );
|
5 |
|
6 |
window[ gtm4wp_datalayer_name ].push({
|
7 |
-
'event': '
|
8 |
'linkhref': gtm4wp_linkparts
|
9 |
});
|
10 |
})
|
1 |
jQuery( function() {
|
2 |
jQuery( "a[href^=mailto]" )
|
3 |
+
.on( "click", function() {
|
4 |
var gtm4wp_linkparts = jQuery( this ).attr( "href" ).split( ":" );
|
5 |
|
6 |
window[ gtm4wp_datalayer_name ].push({
|
7 |
+
'event': 'gtm4wp.emailClick',
|
8 |
'linkhref': gtm4wp_linkparts
|
9 |
});
|
10 |
})
|
js/gtm4wp-form-move-tracker.js
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( function() {
|
2 |
+
jQuery( ":input" )
|
3 |
+
.on( "focus", function() {
|
4 |
+
var input = jQuery(this);
|
5 |
+
var inputID = input.attr("id") || "(no input ID)";
|
6 |
+
var inputName = input.attr("name") || "(no input name)";
|
7 |
+
var inputClass = input.attr("class") || "(no input class)";
|
8 |
+
|
9 |
+
var form = jQuery(this.form);
|
10 |
+
var formID = form.attr("id") || "(no form ID)";
|
11 |
+
var formName = form.attr("name") || "(no form name)";
|
12 |
+
var formClass = form.attr("class") || "(no form class)";
|
13 |
+
|
14 |
+
window[ gtm4wp_datalayer_name ].push({
|
15 |
+
'event' : 'gtm4wp.formElementEnter',
|
16 |
+
|
17 |
+
'inputID' : inputID,
|
18 |
+
'inputName' : inputName,
|
19 |
+
'inputClass': inputClass,
|
20 |
+
|
21 |
+
'formID' : formID,
|
22 |
+
'formName' : formName,
|
23 |
+
'formClass': formClass
|
24 |
+
});
|
25 |
+
})
|
26 |
+
|
27 |
+
.on( "blur", function() {
|
28 |
+
var input = jQuery(this);
|
29 |
+
var inputID = input.attr("id") || "(no input ID)";
|
30 |
+
var inputName = input.attr("name") || "(no input name)";
|
31 |
+
var inputClass = input.attr("class") || "(no input class)";
|
32 |
+
|
33 |
+
var form = jQuery(this.form);
|
34 |
+
var formID = form.attr("id") || "(no form ID)";
|
35 |
+
var formName = form.attr("name") || "(no form name)";
|
36 |
+
var formClass = form.attr("class") || "(no form class)";
|
37 |
+
|
38 |
+
window[ gtm4wp_datalayer_name ].push({
|
39 |
+
'event' : 'gtm4wp.formElementLeave',
|
40 |
+
|
41 |
+
'inputID' : inputID,
|
42 |
+
'inputName' : inputName,
|
43 |
+
'inputClass': inputClass,
|
44 |
+
|
45 |
+
'formID' : formID,
|
46 |
+
'formName' : formName,
|
47 |
+
'formClass': formClass
|
48 |
+
});
|
49 |
+
});
|
50 |
+
});
|
js/gtm4wp-outbound-click-tracker.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
jQuery( function() {
|
2 |
-
|
3 |
|
4 |
jQuery( "a[href^=http]" )
|
5 |
.each( function() {
|
@@ -7,9 +7,9 @@ jQuery( function() {
|
|
7 |
|
8 |
if ( gtm4wp_linkhref.indexOf( gtm4wp_localdomain ) == -1 ) {
|
9 |
jQuery( this )
|
10 |
-
.
|
11 |
window[ gtm4wp_datalayer_name ].push({
|
12 |
-
'event': '
|
13 |
'linkhref': jQuery( this ).attr( "href" )
|
14 |
});
|
15 |
})
|
1 |
jQuery( function() {
|
2 |
+
var gtm4wp_localdomain = window.location.hostname.replace( "www.", "" );
|
3 |
|
4 |
jQuery( "a[href^=http]" )
|
5 |
.each( function() {
|
7 |
|
8 |
if ( gtm4wp_linkhref.indexOf( gtm4wp_localdomain ) == -1 ) {
|
9 |
jQuery( this )
|
10 |
+
.on( "click", function() {
|
11 |
window[ gtm4wp_datalayer_name ].push({
|
12 |
+
'event': 'gtm4wp.outboundClick',
|
13 |
'linkhref': jQuery( this ).attr( "href" )
|
14 |
});
|
15 |
})
|
js/gtm4wp-woocommerce-tracker.js
CHANGED
@@ -2,13 +2,13 @@ jQuery( function() {
|
|
2 |
jQuery( "body" )
|
3 |
.on( "added_to_cart", function() {
|
4 |
window[ gtm4wp_datalayer_name ].push({
|
5 |
-
'event': '
|
6 |
});
|
7 |
});
|
8 |
|
9 |
if ( window.location.search.indexOf( "added-to-cart" ) > -1 ) {
|
10 |
window[ gtm4wp_datalayer_name ].push({
|
11 |
-
'event': '
|
12 |
});
|
13 |
}
|
14 |
});
|
2 |
jQuery( "body" )
|
3 |
.on( "added_to_cart", function() {
|
4 |
window[ gtm4wp_datalayer_name ].push({
|
5 |
+
'event': 'gtm4wp.addProductToCart'
|
6 |
});
|
7 |
});
|
8 |
|
9 |
if ( window.location.search.indexOf( "added-to-cart" ) > -1 ) {
|
10 |
window[ gtm4wp_datalayer_name ].push({
|
11 |
+
'event': 'gtm4wp.addProductToCart'
|
12 |
});
|
13 |
}
|
14 |
});
|
languages/en.pot
CHANGED
@@ -111,7 +111,7 @@ msgid ""
|
|
111 |
msgstr ""
|
112 |
|
113 |
#: ../admin/admin.php:61
|
114 |
-
msgid "Outbound link click events"
|
115 |
msgstr ""
|
116 |
|
117 |
#: ../admin/admin.php:62
|
@@ -121,7 +121,7 @@ msgid ""
|
|
121 |
msgstr ""
|
122 |
|
123 |
#: ../admin/admin.php:65
|
124 |
-
msgid "Download click events"
|
125 |
msgstr ""
|
126 |
|
127 |
#: ../admin/admin.php:66
|
@@ -141,7 +141,7 @@ msgid ""
|
|
141 |
msgstr ""
|
142 |
|
143 |
#: ../admin/admin.php:73
|
144 |
-
msgid "Email click events"
|
145 |
msgstr ""
|
146 |
|
147 |
#: ../admin/admin.php:74
|
@@ -317,3 +317,15 @@ msgstr ""
|
|
317 |
#: ../integration/woocommerce.php:48
|
318 |
msgid "SKU:"
|
319 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
msgstr ""
|
112 |
|
113 |
#: ../admin/admin.php:61
|
114 |
+
msgid "Outbound link click events (gtm4wp.outboundClick)"
|
115 |
msgstr ""
|
116 |
|
117 |
#: ../admin/admin.php:62
|
121 |
msgstr ""
|
122 |
|
123 |
#: ../admin/admin.php:65
|
124 |
+
msgid "Download click events (gtm4wp.downloadClick)"
|
125 |
msgstr ""
|
126 |
|
127 |
#: ../admin/admin.php:66
|
141 |
msgstr ""
|
142 |
|
143 |
#: ../admin/admin.php:73
|
144 |
+
msgid "Email click events (gtm4wp.emailClick)"
|
145 |
msgstr ""
|
146 |
|
147 |
#: ../admin/admin.php:74
|
317 |
#: ../integration/woocommerce.php:48
|
318 |
msgid "SKU:"
|
319 |
msgstr ""
|
320 |
+
|
321 |
+
#: ../admin/admin.php:77
|
322 |
+
msgid "Form fill events (gtm4wp.formElementEnter & gtm4wp.formElementLeave)"
|
323 |
+
msgstr ""
|
324 |
+
|
325 |
+
#: ../admin/admin.php:78
|
326 |
+
msgid "Check this option to include a Tag Manager event when a visitor moves between elements of a form (comment, contact, etc)."
|
327 |
+
msgstr ""
|
328 |
+
|
329 |
+
|
330 |
+
msgid "In October 2013 Google released a new feature called <a href=\"https://support.google.com/tagmanager/answer/3415369?hl=en\" target=\"_blank\">auto event tracking</a>. It is up to you how you use click events either using Google's solution or the settings below."
|
331 |
+
msgstr ""
|
languages/gtm4wp-lang-hu_HU.mo
CHANGED
Binary file
|
languages/gtm4wp-lang-hu_HU.po
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Google Tag Manager for WordPress\n"
|
4 |
"POT-Creation-Date: 2013-09-19 11:27+0100\n"
|
5 |
-
"PO-Revision-Date: 2013-
|
6 |
"Last-Translator: Thomas Geiger <duracelltomi@gmail.com>\n"
|
7 |
"Language-Team: JabJab Online Marketing\n"
|
8 |
"Language: English\n"
|
@@ -132,8 +132,8 @@ msgstr ""
|
|
132 |
"kifejezést, a keresés hivatkozó oldalát és a találatok számát."
|
133 |
|
134 |
#: ../admin/admin.php:61
|
135 |
-
msgid "Outbound link click events"
|
136 |
-
msgstr "Esemény kimenő hivatkozásokra kattintáshoz"
|
137 |
|
138 |
#: ../admin/admin.php:62
|
139 |
msgid ""
|
@@ -145,8 +145,8 @@ msgstr ""
|
|
145 |
"egy másik oldalra."
|
146 |
|
147 |
#: ../admin/admin.php:65
|
148 |
-
msgid "Download click events"
|
149 |
-
msgstr "Esemény letöltés kattintásokhoz"
|
150 |
|
151 |
#: ../admin/admin.php:66
|
152 |
msgid ""
|
@@ -170,8 +170,8 @@ msgstr ""
|
|
170 |
"kiterjesztéseket kell követni a letöltések kezelése során."
|
171 |
|
172 |
#: ../admin/admin.php:73
|
173 |
-
msgid "Email click events"
|
174 |
-
msgstr "Esemény email link kattintásokhoz"
|
175 |
|
176 |
#: ../admin/admin.php:74
|
177 |
msgid ""
|
@@ -382,3 +382,28 @@ msgstr ""
|
|
382 |
#: ../integration/woocommerce.php:48
|
383 |
msgid "SKU:"
|
384 |
msgstr "Cikkszám:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Google Tag Manager for WordPress\n"
|
4 |
"POT-Creation-Date: 2013-09-19 11:27+0100\n"
|
5 |
+
"PO-Revision-Date: 2013-10-13 12:53+0100\n"
|
6 |
"Last-Translator: Thomas Geiger <duracelltomi@gmail.com>\n"
|
7 |
"Language-Team: JabJab Online Marketing\n"
|
8 |
"Language: English\n"
|
132 |
"kifejezést, a keresés hivatkozó oldalát és a találatok számát."
|
133 |
|
134 |
#: ../admin/admin.php:61
|
135 |
+
msgid "Outbound link click events (gtm4wp.outboundClick)"
|
136 |
+
msgstr "Esemény kimenő hivatkozásokra kattintáshoz (gtm4wp.outboundClick)"
|
137 |
|
138 |
#: ../admin/admin.php:62
|
139 |
msgid ""
|
145 |
"egy másik oldalra."
|
146 |
|
147 |
#: ../admin/admin.php:65
|
148 |
+
msgid "Download click events (gtm4wp.downloadClick)"
|
149 |
+
msgstr "Esemény letöltés kattintásokhoz (gtm4wp.downloadClick)"
|
150 |
|
151 |
#: ../admin/admin.php:66
|
152 |
msgid ""
|
170 |
"kiterjesztéseket kell követni a letöltések kezelése során."
|
171 |
|
172 |
#: ../admin/admin.php:73
|
173 |
+
msgid "Email click events (gtm4wp.emailClick)"
|
174 |
+
msgstr "Esemény email link kattintásokhoz (gtm4wp.emailClick)"
|
175 |
|
176 |
#: ../admin/admin.php:74
|
177 |
msgid ""
|
382 |
#: ../integration/woocommerce.php:48
|
383 |
msgid "SKU:"
|
384 |
msgstr "Cikkszám:"
|
385 |
+
|
386 |
+
#: ../admin/admin.php:77
|
387 |
+
msgid "Form fill events (gtm4wp.formElementEnter & gtm4wp.formElementLeave)"
|
388 |
+
msgstr ""
|
389 |
+
"Form kitöltés események (gtm4wp.formElementEnter & gtm4wp.formElementLeave)"
|
390 |
+
|
391 |
+
#: ../admin/admin.php:78
|
392 |
+
msgid ""
|
393 |
+
"Check this option to include a Tag Manager event when a visitor moves "
|
394 |
+
"between elements of a form (comment, contact, etc)."
|
395 |
+
msgstr ""
|
396 |
+
"Kapcsolja be ezt a beállítást, ha szeretne Tag Manager eseményt kiváltani, "
|
397 |
+
"amikor egy látogató egy űrlap elemei között mozog (hozzászólás, kapcsolat, "
|
398 |
+
"stb.)"
|
399 |
+
|
400 |
+
msgid ""
|
401 |
+
"In October 2013 Google released a new feature called <a href=\"https://"
|
402 |
+
"support.google.com/tagmanager/answer/3415369?hl=en\" target=\"_blank\">auto "
|
403 |
+
"event tracking</a>. It is up to you how you use click events either using "
|
404 |
+
"Google's solution or the settings below."
|
405 |
+
msgstr ""
|
406 |
+
"2013 októberében a Google kihozott egy új <a href=\"https://support.google."
|
407 |
+
"com/tagmanager/answer/3415369?hl=en\" target=\"_blank\">automatikus esemény "
|
408 |
+
"követés</a> funkciót. Választhat, melyiket esemény követést használja, a "
|
409 |
+
"Google megoldását vagy az alábbi beállításokat."
|
public/frontend.php
CHANGED
@@ -21,7 +21,7 @@ function gtm4wp_add_basic_datalayer_data( $dataLayer ) {
|
|
21 |
|
22 |
if ( $gtm4wp_options[GTM4WP_OPTION_INCLUDE_USERROLE] ) {
|
23 |
get_currentuserinfo();
|
24 |
-
$dataLayer["visitorType"] = $current_user->roles[0];
|
25 |
}
|
26 |
|
27 |
if ( $gtm4wp_options[GTM4WP_OPTION_INCLUDE_POSTTITLE] ) {
|
@@ -229,6 +229,10 @@ function gtm4wp_enqueue_scripts() {
|
|
229 |
wp_enqueue_script( "gtm4wp-contact-form-7-tracker", $gtp4wp_plugin_url . "/js/gtm4wp-contact-form-7-tracker.js", array( "jquery-core" ), "1.0", false );
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
232 |
if ( $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WOOCOMMERCE] ) {
|
233 |
require_once( dirname( __FILE__ ) . "/../integration/woocommerce.php" );
|
234 |
wp_enqueue_script( "gtm4wp-woocommerce-tracker", $gtp4wp_plugin_url . "/js/gtm4wp-woocommerce-tracker.js", array( "jquery-core" ), "1.0", false );
|
21 |
|
22 |
if ( $gtm4wp_options[GTM4WP_OPTION_INCLUDE_USERROLE] ) {
|
23 |
get_currentuserinfo();
|
24 |
+
$dataLayer["visitorType"] = ( $current_user->roles[0] == NULL ? "visitor-logged-out" : $current_user->roles[0] );
|
25 |
}
|
26 |
|
27 |
if ( $gtm4wp_options[GTM4WP_OPTION_INCLUDE_POSTTITLE] ) {
|
229 |
wp_enqueue_script( "gtm4wp-contact-form-7-tracker", $gtp4wp_plugin_url . "/js/gtm4wp-contact-form-7-tracker.js", array( "jquery-core" ), "1.0", false );
|
230 |
}
|
231 |
|
232 |
+
if ( $gtm4wp_options[GTM4WP_OPTION_EVENTS_FORMMOVE] ) {
|
233 |
+
wp_enqueue_script( "gtm4wp-form-move-tracker", $gtp4wp_plugin_url . "/js/gtm4wp-form-move-tracker.js", array( "jquery-core" ), "1.0", false );
|
234 |
+
}
|
235 |
+
|
236 |
if ( $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WOOCOMMERCE] ) {
|
237 |
require_once( dirname( __FILE__ ) . "/../integration/woocommerce.php" );
|
238 |
wp_enqueue_script( "gtm4wp-woocommerce-tracker", $gtp4wp_plugin_url . "/js/gtm4wp-woocommerce-tracker.js", array( "jquery-core" ), "1.0", false );
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== DuracellTomi's Google Tag Manager for WordPress ===
|
2 |
Contributors: duracelltomi
|
3 |
Donate link: http://duracelltomi.com/
|
4 |
-
Tags: google tag manager, tag manager
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.6.1
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -38,6 +38,7 @@ This plugin can fire several Tag Manager events so that you can include special
|
|
38 |
* the visitor clicks on an outbound link
|
39 |
* the visitor clicks on a download link
|
40 |
* the visitor clicks on an email link
|
|
|
41 |
|
42 |
Link URLs are included in the Tag Manager event so that you can use them for example in a Google Analytics event tag.
|
43 |
|
@@ -60,7 +61,7 @@ More integration to come!
|
|
60 |
|
61 |
== Installation ==
|
62 |
|
63 |
-
1. Upload `google-tag-manager-for-wordpress` to the `/wp-content/plugins/` directory
|
64 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
65 |
1. Go to Settings / Google Tag Manager and enter your Google Tag Manager container ID and setup additional options
|
66 |
|
@@ -72,11 +73,11 @@ Google Tag Manager is not just about visitor tracking.
|
|
72 |
The ability to include a Google/Universal Analytics tag is only one feature
|
73 |
you can manage.
|
74 |
|
75 |
-
|
76 |
on certain cases.
|
77 |
|
78 |
-
If you want to exclude logged in users or
|
79 |
-
and
|
80 |
|
81 |
== Screenshots ==
|
82 |
|
@@ -88,9 +89,29 @@ and and exclude filter in Google Tag Manager.
|
|
88 |
|
89 |
== Changelog ==
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
= 0.1 =
|
92 |
* First beta release
|
93 |
|
94 |
== Upgrade Notice ==
|
95 |
|
|
|
|
|
|
|
|
|
|
|
96 |
This is the first public beta, no upgrade is needed.
|
1 |
=== DuracellTomi's Google Tag Manager for WordPress ===
|
2 |
Contributors: duracelltomi
|
3 |
Donate link: http://duracelltomi.com/
|
4 |
+
Tags: google tag manager, tag manager, google, adwords, google adwords, adwords remarketing, remarketing
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.6.1
|
7 |
+
Stable tag: 0.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
38 |
* the visitor clicks on an outbound link
|
39 |
* the visitor clicks on a download link
|
40 |
* the visitor clicks on an email link
|
41 |
+
* the visitor moves between elements of a form (comment, contact, etc.)
|
42 |
|
43 |
Link URLs are included in the Tag Manager event so that you can use them for example in a Google Analytics event tag.
|
44 |
|
61 |
|
62 |
== Installation ==
|
63 |
|
64 |
+
1. Upload `duracelltomi-google-tag-manager-for-wordpress` to the `/wp-content/plugins/` directory
|
65 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
66 |
1. Go to Settings / Google Tag Manager and enter your Google Tag Manager container ID and setup additional options
|
67 |
|
73 |
The ability to include a Google/Universal Analytics tag is only one feature
|
74 |
you can manage.
|
75 |
|
76 |
+
Therefor there is no need to have an option to exclude the container code snippet
|
77 |
on certain cases.
|
78 |
|
79 |
+
If you want to exclude logged in users or certain user roles, use the corresponting dataLayer variable (visitorType)
|
80 |
+
and an exclude filter in Google Tag Manager.
|
81 |
|
82 |
== Screenshots ==
|
83 |
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 0.2 =
|
93 |
+
* ! BACKWARD INCOMPATIBLE CHANGE ! - Names of Tag Manager click events has been changed to comply with naming conventions:
|
94 |
+
* ContactFormSubmitted -> gtm4wp.contactForm7Submitted
|
95 |
+
* DownloadClick -> gtm4wp.downloadClick
|
96 |
+
* EmailClick -> gtm4wp.emailClick
|
97 |
+
* OutboundClick -> gtm4wp.outboundClick
|
98 |
+
* AddProductToCart -> gtm4wp.addProductToCart
|
99 |
+
* Updated: click events are now disabled by default to reflect recently released Tag Manager auto events. I do not plan to remove this functionality. You can decide which solution you would like to use :-)
|
100 |
+
* Updated: language template (pot) file and Hungarian translation
|
101 |
+
* Added: new form move events to track how visitors interact with your (comment, contact, etc.) forms
|
102 |
+
* Added: event names to admin options page so that you know what events to use in Google Tag Manager
|
103 |
+
* Added: Google Tag Manager icon to admin settings page
|
104 |
+
* Added: Settings link to admin plugins page
|
105 |
+
* Fixed: null value in visitorType dataLayer variable if no logged in user exists (now 'visitor-logged-out')
|
106 |
+
|
107 |
= 0.1 =
|
108 |
* First beta release
|
109 |
|
110 |
== Upgrade Notice ==
|
111 |
|
112 |
+
= 0.2 =
|
113 |
+
BACKWARD INCOMPATIBLE CHANGE: Names of Tag Manager click events has been changed to comply naming conventions.
|
114 |
+
See changelog for details. Do not forget to update your Tag Manager container setup after upgrading this plugin!
|
115 |
+
|
116 |
+
= 0.1 =
|
117 |
This is the first public beta, no upgrade is needed.
|