How does this Google Analytics plugin work from a backend api and storage standpoint?

What's the overhead of this plugin? How often does it hit the google api? Where does it store data? I have a large site with over 1M+ posts. I'm wondering the impacts this would have to the load of the site.

  • Nastia

    Hello Candace

    Thank you for your question!

    The Google Analytics+ plugin is directly connected with the Google API and update the data the next day, as Google does on the Analytics page.

    I have a large site with over 1M+ posts. I'm wondering the impacts this would have to the load of the site.

    This entirely depends on from the resources of the hosting provider you are on and how your site is optimized. The are several factors that you need to look when you have a big site like that :
    - Set max PHP memory
    - Make sure you have enough Bandwith if you have lot of traffic
    - Use a cache plugin
    - Leverage browser caching ( You can do this with the Hummingbird plugin)
    - Compress your images with WP Smush
    - Compress your website with gzip (Hummingbird plugin)
    - Minify your CSS and JS files (Hummingbird plugin)
    - Servers with Dedicated IP often increases the load speed of a site.

    You can find bellow some useful information about how to make your site even faster:
    How I Made My WordPress Site 1311% Faster with Cloudways and WPMU DEV Plugins
    Fast Gets Faster as Hummingbird Adds CloudFlare Integration

    Let me know if you have any further questions!


  • Candace

    Thanks. Can you tell me where and how the data is stored though for this plugin? I'm just wondering if you create custom tables for this plugin or you are shoving it into something like wp_postmeta (which already is huge on our site)

    Also, do we have control over the time of day it does this? Im assuming if it hits the Google API and there is a lot of data that may have overhead during that time.

  • Sajid

    Hello Candace :slight_smile:

    No it does not store data into wp_posts or wp_postmeta tables. For logins and access token etc.. It stores data into a custom table called wp_gaplus_login.

    For statistics data, it utilizes WordPress Transients API to store data temporarily. That is ideal for this type of plugins to store data when it needs to be updated often.

    And as you know, all transients get saved into wp_options table.

    It look for new data after every 24 hours as mentioned by Nastia above. However, if you want to change the frequency/interval then you can do that by using following filters.

    function wpmudev_change_freuqency_to_fetch_ga_data( $interval ){
    	// Default is one day and we override that to make it two days.
    	// If you want to chagne then make sure you provide the interval in seconds.
    	$interval = 172800;
    add_filter('ga_cache_timeout_personal', 'wpmudev_change_freuqency_to_fetch_ga_data');
    //You don't need this if you are not using WordPress MultiSites.
    add_filter('ga_cache_timeout', 'wpmudev_change_freuqency_to_fetch_ga_data');

    Add this code in functions.php file of your child theme or use it as mu-plugin.

    If you go with mu-plugin route then, go to your /wp-content/ folder via FTP, and find the folder called "mu-plugins". If there is no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like and paste the code in there.

    You don't need to activate that plugin, as it will be always be automatically activated. Please be sure to add a PHP start tag at the beginning of the code if you insert this code as a mu-plugin, like this:


    However, if you want to force plugin to get new data on specific time of the day, lets say 1 AM then its not possible at the moment without actually modifying the plugin's core files.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.