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

Forms: Add tracking for plugin installs #41732

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

edanzer
Copy link
Contributor

@edanzer edanzer commented Feb 11, 2025

Fixes #2254
Replaces #41695 and #41705

Proposed changes:

Adds Tracks events when users click to install or activate either Jetpack CRM or Creative Mail from the contact form block sidebar. I copied the pattern we use for tracking Stripe clicks in the payment button blocks (see here).

In one of the other PRs @enejb suggested avoiding code duplication by putting the tracking in the installAndActivatePlugin method. But (a) we'd still need to add the changes twice in that method and the activatePlugin method and (b) we need to know the source of a plugin install or activation, not just that it happened.

My other approach also didn't do (b), which is why I've prepared this this as an alternative.

jetpack-forms-crm-button

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

None.

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

Yes.

Testing instructions:

Preparation:

  • Tracks Vigilante: You will need to ensure you can see Tracks events as they are fired. The best way is to install Tracks Vigilante here: https://github.com/Automattic/tracks-chrome-extension Once installed, you'll be able to see tracks events in the Chrome toolbar.
  • Jetpack CRM Plugin. Deactivate and delete Jetpack CRM if you have it installed as a separate plugin.
  • Creative Mail Plugin. Deactivate and delete this if you have it installed as a separate plugin.

Test:

  • Go to a page or post and insert a form block.
  • Clear all current tracks events from Tracks Vigilante to make it easier to see new events.
  • Go to the contact form block sidebar and click the button to install Jetpack CRM.
  • Confirm that the jetpack_form_crm_plugin_install_click Tracks event is fired.
  • Also in the sidebar click the button to install Creative Mail.
  • Confirm that the jetpack_forms_creativemail_plugin_install_click Tracks event is fired.
  • Go to your site's plugin page and deactivate both plugins but leave the installed.
  • Return to your post with your contact form, refresh the page if needed, go to the contact form block sidebar, and click the buttons the activate Jetpack CRM and Creative Mail again.
  • Confirm that the jetpack_forms_crm_plugin_activate_click and jetpack_forms_creativemail_plugin_activate_click Tracks events iare fired.

@edanzer edanzer added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Contact Form [Status] Needs Tracks Review Added/removed/modified a tracks event. [Status] Needs Team Review labels Feb 11, 2025
@edanzer edanzer requested a review from a team February 11, 2025 21:49
@edanzer edanzer self-assigned this Feb 11, 2025
Copy link
Contributor

github-actions bot commented Feb 11, 2025

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 update/forms-tracking-plugin-installs branch.

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

    bin/jetpack-downloader test jetpack update/forms-tracking-plugin-installs
    

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

return (
<p className="jetpack-contact-form__crm_text jetpack-contact-form__integration-panel">
<em>
{ __(
'You already have the Jetpack CRM plugin installed, but its not activated.',
"You already have the Jetpack CRM plugin installed, but it's not activated.",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are unrelated to the PR, but were required by our commit checks.

@github-actions github-actions bot added [Block] Contact Form Form block (also see Contact Form label) [Package] Forms labels Feb 11, 2025
Copy link
Contributor

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!

@@ -81,7 +95,7 @@ const CreativeMailPluginIsActive = () => {
return (
<p>
<em>
{ __( 'Youre all setup for email marketing with Creative Mail.', 'jetpack-forms' ) }
{ __( "You're all setup for email marketing with Creative Mail.", 'jetpack-forms' ) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are unrelated to the PR, but were required by our commit checks.

Copy link
Contributor

github-actions bot commented Feb 11, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js 0/46 (0.00%) 0.00% 6 💔
projects/packages/forms/src/blocks/contact-form/components/jetpack-newsletter-integration-settings-plugin-state.js 0/25 (0.00%) 0.00% 6 💔

Full summary · PHP report · JS report

Add label I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. to override the failing coverage check.

Copy link
Member

@enejb enejb left a comment

Choose a reason for hiding this comment

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

The changes look good from my end.
Thanks for adding these events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Package] Forms [Status] Needs Team Review [Status] Needs Tracks Review Added/removed/modified a tracks event. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stats: add width and height attributes to tracking pixel image
2 participants