It looks like, from inspection, that the form of a Google Tag Manager id is "GTM-XXXXXX" where the x's are [A-Z]|d, is this accurate? I need to verify whether the id's being submitted to a CMS are valid.
I've just wrote this one for our framework:
/^GTM-[A-Z0-9]{1,7}$/
Tested with 25 GTM container IDs in our account, all passed validation. You can try this expression out here.
The format varies. I see various combinations of numbers and letters, some just letters, none just numbers, most 6 characters, and few with 4 characters. There's no clear pattern. They begin with either a letter or number, and end with a letter or number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With