MonsterInsights 6.0 Backwards Compatibility

Have you developed your own WordPress plugin that hooks into Google Analytics by MonsterInsights? With the launch of MonsterInsights 6.0, we started from scratch to build the best Google Analytics plugin for WordPress, but we didn’t forget about you! MonsterInsights 6.0 was designed to ensure continued backwards compatibility to keep your plugin working as smoothly as possible. In this guide, we’ll share all the details of what’s changed.

Note: This is an advanced guide intended for developers.

What’s New With MonsterInsights 6.0 Actions and Filters

During the development of MonsterInsights 6.0, great care was taken to ensure continued backwards compatibility despite the significant number of changes in the plugin’s code. For each of the existing 10 actions and 12 filters between the ecommerce and base plugins, we researched extensively to try to find usage of each and to best support backwards compatibility for each hook if they made sense and we could do so.

As part of this review, all previously available frontend of website hooks will continue to function.

However, certain backend hooks will no longer function. For each of these, the names and reasoning is given below.

For the frontend hooks and filters, a new, better replacement is given below, along with a description as to why it’s better and any changes in usage required.

Note that backwards compatible supported frontend hooks will emit a deprecated warning to make it easier to locate any of this usage if and only if either WP_DEBUG is set to true (false by default on all WP installs), if debug mode is on in the MonsterInsights settings panel, or if you manually define MONSTERINSIGHTS_DEBUG_MODE and set it to true.

The actions yst_ga_universal_tab, yst_ga_custom_tabs-tab, yst_ga_advanced-tab, yst_ga_custom_dimensions_tab-content, yst_ga_custom_tabs-content, and filter yst_ga_admin_validate_settings could be used in previous versions to add additional settings tabs or setting tab content and save them. In our new settings system, we do not have a replacement for these as the mechanism used by this process we do not consider to be congruent with both our future goals for the plugin as well as in our best interest for the security of the plugin. Developers using these actions/filters (and we couldn’t find anyone doing so) should contact us via our support channel so we can help with replacement hooks.

The action yst_ga_show_license_form was a previously available internal-use only intended action hook designed to allow our extensions to output a field on the no-longer-existent licenses page to collect the license keys for that particular addon (essentially every addon you had in theory would use this action to output a license key box). As in our new license management system we only use 1 license key no matter how many of our addons you have installed, and we output this field by default, there’s no need to make a replacement.

Similarly, the filter yst_ga_extension_status was used to determine if a license key was active for a particular addon or not. As all addons use the same license key now, and it is activated or not for all at the same time, there’s no need to provide a replacement for this. Developers using this action or filter (and we couldn’t find anyone doing so) should contact us via our support channel so we can help with replacement hooks.

The actions yst_ga_dashboard_title, yst_ga_dashboard_title, and yst_ga_custom_dimension_add-dashboards-tab along with filters ga_dashboards_dimensions and ga_extend_dashboards were previously used to add or modify the reporting inside of MonsterInsights. As this reporting now uses an entirely new system, we’ve decided to not directly automatically hook in replacements for these as they could do more harm than good. Developers using these actions/filters (and we couldn’t find anyone doing so) should contact us via our support channel so we can help with replacement hooks.

The action yoast_ga_admin_footer was used to allow for output in the footer (though we didn’t use it nor could we find anyone doing so). As we no longer have a standardized footer template for our admin pages we do not have a direct replacement for this action. Developers using this actions/filters (and we couldn’t find anyone doing so) should contact us via our support channel so we can help with replacement hooks.

yst-ga-filter-api-limit which was used to limit the number of responses from GA for API queries is backwards compatibly mapped to monsterinsights_reporting_get_max_api_limit which defaults to 300 instead of the previous filters’s 1000. Substitutions for this filter should be made (note use of the filter has not changed immediately, but in the future, API reports will use the new filter’s returned value, or the report’s individually set max api limit, whichever is lower).

The yst_ga_default-ga-values filter, used to supply the default values of settings, will in the new versions only apply when MonsterInsights inquires during the pre-6.- to 6.0+ installs what the Yoast settings defaults were for upgrade purposes.

The filter yst_ga_track_super_admin controlled whether super admins (in multisite setups) were tracked by Google Analytics. This filter backwards compatibly mapped to monsterinsights_track_super_admins.

The action yst_tracking which allowed output before the universal and ga tracking output has been mapped to monsterinsights_tracking_before_ga and monsterinsights_tracking_before_analytics.

The filter yoast-ga-push-array-ga-js has been mapped to monsterinsights_frontend_tracking_options_ga_end which is backwards compatible with the exception that the option array indices are now named instead of numerically numbered. Similarly, the filter yoast-ga-push-array-universal has been mapped to monsterinsights_frontend_tracking_options_analytics_end.

The filter yst_ga_filter_push_vars has been mapped to monsterinsights_frontend_tracking_options_analytics_before_scripts which is backwards compatible with the exception that the option will be added to a keyed array indice named yst_ga_filter_push_vars_ . $i where $i is the number (in order called) of the attached yst_ga_filter_push_vars filter functions.

The filter yst-ga-filter-api-end-date will no longer be supported as it will make adding custom reporting dateranges via UI (something we’re looking forward to doing in the future) harder to implement.

The filter yst-ga-filter-ga-config which can be used to edit the GA config settings has been mapped to monsterinsights_{lite/pro}_google_app_config backwards compatibility. Note however, we do not permit the scopes of the GA config to be altered since doing so breaks MonsterInsights’s functionality.