wpmudev-sls
1/2/2018 - 8:27 PM

Replace the built in Google Analytics+ API Keys with custom ones to avoid hitting the daily limits.

Replace the built in Google Analytics+ API Keys with custom ones to avoid hitting the daily limits.

<?php
/**
* Plugin Name: Change Google Analytics API Keys
* Plugin URI: https://premium.wpmudev.org/project/google-analytics-for-wordpress-mu-sitewide-and-single-blog-solution/
* Description: Replace the built in Google Analytics API Keys with custom ones to avoid hitting the daily limits.
* Author: Lindeni Mahlalela @ WPMUDEV
* Author URI: https://premium.wpmudev.org/profile/mahlamusa
* License: GPLv2 or later
*/

if ( ! function_exists( 'change_ga_project_client_id' ) ) {
    add_filter('ga_project_client_id', 'change_ga_project_client_id', 10, 1);
    function change_ga_project_client_id( $client_id ) {
        return "your project client ID";
    }
}

if ( ! function_exists( 'change_ga_project_client_secret' ) ) {
    add_filter('ga_project_client_secret', 'change_ga_project_client_secret', 10, 1);
    function change_ga_project_client_secret( $client_secret ) {
        return "your client_secrete";
    }
}

if ( ! function_exists( 'change_ga_project_key' ) ) {
    add_filter('ga_project_key', 'change_ga_project_key', 10, 1);
    function change_ga_project_key( $project_key ) {
        return "your project key";
    }
}