Adding Filters to Customize Analytics Request
-
Can you add filters to your UA/GA4 controllers so that developers can customize the request before it get’s sent to google?
For some context, our organization has a large multisite install with about 800+ sites. We track everybody automatically in google analytics by having 1 google account, and all traffic from all sites being recorded in a single “network” view. If ever we need specific information about a particular site, we just filter by the domain used.
This plugin is so close to being usable by us. If I could just have a couple of wp filters that would allow me to add ga filter parameters, then I could have 1 single network wide account, with each subsite displaying data for just itself (instead of displaying data for the entire network).
For example, for this bit of code here.
// Found in: wp-content/plugins/beehive-analytics/core/modules/google-analytics/endpoints/v1/class-stats.php on line 63 // Get the stats. $stats = $analytics->data_realtime->get( 'ga:' . $this->account, 'rt:activeUsers', array( 'dimensions' => 'rt:deviceCategory', ) );
it would be amazing if there was a filter that allowed me to add ga filters to the request, like this instead.
$optParams = apply_filters('beehive_ua_realtime_params', [ 'dimensions' => 'rt:deviceCategory', ]); try { // Get the stats. $stats = $analytics->data_realtime->get( 'ga:' . $this->account, 'rt:activeUsers', $optParams );
Ideally something like that would be added to all controller endpoints that make a google analytics api request, so that developers can modify the request.
- The topic ‘Adding Filters to Customize Analytics Request’ is closed to new replies.