Home » Articles » Web Analytics » How to set up first-party mode via Cloudflare

What is first-party mode?

First-party mode fundamentally changes how Google tags operate on your website. Instead of requesting tags from Google’s domain, your website loads them from your own domain. The system places the Google tag or Tag Manager container at the very top of your webpage, before all other scripts, ensuring optimal performance.

When setting up a new tag, the system automatically adds a gtag(‘config’) or gtm.init event. For websites already using Google tags, first-party mode respects existing on-page settings, which can be managed through Cloudflare’s configuration panel.

Implementation requirements

Before beginning the setup, your website needs:

  • An existing Google tag or Tag Manager container
  • A Cloudflare account for automated setup

Detailed setup process

Accessing first-party mode settings

The setup begins in your Google tag screen or Tag Manager container.

First, navigate to the Admin tab and locate the First-party mode settings.

Choosing a measurement path

You’ll need to choose a measurement path, which by default uses four alphanumeric characters to avoid conflicts with existing paths. You can customise this path (e.g., ‘/metrics’) by clicking the arrow icon and entering your preferred option.

Connecting with Cloudflare

Next, click the Sign into Cloudflare button and log in. This grants the Google tag essential permissions, including:

  • Access to account information and analytics
  • Ability to read account zones
  • Permission to read, edit and publish Google tags in first-party mode
  • Authority to perform background actions

Enabling first-party mode

Before enabling the feature, verify two crucial elements:

  1. Confirm that your Cloudflare zones match your expectations
  2. Ensure your chosen measurement path isn’t already in use on your website

Once verified, click the Complete setup button to activate first-party mode across all your Cloudflare zones.

Managing your setup

After activation, management is handled through the Configure button in the top-right card header. This provides two main options:

  1. Pause or Activate: Control first-party mode across all domains in your Cloudflare account
  2. Configure in Cloudflare: Access the Cloudflare dashboard for individual domain settings

Testing and verification

Testing requires at least one configured tag that fires. Use Tag Assistant to preview your container and navigate through your site to trigger events.

In the Summary > Output > Hits Sent tab, verify that hits are being correctly routed to your measurement path.

First-party mode offers a more robust and reliable way to implement Google tags. While still in beta, it provides significant advantages for website tracking and measurement.

Note: This feature remains in beta testing, and setting it up can significantly improve your tag performance and measurement signal quality. The automated setup with Cloudflare is currently available through a closed beta programme, and interested parties can express interest through the provided interest form.

Wave

Enjoy our articles? Join our free list and get more.

Sign Up

Book Discovery Call