Closed (fixed)
Project:
Google Tag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Jul 2014 at 21:20 UTC
Updated:
26 Feb 2017 at 22:06 UTC
Jump to comment: Most recent
Are there plans to add some kind of support for the DataLayer functionality of Google Tag Manager? If there was a way to specify this via GUI then we could pass the same data to Google Analytics as custom variables or custom dimensions/metrics. This type of functionality would let us use this module asa full replacement for the google_analytics module without losing functionality.
At the very least, it would be good if this module provided an API for specifying DataLayer data. Any module can do it manually, but if this module handled the processing/rendering into JS, it would keeps things centralized and clean.
Comments
Comment #1
Anonymous (not verified) commentedHi,
there is dataLayer module: https://www.drupal.org/project/datalayer
Regards,
Comment #2
rwohlebIt's very strange that they would implement an entire module for the DataLayer stuff, but leave implementation of GTM to the user. Based on the creation date of the datalayer module, and the lack of any mention for the google_tag module, it really seems like they failed to see if any GTM related module already existed. In any case, the maintainers of both modules need to have a chat to make sure everything is compatible, and cross-links would be good.
Comment #3
rwohlebComment #4
doublejosh commentedHello @rwohleb. I created the Data Layer module :)
Was just coming here to make sure the cross linking happened. Added to my side. Seems like most folks using this GTM module would want to employ that eventually.
My interest in the dataLayer was actually as a meta data standard for anonymous user profiling via localStorage via my Groucho library. This is implemented in Drupal via the 2.0 branch of my Semi Anonymous module.
Kinda nice to decouple meta data rendering from snippet inclusion, but certainly could live together.
@solotandem Would appreciate a cross link if you so choose.
Thanks.
Comment #5
solotandem commentedIt was my intention to add support for the data layer to this module; it simply was not a client requirement for first release. I will need to consider how the Data Layer module fits into this.
Comment #6
achtonI have attempted to go the way of GoogleTagManager + Data Layer modules to implement support for GTM and at the same time expose standard stuff about the site in the DataLayer variable.
I was originally going to submit a patch which simply adds info like user roles, entity type, attached terms, etc. to the DataLayer. However, I like the idea of letting an existing module provide this feature, and this seems to be more or less exactly what the Data Layer module provides. It even has an alter hook ready, so that other modules can add info to the DataLayer if they need to.
I have a few minor suggestions/changes I would like to see in Data Layer though, but most importantly (for me right now, since I have a deadline) is that I have trouble with the way Data Layer uses menu_get_item() to determine the entity type and how to load it. It may be that my use case (a complicated site that with lots of custom entity handling) is specific for this problem - in any case I will open an issue with Data Layer module for this bug and my other suggestions.
TL;DR: Barring a few bugs/suggestions, I think Data Layer module is a good companion for google_tag. I'm not sure any integration is even needed. Issues with the Data Layer module should go in the module's issue queue.
Comment #7
mvcI agree that using the existing datalayer module makes more sense that recreating that functionality here. I have a suggestion for the advanced settings section of this module's configuration page, though. If datalayer is enabled, we could show a checkbox that uses its API to configure a GTM whitelist & blacklist, as per https://developers.google.com/tag-manager/devguide#security
Suggested default whitelist:
Suggested default blacklist:
It could be added like this:
This is for the use case where a site manager has delegated GTM admin access to a third party, eg an SEO consulting firm. Without these security settings, that third party would be able to inject custom JS at will on any page.
If the datalayer module isn't available, a short note could be shown explaining that this functionality will become available if installed (like advanced_help does on the views UI page).
Comment #9
solotandem commentedPatch does the following:
If datalayer module is updated to allow a different name for the layer, then can remove the restriction in this patch.
Please test latest release. Thanks.
Comment #12
doublejosh commentedBTW: The Drupal 8 version of DataLayer is now in a dev status and being worked on :)