Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics: remove the module and switch to is_active flag #37960

Merged
merged 14 commits into from
Jul 25, 2024

Conversation

sergeymitr
Copy link
Contributor

@sergeymitr sergeymitr commented Jun 20, 2024

Proposed changes:

  • Remove the GA module from Jetpack.
  • Only show the UI in "Jetpack -> Settings -> Traffic" for WoA sites.
  • Only activate tracking if it's enabled.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

pfwV0U-4g-p2
https://github.com/Automattic/vulcan/issues/366

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

Self-Hosted Site

  1. Connect Jetpack. If reusing a site, delete the option: jetpack docker wp option delete jetpack_wga
  2. Go to "Jetpack -> Settings -> Traffic", confirm that the "Google Analytics" card does not show up.
  3. Go to Calypso "Tools -> Marketing -> Traffic" page, confirm the "Google" card does not show up.
  4. Install and activate the GA Legacy plugin (use the jetpack-legacy-google-analytics.zip file): https://github.com/Automattic/jetpack-legacy-google-analytics/releases/tag/v1.0.0
  5. Go back to "Plugins", find the plugin "Jetpack Legacy Google Analytics", and click on its "Settings" link.
  6. The Calypso "Tools -> Marketing -> Traffic" page will load. Find the "Google" card, and click "Connect your site to Google Analytics" to purchase the required plan.
  7. After checkout, go back to that Calypso page. Confirm the GA card now shows up, and GA is disabled.
  8. Activate it by clicking "Add Google". When the form unfolds, enter a measurement ID (e.g. G-12345).
  9. Click "Save settings". Check the Jetpack option and confirm it got saved: wp option get jetpack_wga.
  10. Reload the page, confirm the measurement ID persists.
  11. Load the website frontend, confirm the measurement ID is in the source code.
  12. Deactivate Google Analytics in Calypso. Confirm the tracking code and the measurement ID are no longer added to the source code.

WoA Sites

  1. Use a WoA site, checkout the branch via Jetpack Beta.
  2. Go to "Jetpack -> Dashboard -> Settings -> Traffic" (/wp-admin/admin.php?page=jetpack#/traffic, confirm the Google Analytics card shows up. Check the "Configure..." link, confirm it leads to proper page in Calypso (the one on step 3).
  3. Go to "Tools -> Marketing -> Traffic", confirm the "Google" Card shows up. Deactivate if active.
  4. Check the frontend, confirm Google Analytics code doesn't show up (search source code by "Google Analytics").
  5. Activate GA, enter a sample tracking code, click "Save".
  6. Check the frontend again, confirm the code shows up now.

Copy link
Contributor

github-actions bot commented Jun 20, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the delete/jetpack-module-google-analytics branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack delete/jetpack-module-google-analytics
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Admin Page React-powered dashboard under the Jetpack menu labels Jun 20, 2024
Copy link
Contributor

github-actions bot commented Jun 20, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for August 6, 2024 (scheduled code freeze on August 5, 2024).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@sergeymitr sergeymitr changed the title Google Analytics: remove the module and its remnants Google Analytics: remove the module and switch to is_active flag Jun 20, 2024
@sergeymitr sergeymitr added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels Jul 22, 2024
@sergeymitr sergeymitr requested a review from a team July 22, 2024 20:41
Copy link
Contributor

@coder-karen coder-karen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me on self-hosted and WoA!

I did test on Simple and my Simple site won't load with a fatal error though:

Fatal error: Uncaught Error: Failed opening required '/home/wpcom/public_html/wp-content/mu-plugins/jetpack-plugin/sun/modules/google-analytics.php' (include_path='.') in /home/wpcom/public_html/wp-content/mu-plugins/analytics.php:17 

So it looks like we need to change the path in wpcom/wp-content/mu-plugins/analytics.php to the mu-wpcom-plugin path instead, before this PR is merged.

@sergeymitr
Copy link
Contributor Author

Good catch @coder-karen, I'll look into it.

@sergeymitr sergeymitr added [Status] In Progress and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Jul 23, 2024
@sergeymitr sergeymitr added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels Jul 24, 2024
@sergeymitr
Copy link
Contributor Author

Hi @coder-karen
I fixed the Simple sites issues, can you please give it another look.

Copy link
Contributor

@coder-karen coder-karen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All works well for me, and Simple site loads 👍

@sergeymitr sergeymitr merged commit 8bd7416 into trunk Jul 25, 2024
58 checks passed
@sergeymitr sergeymitr deleted the delete/jetpack-module-google-analytics branch July 25, 2024 12:14
@github-actions github-actions bot removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Jul 25, 2024
@github-actions github-actions bot added this to the jetpack/13.7 milestone Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu [Feature] Google Analytics [Feature] WPCOM API [Focus] Jetstream [Package] Google Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants