Identify the issue
The "Config command out of order" error appears in Tag diagnostics when an event command is coded on one or more pages of your website before a gtag config command with any of the following settings:
client_idcookie_domaincookie_pathcookie_prefixfirst_party_collectionlinkerserver_container_urlsession_idtransport_urluser_id
Placing an event command before a config command may lead to unexpected issues during the sending and processing of these events.
Fix the issue
Tag diagnostics lists the URL for each page where an event command has been placed before a config command. To resolve this error on affected pages of your website, verify that the code on each page correctly positions the config command before any event commands.
Show me an example
The following is an example of the HTML for a web page where the "Config command out of order" error message appears in Tag diagnostics:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ABCDEF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ABCDEF');
</script>
<script>
gtag("event", "generate_lead", {
send_to: "G-1234567',
currency: "USD",
value: 99.99
}); gtag('config', 'G-1234567', {
'user_id': 'id'
}); </script>
</head>
</html>To resolve this error on the affected page, you can rearrange the
event and config commands so the config command loads on the page before the event command is triggered:<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ABCDEF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ABCDEF'); gtag('config', 'G-1234567', {
'user_id': 'U1234'
});
</script>
<script>
gtag("event", "generate_lead", {
send_to: "G-1234567',
currency: "USD",
value: 99.99
});
</script>
</head>
</html>