Match method with Regex to fire tag on certain site pages



I'm trying to fire a Google GTAG script only on certain language variations of our site, I can't create a condition to fire this in our Tag Manager as it will impact other tags and pixels firing on the page rule.

I wan't the tag to fire only on certain language variations: '^/(at|cn|cz|de|dk|en|eu|fr|it|nl|no|pl|pt|pt-br|se)/)'

I'm trying to achieve this by using match method with Regex but I am getting a syntax error that I can't figure out on the below script: "Uncaught SyntaxError: Unexpected token ^" which I believe to be coming from the '^' at the start of regex string, however I need to only pull back pages that include the ISO market name (e.g. /en/) at the start of a URl string (e.g. /en/mypage/mysubpage)

if (location.pathname.match(^\/(at|cn|cz|de|dk|en|eu|fr|it|nl|no|pl|pt|pt-br|se)\/); {


var script = document.createElement('script');


.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
('js', new Date());
('config', 'DC-XXXXXXX');

Accepted Solutions (0)