Git Product home page Git Product logo

gtm4wp's Introduction

Google Tag Manager for WordPress

Build Status

This GitHub repo was created to allow others to easily contribute to this WordPress plugin. You can find more about the plugin at the plugin homepage

Support

If you have any issues not related to the source code of the plugin directly, please visit the support forum and ask your questions there.

Bug report

Please use the issue tracker of this GitHub repo to report any problem related to the source code. If you also was able to find a solution, send a Pull Request so that you code can be reviewed and merged to the core.

Contribution

If you would like to extend plugin functionality by adding your own code, please feel free to send a Pull Request. It is also important to note that not all requests will be merged to the core so please do not be mad at me if your code does not get added.

gtm4wp's People

Contributors

code-craze avatar davefx avatar dekadinious avatar dependabot[bot] avatar duracelltomi avatar emreerkan avatar eriktdesign avatar hans2103 avatar henkisdabro avatar huanyichuang avatar koconder avatar luizyamada avatar massimo-maimeri avatar michaelbourne avatar mklepaczewski avatar morvy avatar msaggiorato avatar nicomollet avatar pinkasey avatar robbiet480 avatar robklo avatar sakuk3 avatar scrutinizer-auto-fixer avatar sjoerdkoelewijn avatar staymanhou avatar szepeviktor avatar tijevlam avatar twelvenights avatar versilov avatar xib3rr4dar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtm4wp's Issues

Opt in / Opt out for user

Now that GDPR takes place 25th of May, It should be able for the user to Opt in and Opt out of tracking via the plugin.

Include IP address in the data layer

With GDPR it might be not possible to send full IP address into GA
This means that users will need to filter internal traffic inside GTM.

To be able to do so, the IP address has to be added into the dataLayer

Feature: stock level

Hey Tom, I'd love to see stock levels exposed via dataLayer so I can pull into Analytics as custom dimension. Past companies had issues keeping products in stock and would no react to the issue until I put together overwhelming analytics on lost sales.

WooCommerce inline JavaScript codes could be moved into a separate .js file

Most event handlers are currently added as inline JavaScript codes into the WordPress site. This makes the size of the loaded page larger and can prevent certain cache plugins to fully boost performance on pages.

The plugin could change the behavior of attaching event handlers using jQuery selectors by creating a separate .js file where most event handlers could be defined as functions and WooCommerce/WordPress hooks could be used to add click events directly to the buttons and links.

This would also make the WooCommerce integration more compatible with themes where the standard WooCommerce HTML coding has been abandoned.

Product clicks block normal flow when GTM blocked

Clicks on products in product list pages are blocked by plugin if GTM is not loaded because of an ad blocker. Click event handler should check whether GTM was actually loaded and only act if yes.

UserRegistrationDate is not working

In the last release, user registration date is supposed to appear in the backed.
It doesn't appear, at least I used the files from the last commit (it indeed has the option in the admin.php file) but somehow it doesn't appear.

image

possible confusion of the code snippet locations in the readme file

According to the readme file, it states that "the most important part of the GTM codes" is inside the and that this is the iframe part of the code and also that it only fires when javascript is broken/disabled. This does not sound right: Is this not the other way around:

head
- this is the javascript portion without an iframe right?

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WCRQ6CV');</script>
<!-- End Google Tag Manager -->

body
- clearly this is the iframe part meant for disabled javascript

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WCRQ6CV"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Allow users to select which order status to track

There are cases where only orders with completed payments should be tracked into GA.

For this case, some enhancement should be added:

  • order status into data layer so that transactions can be filtered using GTM custom JS variables
  • new options to be able to select which order statuses should be tracked while on the order received page

Original discussion:
#35

Adwords Remarketing Term Breach

A while ago I asked if you could add user emails and usernames as dataLayer variables in issue #9 , You did so very quickly and I am very grateful. We use to define that manually and build our remarketing tag by referencing each datalayer variable we needed. It recently came to my attention that I can just call the google_tag_params hierarchy and receive all the values. Unforchantly in doing so, I noticed a small issue. The email and username are included within the google_tag_params: { }. It should be defined outside of that to avoid being invoked by the adwords remarketing script while allowing me to manually define it as a data layer variable for a range of other tags.

Emails should only be used for services offering customer matching, like Active Campaign JS User Cookies setting, Facebook Custom Match Pixel, Adroll Customer Match Pixel but not for Google services. Currently, the visitorType and visitorEmail are within the google_tag_params hierarchy, which means when you define the dataLayer v2 variable "google_tag_params" in Tag Manager and link it to the built in Adwords Remarketing Tag w/ datalayer matching, it will pull everything within thegoogle_tag_param.

This creates a breach of the Google Adwords remarketing terms and conditions as you mentioned. Since using the google_tag_params is the proper method for remarketing, this is not ok.

The solution is to keep the personal tags, visitorType and visitorEmail, outside of the google_tag_param. The current setup would allow me to remarketing to people directly using their emails, which is a No no. If you just moved these two dataLayer variables into independent hierarchies, this would be solved easily.

I have attached some screenshots to better explain what I did and why it can be a problem for some users. Short term solution is going back and manually defining all these attributes as variables then calling them in the remarketing tag, but when working on a lot of new clients that can be very time-consuming. For the average user following a tutorial, this would be overlooked and quickly cause then issues.

I just wanna note again, this feature is critical to many newer attribution solutions and web tracking automational software. It should not be removed, just relocated.

Image of problem below
image

Image of tag setup that causes this issue
image

Example of Proper Use case outside of the google_tag_params and defined as a seperate dataLayer variable
image

Example of Proper Use case outside of the google_tag_params and defined as a seperate dataLayer variable
image

Add WP filter to price values

A filter should be added into the WooCommerce implementation so that people can add their own price calculations.

Most probably this would be useful if the filter would add the whole product array so that custom dimensions can be added easily as well.

Track "undo" remove from cart

When removing a product from the cart a notice is displayed by WooCommerce with a link to undo the change and add the product back to the cart. When clicking on this link it would be great if the addToCart event would fire again.

Enhanced Ecommerce should respect SKU option

Currently the "Use SKUs instead of product IDs" option only changes what is being reported in the AdWords dynamic remarketing variables. This should be changed so that classic and enhanced ecommerce reports also use SKUs if plugin user selected that option.

Easy Digital Downloads Integeration

I nice enhancement for the plugin would be if there was an Easy Digital Downloads integration.

It could track sales, cart checkouts, etc.

Feature: Word Count as a Data Layer Variable

It would be awesome to have the word count in the data layer when the page loads. Even more useful could be "Range of word count", possible values:

  • 0-500
  • 501-1000
  • 1001 - 1500
  • 1501 - 2000
  • 2001 - 2500 etc.

I would later pass these values as custom dimensions with pageview hits and then see which word count is the most correlating with content engagement, newsletter signups, etc.

Media Player trackers should react on DOM changes

There are cases when a media player is showed in a popup layer which is created while clicking on an activation link. In those cases the DOM does not include the media player element on page load thus there will not be data layer events for players in such popups.

There is browser feature that could help the plugin to detect DOM changes but this is not supported in IE10 and earlier and according to MDN, Safari implements it as an experimental feature:
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

Blocking GTM causes WooCommerce to break

We have been pointed out that some of our customers were having issues with our shop. They weren't able to open products from the category pages.
When investigating it turns out that they were using an AdBlocker (AdGuard - Chrome - MacOS) and had set several filters to also block GTM.
With the Enhanced E-Commerce Option enabled the productClick event causes a major failure:

The preventDefault() disables the normal redirect and with GTM blocked by the user, the manual redirect that is implemented in the eventCallback is never triggered.

https://github.com/duracelltomi/gtm4wp/blob/master/integration/woocommerce.php#L721

Why do we use a manual redirect at all? What's the idea behind the preventDefault() here and why do we differentiate between a normal click and one with ctrl-key pressed? In my tests the Event is fired in any case also with the preventDefault and eventCallback removed. Am I missing something?

In any case this implementation should be addressed. We need a fallback if GTM is blocked.

Add an option into WooCommerce integration to include full category path

Although looping through the full category tree to pass this in enhanced ecommerce can cause performance issues on larger sites, there are cases where this is useful and acceptable. To prevent performance issues, there could be a new option under the WooCommerce integration that would allow users to turn on full category path in the data layer instead of the name of the lowest level category:

https://wordpress.org/support/topic/woocommerce-parent-category-not-parsing/

Change behavior of product detail action

  1. if there is base-item sku select base-item sku if the product detail page is loaded
  2. if there is no base-item sku but product variations with sku use the first product-variation sku in list
  3. if the user changes the variation by dropdown the datalayer is getting updated with the selected product-variation sku

SKU instead of ID

Hi, I just fund a problem with feature that change ID to SKU. On simple products on event: gtm4wp.addProductToCartEEC information which is pushed to dataLayer contains something like: id: 'SKU: 10001', and it should be id:'10001' without SKU. When do this changes:
Line 718: "sku" => $product_sku,
Deleted: ? __( 'SKU:', 'duracelltomi-google-tag-manager' ) . ' ' . $product_sku : $product_id,
Orginal: "sku" => $product_sku ? __( 'SKU:', 'duracelltomi-google-tag-manager' ) . ' ' . $product_sku : $product_id,

And now this is working. Maybe you should make this changes in plugin, but I am not sure what is was for ? __( 'SKU:', 'duracelltomi-google-tag-manager' ) . ' ' . $product_sku : $product_id, and what could happen more when I deleted this.

AMP – CloudFlare.com – AMPforWP.com

Please see attached ZIP file.

This is regarding AMP – CloudFlare.com – AMPforWP.com

More info at:
GIThub
ahmedkaludi/accelerated-mobile-pages#958

WordPress support AMPforWP.com
https://wordpress.org/support/topic/gtm-google-tag-manager-error-http-response-code-indicates-tag-failed-to-fire-s/

Trying to make Google Tag Manager work correctly with CloudFlare and AMPforWP.com using "DuracellTomi's Google Tag Manager for WordPress"

Ref: WordPress support DuracellTomi's
https://wordpress.org/support/topic/setting-gtm-for-amp-pages/

Attached is a PHP file / WordPress plugin that will place the GTM - Google Tag Manager - code in the correct place in AMPforWP.com

Hope this will make it easier to develp DuracellTomi's Google Tag Manager for WordPress to support AMP through AMPforWP.com

amp-gtm-plugin.php.zip

Function to return tag ID

Is there a function to return the Google Tag Manager ID? I need to use the ID in another plugin and I'd like to use a built-in function if available.

A warning should be added for WooCommerce 2.6- users

Since WooCommerce 3.x is now the latest version and the plugin seems to meet all the new requirements, it is time to inform users of WooCommerce 2.6 or older to upgrade and to prepare for the drop of support for those WooCommerce version.

v1.8 will still support 2.6- but should include a dismissable message
v1.9 will drop compatibility codes from the source

Add Additional Weather API

https://wordpress.org/support/topic/suggestion-add-additional-weather-api/

The openweathermap api returns limited data compared to other weather services. Feel-like Temp, Dew Point, and UV Index are some of the more important pieces of data they are missing.

Can I suggest adding Dark Sky API? They’ve been around for a long time. It’s one of the best weather api’s available. They offer many more data points. The first 1000 calls per day are free.
https://darksky.net/dev/docs

Unnecessary PHP notice

Hi there!

Im getting a PHP notice in the current version of gtm4wp in line
https://github.com/duracelltomi/gtm4wp/blob/master/admin/admin.php#L887

"( ! ) Notice: Undefined index: plugintocheck in /wp-content/plugins/google-tag-manager/admin/admin.php on line 887"

My solution would be to set plugintocheck to NULL which would not break the current code:

"plugintocheck" => isset($fielddata["plugintocheck"]) ? $fielddata["plugintocheck"] : null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.