modmore / BigBrother

A Google Analytics CMP for MODx Revolution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Big Brother

Big Brother is a collection of MODX dashboard widgets that show you key insights from Google Analytics.

Originally developed by @lossendae in 2011, Big Brother was adopted by modmore in 2015 and completely rebuilt in 2021 to support Google Analytics 4 properties.

Licensed as MIT, so you're free to use and adapt Big Brother. Donations to support our open source work are much appreciated, as are pull requests that improve or add to the widgets.

Compatibility

Big Brother v3 is the current version and available from modmore.com and MODX.

Due to Google's deprecation of the out-of-band authorizations, new users must use v3 after October 3rd, 2022. v1 and v2 are considered deprecated as of August 27th 2022.

Please note that unlike v2, v3 does not support custom OAuth credentials anymore.

Learn more about the v1 and v2 deprecations and end-of-life dates in the v3 announcement.

Version Status Google Analytics MODX Available from
3.0+ (3.x branch) Active development 4 ("Google Analytics 4") 2.8+, 3.0.0-alpha3+ modmore.com (rc)
2.0+ (2.x branch) Deprecated, end-of-life on October 3rd, 2022 4 ("Google Analytics 4") 2.8+, 3.0.0-alpha3+ modmore.com, modx.com
1.5+ (1.x branch) Deprecated, end-of-life on July 1st, 2023 3 ("Universal Analytics") 2.7+, no MODX 3 modmore.com, modx.com
< 1.5 End-of-life 3 ("Universal analytics") 2.2+, no MODX 3 modx.com

Upgrading from v2 to v3

When first upgrading from v2 to v3, your existing oauth credentials (bigbrother.native_app_client_id and bigbrother.native_app_client_secret) will continue to be used, and you should not have to re-authorize immediately.

The next time you either revoke the authorization or it fails and must be re-authorized, you will be upgraded to the new oauth flow with new credentials (bigbrother.oauth_client_id and bigbrother.oauth_client_secret).

In v3, it is not possible to use custom oauth credentials anymore. This is because we're using an authorization proxy to initialise the authentication on your behalf, and that cannot do so with custom credentials.

If adding support for custom authorization proxies is something you'd be interested in sponsoring, please reach out.

What's this about an authorization proxy? Is it safe?

The authorization proxy runs on modmore.com and acts as an intermediate for the oauth redirects. You're authorizing modmore.com to access your Google Analytics profiles, which then asks you to confirm if you want to share that access with the site that initiated the authorization.

Only requests with the modmore-provided bigbrother.oauth_client_id can use the proxy. Once authorized, it will ask you to confirm you want to share the access with the specific site as an extra precaution.

It's worth noting that while modmore receives the authorization code (which can be used once to create a long-lived refresh token to access your account), it does not store nor claim it. The authorization code is only kept in memory briefly until you confirm you wish to share it with the specific site. As authorization codes are single use, you can confirm this without needing access to the server-side code by reviewing core/components/bigbrother/controllers/authorize.class.php which takes in the code and turns it into the refresh token; that would not be possible if the proxy were to use the token.

Usage

After installing the package, a selection of new dashboard widgets are available to you.

  • In MODX 2.x, navigate to system > dashboards, create a new dashboard (if you don't already have one), and add the widgets you'd like to use. Go to System > Access Control Lists, right click and update your user group, and set the dashboard you just created. Navigate to the manager dashboard and find the link to start the authorization process in the widget you just added.
  • In MODX 3.x, use the Add button in the top right of the manager dashboard to add any widgets you'd like to use. The manager will refresh and show you the link to start the authorization process.

Development

Create a config.core.php file in the root of the project to connect it to your MODX installation, and a _build/build.config.php with oAuth credentials.

In core/components/bigbrother/ run composer install to download PHP dependencies.

Run php _bootstrap/index.php to initialize settings, namespaces, and widgets into your MODX development site.

In assets/components/bigbrother/ run npm install to download client dependencies. Run npm run build:js to build the compressed javascript files. Enable the bigbrother.scripts_dev system setting to use the uncompressed javascript files.

When sending pull requests, please follow the current code standards. If you'd like to know if an idea is likely to be accepted before spending time on it, please open an issue.

Credits

About

A Google Analytics CMP for MODx Revolution


Languages

Language:PHP 75.8%Language:JavaScript 18.4%Language:CSS 5.8%Language:Smarty 0.0%