Skip to content

Commit

Permalink
Merge pull request #126 from xwp/feature/ga4-with-attribution
Browse files Browse the repository at this point in the history
Add INP to GA4 with LoAF attribution
  • Loading branch information
mehigh authored Jun 26, 2024
2 parents eb70ebc + ee4313e commit f943153
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 987 deletions.
32 changes: 5 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ The plugin must be configured by setting the `site_performance_tracker_vitals` t

To send Web Vitals metrics to Google Analytics in a format compatible with the [Web Vitals Report](https://web-vitals-report.web.app), enable the following theme support and passing in the ID:

[Google Analytics (analytics.js)](https://support.google.com/analytics/answer/7476135) is supported, requires passing the ID using `ga_id`:

```php
add_theme_support( 'site_performance_tracker_vitals', array(
'ga_id' => 'UA-XXXXXXXX-Y',
) );
```

[Global Site Tag](https://support.google.com/analytics/answer/1008080) is supported, requires passing the Analytics ID (starting with `UA-` not `GTM-`) using `gtag_id`:

```php
add_theme_support( 'site_performance_tracker_vitals', array(
'gtag_id' => 'UA-XXXXXXXX-Y',
) );
```

[GA4 Analytics](https://support.google.com/analytics/answer/9304153) is supported, requires passing the ID using `ga4_id`:

```php
Expand All @@ -44,17 +28,6 @@ add_theme_support( 'site_performance_tracker_vitals', array(
) );
```

If you need to override the Google Analytics dimensions (defaults to `dimensions1` through `dimension3`) to store these under, pass them along on the add theme support initialisation:

```php
add_theme_support( 'site_performance_tracker_vitals', array(
'gtag_id' => 'UA-XXXXXXXX-Y',
'measurementVersion' => 'dimension7',
'eventMeta' => 'dimension8',
'eventDebug' => 'dimension9',
) );
```

The following hooks can be added to a theme or a custom plugin to configure the plugin, alternatively you can configure the plugin through the settings screen, in case of duplication, plugin will take programmatically set settings. To confirm they were applied look for the `webVitalsAnalyticsData` global variable in the page source.

### Limit the number of events sent
Expand Down Expand Up @@ -99,6 +72,11 @@ All contributions are welcome! Please create [an issue](https://github.com/xwp/s

### Changelog

#### 1.3.3 - October 30th, 2023

- Deprecated GA3 support.
- Used attribution build of web vitals.

#### 1.3.2 - October 30th, 2023

- Improved admin interface for GA4.
Expand Down
2 changes: 1 addition & 1 deletion js/dist/module/web-vitals-analytics.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'fce1f2f2d706b26fa13d359ef5102663');
<?php return array('dependencies' => array(), 'version' => 'df22e0939b3993085571f1a1e05ab969');

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f943153

Please sign in to comment.