awesomemotive / google-analytics-for-wordpress

Add Google Analytics to WordPress and be able to use all the powerful functions Google Analytics offers
120 stars 67 forks source link

MonsterInsights

The best Google Analytics Integration for WordPress. Period.
Plugin Version Total Downloads WordPress Compatibility Minimum PHP Version License Build Status Code Intelligence Status Scrutinizer Code Quality Codacy Badge

Contributions

Anyone is welcome to contribute to MonsterInsights. Please read the guidelines for contributing to this repository.

There are various ways you can contribute:

  1. Raise an Issue on GitHub
  2. Send us a Pull Request with your bug fixes and/or new features
  3. Provide feedback and suggestions on enhancements

Bugs

If you find an issue, let us know here!

Support

This is a developer's portal for Google Analytics for WordPress by MonsterInsights and should not be used for support.

For the lite version please use monsterinsights.com Lite support.

For users of the pro version, please use the support form, located on the Support tab of the My Account page of our website (note: you must be logged in & have an active license to use this form).

Please report security issues to support@monsterinsights.com

Backwards Compatibility Guidelines for Developers

Note all functionality on the admin side of the plugin, including any php/js/css functions, class names, files (or filenames), hooks or otherwise will not be garunteed backwards compatibility as a general rule. Our admin code is subject to change at any time without warning. As MonsterInsights is a frontend focused plugin, we're not too sure why you'd be building stuff with our backend code anyways. If you for some reason do need to use our backend code (anything located in admin or enqueued only in admin), please contact us with your usecase so we can adjust this policy and ensure your code will not break in the future.

For the frontend, we will not garuntee that the JS output will always be the same, nor can we, as we will adjust it over time to ensure continued Google Analytics compatibility and add features. However, we will garuntee the backwards compatibility of any hooks (filters or actions) found exclusively in the lite/includes/frontend, pro/includes/frontend, and includes/frontend directories to the best of our abilities. These hooks are documented as such. Any sort of future breakage will be announced well in advance of any changes, and we'll try to never break anyone's use of these hooks.

Code Styling Documentation

MonsterInsights adheres to the WordPress core PHP standard with a couple deviations noted below. See https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/ for information on documenting using this standard.

Deviations

Additions

Language Translations, Textdomains, and Internationalization

MonsterInsights is translation ready. Thanks to an extensive team of .org translators, much of the plugin is available translated into a wide variety of languages.

What Textdomain to Use

In googleanalytics-premium.php and in the /pro/ folder only use ga-premium. Everywhere else use google-analytics-for-wordpress.

MonsterInsights Lite uses WordPress.org provided translation files. MonsterInsights Pro loads the Lite translation files for files shared with Lite, and also loads Pro-only translation files for the Pro-only files. These files are created automatically from Pro translations. The latest copy of these files are pulled down and deployed with each Pro release.

How To Contribute Translations

Via the WordPress.org translation system located here.

I've found a non-translatable string that a user can see. What should I do?

Please open a issue for it.

Automation and External Libraries

A project goal of MonsterInsights, is to embrace automation whenever possible.

The MonsterInsights project taskrunner standard is Robo, and tasks for this project can be found in RoboFile.php (not available to public), and executed via: robo {command}

The entire deployment process, the thing that makes a new MonsterInsights version and releases it, is completely automated (no human interaction required) via Robo.

The MonsterInsights project dependency management system is Composer. Please make sure you don't accidentily override our composer file in your PRs.

We also use Node/NPM to manage packages used by our plugin primarily for admin styling and functionality.

We generally will always use the latest stable version of any Composer or NPM dependency, pulled and packaged during our automated release process, when possible. Some reasons we might use an out of date package include (but are not limited to):

When possible, we will always override/prefix all CSS rules, JS functions, and PHP class and function names in the dependencies we include when possible. With ~2 million active installs, not doing so is not an option (too many badly coded plugins out there). This process is completely automated, and done on release, between the step when composer/npm brings down the latest dependency versions, and when the zip files are autogenerated.

When possible, we will also minify all JS/CSS files from dependencies into a single file that gets used, except when there's compatibility issues, or if there's a bug in the parser of the CSS/JS minifier we use.

Warning About Package Managing MonsterInsights

We do not maintain, nor have any current plans, to allow our plugin to be installed via Composer, Packagist, or other similar systems.

We also do not recommend you via direct code or a management system (such as via a GitHub repo download Composer package), assume our plugin, on any branch, will be the current and/or stable branch of our plugin.

The only official and maintained source of our plugin is on WordPress.org for the Lite version, and from the My Account area (or via the automatic updates) for the Pro version.

Development Checkout Procedure

composer install cd assets npm update

Constants

The following constants can be defined in a wp-config file to allow for sections of MonsterInsights to be turned on and off across an installation base (and also for unit testing)

Both Pro & Lite

Plugin defined:

User defined:

Lite Only

Pro Only