Basic Web Essentials – Custom Tag Template – News Couple
ANALYTICS

Basic Web Essentials – Custom Tag Template


The basic web vitality The custom tag template is a tag template for the Google Tag Manager community form gallery.

Describe

This tag adds scaling wizards to three basic web elements: Largest Content Drawing (LCP), First Input Delay (FID), and Cumulative Layout Transformation (CLS).

Each measurement is paid to dataLayer as soon as it becomes available.

Note that not every page load will record all three parameters. Read the documentation linked above to understand why.

directions

The form itself has only one configurable option: Namespace objects. If specified, all measurements will be combined within an object property of the measurement name (see below for an example).

Set the tag to shoot the all pages Effects. If you only want to measure a few pages, use a file page width Alternatively with the appropriate trigger case.

The tag writes the following items in dataLayer per time measured (CLS, for example, can be measured more than once per page).


  event: 'coreWebVitals',
  webVitalsMeasurement: 
    name: 'LCP',
    id: 'v1-123123123-123123123',
    value: 123.55,
    delta: 13.68,
    valueRounded: 124,
    deltaRounded: 14
  

if you own Namespace objects checked, then the above measurement will be pushed to dataLayer Like this instead:


  event: 'coreWebVitals',
  webVitalsMeasurement: 
    LCP: 
      name: 'LCP',
      id: 'v1-123123123-123123123',
      value: 123.55,
      delta: 13.68,
      valueRounded: 124,
      deltaRounded: 14
    
  

Measurement name spacing like this is useful if you want to submit all of your current CWV measurements in a single request. If the objects namespace is not, then each subsequent measurement replaces the keys and values ​​of the previous measurement.

You can create a file Custom event trigger NS coreWebVitals To launch your mark at this dataLayer.push() Happen or occur.

You need to create files data layer variables For everyone webVitalsMeasurement.* The variables you want to use in your tags.

It is recommended to use the Beacon API when sending Core Web Vitals data to the endpoint, as some measurements may occur when the page is dumped.

Google Analytics 4 uses the Beacon API automatically, so you don’t need to do anything manually.

Release Notes

date set of changes
Jan 21 2021 Add rounded integers to the object for easier implementation.
Jan 21 2021 The initial release.



Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button