Notification

The Google Analytics: GA4 Configuration tag is now the Google tag. GA4 Configuration tags in a web container will be automatically migrated starting in September. There are no changes to your existing measurement and there is no action required from you. Learn more

Troubleshoot: Config command out of order

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://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>

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
15477729785045255644
true
Search Help Center
true
true
true
true
true
102259
false
false