Problem/Motivation
When entering Web Property IDs, it's possible to add extra characters before the initial G- or UA-. These IDs are accepted as valid and are output in the script tag.
Steps to reproduce
- Install the latest 4.x version of the module.
- On the configuration page, enter a Web Property ID with extra bits at the front, such as "extra-G-87654321"
- Note the configuration is saved OK.
- Open the site's homepage in a separate browser or private window and view source.
- Note the tag is output with the extra characters:
gtag("config", "extra-G-87654321", {"groups":"default","page_placeholder":"PLACEHOLDER_page_location"});
Proposed resolution
Update the regex to pin the G-|UA- etc. pattern to the front of the string.
Remaining tasks
Patch and test.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3331402-web-property-id-2.patch | 1020 bytes | cboyden |
Issue fork google_analytics-3331402
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
cboyden commentedSee MR and attached patch.
Comment #6
japerryThanks for the report and patch! Committed! (Now to look to see if this is also a typo in D7....)