mikeyp / google_tag Goto Github PK
View Code? Open in Web Editor NEWDrupal 8 Port of Google Tag Manager module for Drupal
Drupal 8 Port of Google Tag Manager module for Drupal
Looks like https://www.drupal.org/project/google_tag/ has moved ahead of this one.
I see these in my Drupal log.
It's coming from here modules/contrib/google_tag/src/EventSubscriber/GoogleTagResponseSubscriber.php:104
I am working on a site which handles multiple container_id's depending on parameters in the url.
In this case I decided to try and extend GoogleTagResponseSubscriber
and overwrite the public addTag
method, but I could not call $this->tagApplies($request, $response)
from within it because of its visibility being private
.
But what I was really trying to do was to overload the container_id config variable (no we do not want to use the domain module just for this one little edge case).
So I suggest 2 things
exception 'Drupal\Component\Serialization\Exception\InvalidDataTypeException' with message 'yaml_parse(): scanning error encountered during parsing: found unknown escape character [error] (line 5, column 13), context while parsing a quoted scalar (line 5, column 12)' in /mnt/gfs/carlyle8dev/livedev/docroot/core/lib/Drupal/Component/Serialization/YamlPecl.php:63 Stack trace: #0 [internal function]: Drupal\Component\Serialization\YamlPecl::errorHandler(2, 'yaml_parse(): s...', '/mnt/gfs/carlyl...', 46, Array) #1 /mnt/gfs/carlyle8dev/livedev/docroot/core/lib/Drupal/Component/Serialization/YamlPecl.php(46): yaml_parse('google_tag.sett...', 0, 0, Array)
When using the PECL YAML extension this error is triggered.
This module cannot be installed on environments like Acquia either via command line or the Drupal admin due to the double quoted form class in the routing.yml. Running it through YAML linter returned a malformed error. Changing it to single quotes corrects this issue, and I can now install the module on Acquia.
google_tag.settings_form:
path: "/admin/config/system/google_tag"
defaults:
_title: "Google Tag Manager"
_form: '\Drupal\google_tag\Form\GoogleTagSettingsForm'
requirements:
_permission: 'administer google tag manager'
Copied from https://www.drupal.org/node/2838151
This looks like this is a great solution - Thank you so much for putting in the work to create it.
To help the community to help you test it- then would be great to add this to the drupal site:
In ~ October (2016) Google updated their Official recommendations of how to implement GTM. I also found a blog-post that quickly summons up why the changes have been done if you're personally interested :)
Sorry I'm not creating this as a PR - much love <3
Is there instructions anywhere on how to install this into D8 on shared hosting?
Actual value
google_tag.response_subscriver:
Must read as:
google_tag.response_subscriber:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.