• Resolved spuds10

    (@spuds10)


    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.

    • This topic was modified 1 year, 6 months ago by spuds10.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi?@spuds10

    Hope you are doing fine!

    I have shared this request with our Second Level team to verify if it is possible to add custom code to achieve this functionality. Keep in mind though that providing a solution will depend on how complicated including this new code may become. They will share any findings with the Development Team so it can be added as an improvement or new feature (at the code level), in case they consider it is more convenient,

    Also, take into account the Second Level Support team works with more complex issues and their response may take some considerable time. Once they have an update a response will be added in this thread.

    Kind regards

    Luis

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @spuds10

    Sorry for the delay here,

    Just confirming, we don’t have a filter but we tasked it as a feature request to our developers, it could be a really nice idea.

    Best Regards
    Patrick Freitas

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding Filters to Customize Analytics Request’ is closed to new replies.