Skip to main content

Collect Real User Core Web Vitals in Google Tag Manager

This guide explains how to collect real user Core Web Vitals with DebugBear real-user monitoring and Google Tag Manager (GTM).

Step 1: Get your RUM snippet embed code

Sign up for a DebugBear account or log into your existing account. Click Install Analytics Snippet, or open the RUM tab in the sidebar and click Get Started.

DebugBear setup screen

To collect Core Web Vitals metrics and debug data on your website, you need to install an analytics snippet on your website.

Click Copy to copy the embed code into your clipboard.

DebugBear RUM embed code

Step 2: Add the RUM snippet to Google Tag Manager

Open Google Tag Manager and open the tag container for the website where you want to collect Core Web Vitals data.

Then click on New Tag.

New Tag button in Google Tag Manager

Click on the Tag Configuration button and select Custom HTML.

Tag Configuration in GTM

Paste in the DebugBear RUM tag HTML and click Save.

Custom HTML setup in GTM

Then click the Triggering button and select All Pages (or another trigger condition that makes sense for your website.)

Trigger setup in GTM

Finally, click Save and enter a name for the tag.

Provide a tag name in GTM

After setting up the tag you need to publish your changes.

Click on Submit, Publish, and then Continue. After a while, Google Tag Manager will confirm that the new tag has been published.

Published tag in GTM

Step 3: Wait for RUM data to arrive in DebugBear

Return to the DebugBear website and click I've installed the RUM snippet. DebugBear will now wait for visitors to come to your website and confirm once data has been collected.

tip

If your website doesn't get much traffic this may take some time. However, you don't have to wait, and you can either come back to DebugBear RUM later or visit the website yourself so that data is collected.

Step 4: Review your Core Web Vitals data

After setting up the RUM snippet you can start seeing Core Web Vitals data in your DebugBear dashboard.

Core Web Vitals dashboard

Select Page Views to view individual visits to your website and investigate web performance.

Page views in DebugBear data

Downsides of using a tag manager to load the RUM embed code

Usually using a tag manager to collect Core Web Vitals data is fine, and easier to set up than modifying your website HTML template.

However, it does impact your data in two ways:

  • Short visits are not counted: if the visitor navigates away before the tag manager code has loaded then no data will be collected
  • Early script errors are not reported, as they can only be detected once the analytics script has loaded.