• Stars
    star
    120
  • Rank 295,076 (Top 6 %)
  • Language
    PHP
  • Created about 11 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Add Google Analytics to WordPress and be able to use all the powerful functions Google Analytics offers

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 [email protected]

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

  • Use elseif, not else if
    • In MonsterInsights, use else if as we do not permit use of the colon form of if else, rendering Core's reason for this rule null. Colon forms of if else are harder for text editors such as Sublime Text to parse the opening and closing of conditional logic, and thus are not permitted.
  • Avoid regular expressions wherever possible
    • Regular expressions make it more difficult for new contributors to contribute. Thus whenever possible, regular expressions should be avoided.
  • Yoda Conditions
    • Code should never be written where a variable is being non-strictly compared to true or false. Use the appropriate way of writing the if statement. if ( true == $var ) is equivolent to if ( $var ) and the latter is much easier to read. However when strict comparison is required (===), one should use if ( true === $var ).

Additions

  • Required: Code should be formatted using tabs, set to size of 4 spaces
    • 4 spaces per tab is the universally accepted default tab size. Tabs are easier to read through in most editors. Additionally, they take up less file space than 4 spaces.
  • Required: Filter and function names should use underscores, not dashes
    • For consistency, all filter and functions should use underscores not dashes or CamelCasing when seperating words. Additionally, all filter and (functions not in a class) names should be preceeded by monsterinsights_. The only exception to this is filters that need to be pro or lite only, in which case they should be proceeded by monsterinsights_pro_ and monsterinsights_lite_ respectively. Functions in a class should not be preceeded by monsterinsights_.
  • Required: Hooks tied to a function not within a class, will be tied to the function after the end of the function's declaration
    • Since MonsterInsights requires all functions have a function docbloc immediately preceeding the declaration of a function, to make it easier to locate hooks tied to a function, the add_action or add_filter call(s) to a function shall be placed immediately after the end of a function declaration. For functions in classes, this rule does not apply as it is impossible to do this.
  • Recommended: Use pre-increments (++i) instead of post-increments (i++)
    • The former is more performant as it does not require a copy of the variable to be made. This rule is not strictly enforced, and where it detracts from the readability or simplicity of code, it should be ignored.
  • Recommended: Where possible avoid stored data changes
    • This plugin has a lot of active installs. As such, whereever possible, we should try to avoid requiring an upgrade routine to convert stored data. Having a routine that adds data to make something more performant is fine as long as it either falls back to existing data, a smart default, or stops execution (in a controlled manner).

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):

  • Lack of PHP version support
  • A bug in the current version of the dependency that affects our plugin's use of the dependency
  • Lack of time to test the current version of the dependency before the release of our plugin
  • A security issue, which may or may not be public
  • A compatibility issue between a dependency and a different dependency
  • A change in the dependency that affects MonsterInsights's ability to be conflict-free with other plugins
  • and so forth

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:

  • MONSTERINSIGHTS_VERSION
    • The version of pro/lite installed
  • MONSTERINSIGHTS_PLUGIN_NAME
    • The name of the plugin
  • MONSTERINSIGHTS_PLUGIN_SLUG
    • The slug of this plugin
  • MONSTERINSIGHTS_PLUGIN_FILE
    • The name of this file
  • MONSTERINSIGHTS_PLUGIN_DIR
    • Path to the MI base folder
  • MONSTERINSIGHTS_PLUGIN_URL
    • URL to the MI base folder

User defined:

  • MONSTERINSIGHTS_LICENSE_KEY
    • MonsterInsights license key to use as the fallback (please use auth though not this, as you can do this on the network panel now on multisites)
  • MONSTERINSIGHTS_FORCE_ACTIVATION
    • Override the WP version activation check. Use at your own risk.
  • MONSTERINSIGHTS_AIRPLANE_MODE
    • For future use. Currently does nothing. Useful for local site testing.
  • MONSTERINSIGHTS_GA_UA
    • Don't use oAuth or the wizard, but hardcode to use UA. Note, this will not allow backend reports to work. You can also use the filter monsterinsights_get_ua.
  • MONSTERINSIGHTS_MULTISITE_GA_UA.
    • You can use this constant to force the same the same UA for all subsites of an MS install. Note, this will not allow backend reports to work.

Lite Only

  • MONSTERINSIGHTS_LITE_VERSION
    • The version of lite installed

Pro Only

  • MONSTERINSIGHTS_PRO_VERSION
    • The version of pro installed

More Repositories

1

easy-digital-downloads

Sell digital downloads through WordPress
PHP
864
star
2

all-in-one-seo-pack

All in One SEO plugin for WordPress SEO
JavaScript
336
star
3

one-click-demo-import

One Click Demo Import plugin
PHP
194
star
4

edd-library

EDD Code Snippet Library
HTML
141
star
5

Transients-Manager

Provides a UI to manage your site's transients. You can view, search, edit, and delete transients at will.
PHP
92
star
6

simplemap

SimpleMap is an easy-to-use international store locator plugin that uses Google Maps to display information directly on your WordPress site.
PHP
63
star
7

EDD-License-handler

License / updater handler for Easy Digital Downloads extensions
55
star
8

WP-Mail-SMTP

The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 3 million sites.
PHP
55
star
9

wp-mail-logging

✉️ Logs each email sent by WordPress.
PHP
50
star
10

EDD-Extension-Boilerplate

A foundation for EDD extension development that aims to provide a standardized guide for building extensions.
PHP
50
star
11

sugarcalendar-core

Sugar Calendar plugin for WordPress
PHP
38
star
12

edd-themedd

WordPress theme for Easy Digital Downloads
PHP
33
star
13

wp-simple-pay-lite

Add high conversion Stripe payment forms to your WordPress site in minutes.
PHP
31
star
14

EDD-bbPress-Support

PHP
30
star
15

wp-simple-pay-snippet-library

Code snippets for customizing and extending WP Simple Pay.
PHP
29
star
16

EDD-Digital-Store

Digital Store WordPress Theme for Easy Digital Downloads
PHP
26
star
17

edd-vendd

Vendd is a full-featured marketplace theme for Easy Digital Downloads and supporting extensions.
PHP
25
star
18

persistent-dismissible

Utility PHP class to simplify interacting with persistent dismissible WordPress notices, promos, and banners
PHP
22
star
19

Simple-Post-Expiration

A simple plugin that allows you to set an expiration date on posts. Once a post is expired, "Expired" will be prefixed to the post title.
PHP
18
star
20

gravity-forms-help-scout-search

Custom plugin that creates the search form on our new ticket submission page
JavaScript
16
star
21

wp101plugin

WP101 Plugin
PHP
16
star
22

Featured-Comments

PHP
13
star
23

claws

A library for building standardized SQL clauses used in custom WordPress database queries.
PHP
12
star
24

EDD-CSV-Manager

CSV Product Manager for EDD
PHP
12
star
25

wpforms-phpcs

PHP Coding Standards used by the WPForms team.
PHP
11
star
26

sugarcalendar-icalendar-to-php

Parse an iCalendar URI, with PHP, into some useful format
PHP
9
star
27

edd-purchase-rewards

Increase sales and build customer loyalty by rewarding customers
PHP
9
star
28

edd-shop-front

Shop Front was designed to be simple, responsive and lightweight. It has only the bare essentials, making it the perfect starting point for your next digital e-commerce store. It’s also easily extensible with a growing collection of add-ons to enhance the functionality and styling.
PHP
9
star
29

edd-optinmonster-discounts

Allows you to generate a discount code and send it to the email address when a user submits their email through OptinMonster
PHP
7
star
30

edd-downloads-as-services

PHP
7
star
31

wp-tally

WP Tally plugin for counting the number of downloads of a user's WordPress.org plugins
PHP
7
star
32

edd-add-to-cart-redirect

PHP
7
star
33

edd-api-docs

API Documentation for Easy Digital Downloads
6
star
34

sugarcalendar-addon-sdk

A boilerplate plugin to help facilitate the creation of Sugar Calendar add-ons
PHP
6
star
35

edd-recurring-payments-pmcs

Easy Digital Downloads - Recurring Payments - Prevent Multiple Cart Subscriptions
PHP
6
star
36

edd-remove-german-subscriptions

Removes subscription flags so that German customers are not shown an error when purchasing through PayPal
PHP
6
star
37

file-upload-types

Manage the types of files that can be uploaded to your WordPress site.
PHP
5
star
38

edd-ban-emails

Allows you to place emails in a banned list. These emails will not be allowed to make purchases
PHP
5
star
39

pippinsplugins-custom-functions

Custom functions plugin for pippinsplugins.com
PHP
5
star
40

happiness-reports-for-help-scout

PHP
4
star
41

ninjaforms-edd-checkout

PHP
4
star
42

edd-fes-product-updates

Connects the Product Updates extension to Frontend Submissions to allow vendors to send email updates to their customers.
PHP
4
star
43

edd-mailchimp-subscriber-count

PHP
4
star
44

EDD-Recount-Earnings

Allows you to recalculate the earnings of products in EDD. Useful if product earnings get off somehow
PHP
4
star
45

edd-license-free-download

PHP
3
star
46

wp-gdpr-edd-addon

Integrates with the WP GDPR Compliance plugin: https://wordpress.org/plugins/wp-gdpr-core/
PHP
3
star
47

edd-sl-renew-all-keys

A small add-on plugin for Software Licensing that adds an option for customers to renew all license keys at once
PHP
3
star
48

insert-headers-and-footers

Insert Headers and Footers Plugin
PHP
3
star
49

EDD-WPCourseware

PHP
3
star
50

edd-status-board

PHP
3
star
51

bbPress-Topic-Subscribers

Shows people subscribed to a topic and lets admins remove them as a sidebar widget
PHP
3
star
52

edd-attach-accounts-to-orders

Attach users to orders! Take guest purchases and attach them to existing accounts automatically. Optionally create accounts for users that don't have one automatically.
PHP
3
star
53

EDD-Knowledge-Base

PHP
3
star
54

edd-helpscout-chrome-extension

JavaScript
3
star
55

edd-recurly

Recur.ly payment gateway for Easy Digital Downloads
PHP
3
star
56

searchwp-library

Useful SearchWP code snippets
PHP
3
star
57

awesome-blocks

JavaScript
3
star
58

EDD-Pricing-Select

Converts EDD variable pricing from radio buttons to a dropdown
PHP
2
star
59

EDD-Variable-Defaults

Allows site owners to define standardized defaults for variable prices.
PHP
2
star
60

EDD-PayPal-Shipping-Address

Tells PayPal to collect a shipping address for EDD purchases
PHP
2
star
61

EDD-Hide-Button-Prices

Very simple plugin to remove the prices from product purchase buttons on Easy Digital Downloads.
PHP
2
star
62

edd-shoppette

A beautiful, elegant, versatile theme for Easy Digital Downloads
CSS
2
star
63

bbPress-Lock-Resolved-Topics

Disables the ability for non-topic authors to reply to a forum thread once it's resolved
PHP
2
star
64

EDD-FES-Honey-Pot

Adds a honey pot field to the registration and vendor contact forms in the Frontend Submissions plugin for Easy Digital Downloads
PHP
2
star
65

wp-tally-connect

A plugin to display a users' WordPress.org plugin download count on their website.
PHP
2
star
66

edd-product-updates

PHP
2
star
67

EDD-SL-Reassign

WIP Tool to help reassign a Software Licensing Key to a new price ID when it's been deleted or recreated
PHP
2
star
68

EDD-Product-Badges

Allows site operators to add 'badges' to products on their EDD-powered website
PHP
2
star
69

edd-add-discount-to-payment

This plugin for Easy Digital Downloads adds the option to update the discount code recorded on a purchase record.
PHP
1
star
70

EDD-Vault

PHP
1
star
71

edd-codex

Easy Digital Downloads Codex
HTML
1
star
72

exactmetrics-repo

ExactMetrics is one of the largest Google Analytics plugins for WordPress
PHP
1
star
73

EDD-UserPro-Embed

PHP
1
star
74

EDD-Payment-Icons-Widget

PHP
1
star
75

convertkit

An API wrapper for ConvertKit
PHP
1
star
76

edd-addon-tools

PHP
1
star
77

edd-envato-integration

EDD Envato is a slick way to offer discounts and fast registration on your Easy Digital Downloads site for your Envato customers.
PHP
1
star
78

sugarcalendar-metabox-section

A simple example of how to create a custom metabox section
PHP
1
star
79

Twenty-Twelve-EDD

Forked version of Twenty Twelve for Easy Digital Downloads with product grids
PHP
1
star
80

edd-quota

Quota is a simple, bold, elegant theme for use with Easy Digital Downloads.
CSS
1
star
81

in-app-browser-escape

WordPress plugin that prompts site visitors using mobile in-app browsers to open a link in external browser.
PHP
1
star
82

pushengage-ios-sdk

The official PushEngage iOS SDK
Swift
1
star
83

edd-session-cleanup

Provides a tool to cleanup old sessions from the database. This can be useful for situations where the cron job has been failing.
PHP
1
star
84

edd-mixpanel

Mixpanel tracking for Easy Digital Downloads
PHP
1
star
85

sugarcalendar-icalendar-rrule-sequencer

Parse an iCalendar RRULE into an array of dtstart, dtend, sequence, and recurrence-id attributes
PHP
1
star