Answer the question
In order to leave comments, you need to log in
How to fix Parse error. ',' expected?
There is an article that describes how to catch 404 in analytics systems through GTM. But when publishing, GTM gives an error and does not publish changes "JavaScript compiler error on line 3, character 19. Parse error. ',' expected"
Judging by the error, he does not like the comma, tell me how to fix it.
In the article itself, comments are closed, so I can’t ask the author.
Here is the code
function() {
var req = [Http Request];
try {
req.open('GET', '[Page URL]', false);
req.send('');
} catch (e) {
success = false;
error_msg = "Error: " + e;
}
return req.status;
}
function() {
var req = {{Http Request}};
try {
req.open('GET', '{{Page URL}}', false);
req.send('');
} catch (e) {
success = false;
error_msg = "Error: " + e;
}
return req.status;
}
Answer the question
In order to leave comments, you need to log in
compare in the article the code in the listing and the code on the screen below the listing
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question