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_id
cookie_domain
cookie_path
cookie_prefix
first_party_collection
linker
server_container_url
session_id
transport_url
user_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://googletagmanager.com/gtag/js?id=ignoredABCDEF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'ignoredABCDEF');
</script>
<script>
gtag("event", "generate_lead", {
send_to: "ignored1234567',
currency: "USD",
value: 99.99
});
gtag('config', 'ignored1234567', {
'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://googletagmanager.com/gtag/js?id=ignoredABCDEF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'ignoredABCDEF');
gtag('config', 'ignored1234567', {
'user_id': 'U1234'
});
</script>
<script>
gtag("event", "generate_lead", {
send_to: "ignored1234567',
currency: "USD",
value: 99.99
});
</script>
</head>
</html>