diff --git a/custom-skills/60-gtm-audit/code/docs/common_issues.md b/custom-skills/60-gtm-audit/code/docs/common_issues.md index 90e3e9c..c1e00f9 100644 --- a/custom-skills/60-gtm-audit/code/docs/common_issues.md +++ b/custom-skills/60-gtm-audit/code/docs/common_issues.md @@ -284,6 +284,22 @@ The JHR container has two content group variables for menu categories: **Gotcha — adding new subdomains**: When a new hotel brand subdomain launches (e.g., `les.josunhotel.com`), the subdomain alternation group `(www|app|...|les|\.)` in ALL main-domain rules must be updated. This affects 14+ rules in the URL-based variable. +### Gotcha — Subdomain Regex Dot Separator + +**Bug**: `(www|app|jpg|les|\.)?josunhotel\.com` does NOT match `www.josunhotel.com`. + +The `\.` inside the alternation group matches a literal dot OR `www` matches `www`, but neither consumes the `.` between the subdomain and `josunhotel`. The regex engine sees `www` then expects `josunhotel` but finds `.josunhotel`. + +**Fix**: Move the dot outside the group as an optional separator: +``` +BROKEN: (www|app|jpg|gjb|gjj|grp|les|\.)?josunhotel\.com +FIXED: (www|app|jpg|gjb|gjj|grp|les)?\.?josunhotel\.com +``` + +This correctly matches: `www.josunhotel.com`, `les.josunhotel.com`, `josunhotel.com` (bare), `app.josunhotel.com`. + +**Note**: GTM's "Full Matches Only = OFF" means `re.search` (partial match) is used, which may accidentally match the broken pattern on some URLs. But strict `re.match` or JavaScript `pattern.test()` will fail. Always test with the full URL in JavaScript console. + ### Audit Checklist for Content Grouping - [ ] Run `dtm var info ` to dump the full regex table diff --git a/custom-skills/61-gtm-manager/code/docs/common_issues.md b/custom-skills/61-gtm-manager/code/docs/common_issues.md index 90e3e9c..c1e00f9 100644 --- a/custom-skills/61-gtm-manager/code/docs/common_issues.md +++ b/custom-skills/61-gtm-manager/code/docs/common_issues.md @@ -284,6 +284,22 @@ The JHR container has two content group variables for menu categories: **Gotcha — adding new subdomains**: When a new hotel brand subdomain launches (e.g., `les.josunhotel.com`), the subdomain alternation group `(www|app|...|les|\.)` in ALL main-domain rules must be updated. This affects 14+ rules in the URL-based variable. +### Gotcha — Subdomain Regex Dot Separator + +**Bug**: `(www|app|jpg|les|\.)?josunhotel\.com` does NOT match `www.josunhotel.com`. + +The `\.` inside the alternation group matches a literal dot OR `www` matches `www`, but neither consumes the `.` between the subdomain and `josunhotel`. The regex engine sees `www` then expects `josunhotel` but finds `.josunhotel`. + +**Fix**: Move the dot outside the group as an optional separator: +``` +BROKEN: (www|app|jpg|gjb|gjj|grp|les|\.)?josunhotel\.com +FIXED: (www|app|jpg|gjb|gjj|grp|les)?\.?josunhotel\.com +``` + +This correctly matches: `www.josunhotel.com`, `les.josunhotel.com`, `josunhotel.com` (bare), `app.josunhotel.com`. + +**Note**: GTM's "Full Matches Only = OFF" means `re.search` (partial match) is used, which may accidentally match the broken pattern on some URLs. But strict `re.match` or JavaScript `pattern.test()` will fail. Always test with the full URL in JavaScript console. + ### Audit Checklist for Content Grouping - [ ] Run `dtm var info ` to dump the full regex table