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

  1. Install the latest 4.x version of the module.
  2. On the configuration page, enter a Web Property ID with extra bits at the front, such as "extra-G-87654321"
  3. Note the configuration is saved OK.
  4. Open the site's homepage in a separate browser or private window and view source.
  5. 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.

CommentFileSizeAuthor
#3 3331402-web-property-id-2.patch1020 bytescboyden
Command icon 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

cboyden created an issue. See original summary.

cboyden’s picture

Status: Active » Needs review
StatusFileSize
new1020 bytes

See MR and attached patch.

japerry made their first commit to this issue’s fork.

  • japerry committed 3ed74088 on 4.x authored by cboyden
    Issue #3331402 by cboyden: Web Property ID regex pattern allows extra...
japerry’s picture

Status: Needs review » Fixed

Thanks for the report and patch! Committed! (Now to look to see if this is also a typo in D7....)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.