From ef8a09b3244fd43b139a3e7f09221786f0244262 Mon Sep 17 00:00:00 2001 From: Erick Danzer Date: Tue, 11 Feb 2025 14:39:08 -0700 Subject: [PATCH 1/3] Add tracking for plugin install from Jetpack forms --- ...k-crm-integration-settings-plugin-state.js | 21 +++++++++++++++--- ...etter-integration-settings-plugin-state.js | 22 +++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js b/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js index f12a4cf58c657..9df78b23a01f3 100644 --- a/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js +++ b/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js @@ -1,3 +1,4 @@ +import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; import { Button, Icon, ToggleControl } from '@wordpress/components'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; @@ -50,8 +51,15 @@ const CRMPluginIsInstalling = ( { isActivating } ) => { }; const CRMPluginIsNotInstalled = ( { installAndActivateCRMPlugin, isInstalling } ) => { + const { tracks } = useAnalytics(); let button = ( - ); @@ -75,18 +83,25 @@ const CRMPluginIsNotInstalled = ( { installAndActivateCRMPlugin, isInstalling } }; const CRMPluginIsInstalled = ( { activateCRMPlugin, isInstalling } ) => { + const { tracks } = useAnalytics(); return (

{ __( - 'You already have the Jetpack CRM plugin installed, but it’s not activated.', + "You already have the Jetpack CRM plugin installed, but it's not activated.", 'jetpack-forms' ) }
{ isInstalling && } { ! isInstalling && ( - ) } diff --git a/projects/packages/forms/src/blocks/contact-form/components/jetpack-newsletter-integration-settings-plugin-state.js b/projects/packages/forms/src/blocks/contact-form/components/jetpack-newsletter-integration-settings-plugin-state.js index 3608157a7607e..1653997832af6 100644 --- a/projects/packages/forms/src/blocks/contact-form/components/jetpack-newsletter-integration-settings-plugin-state.js +++ b/projects/packages/forms/src/blocks/contact-form/components/jetpack-newsletter-integration-settings-plugin-state.js @@ -1,4 +1,4 @@ -import { getJetpackData } from '@automattic/jetpack-shared-extension-utils'; +import { getJetpackData, useAnalytics } from '@automattic/jetpack-shared-extension-utils'; import { Button, ExternalLink, Icon } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { get } from 'lodash'; @@ -33,6 +33,7 @@ const CreativeMailPluginIsNotInstalled = ( { installAndActivateCreativeMailPlugin, isInstalling, } ) => { + const { tracks } = useAnalytics(); return (

@@ -43,7 +44,13 @@ const CreativeMailPluginIsNotInstalled = ( {
{ isInstalling && } { ! isInstalling && ( - ) } @@ -53,6 +60,7 @@ const CreativeMailPluginIsNotInstalled = ( { }; const CreativeMailPluginIsInstalled = ( { activateCreativeMailPlugin, isInstalling } ) => { + const { tracks } = useAnalytics(); return (

@@ -64,7 +72,13 @@ const CreativeMailPluginIsInstalled = ( { activateCreativeMailPlugin, isInstalli
{ isInstalling && } { ! isInstalling && ( - ) } @@ -81,7 +95,7 @@ const CreativeMailPluginIsActive = () => { return (

- { __( 'You’re all setup for email marketing with Creative Mail.', 'jetpack-forms' ) } + { __( "You're all setup for email marketing with Creative Mail.", 'jetpack-forms' ) }
{ __( 'Open Creative Mail settings', 'jetpack-forms' ) } From 4d2cda8f948a8cdeea5c0ee53c88da94fa8f1f61 Mon Sep 17 00:00:00 2001 From: Erick Danzer Date: Tue, 11 Feb 2025 14:40:10 -0700 Subject: [PATCH 2/3] changelog --- .../forms/changelog/update-forms-tracking-plugin-installs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/packages/forms/changelog/update-forms-tracking-plugin-installs diff --git a/projects/packages/forms/changelog/update-forms-tracking-plugin-installs b/projects/packages/forms/changelog/update-forms-tracking-plugin-installs new file mode 100644 index 0000000000000..ff5eb99a4d594 --- /dev/null +++ b/projects/packages/forms/changelog/update-forms-tracking-plugin-installs @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Forms: Added tracking for plugin installations. From 89d646cca8ddde6862053adaeab1a76f53ed3dd5 Mon Sep 17 00:00:00 2001 From: Erick Danzer Date: Tue, 11 Feb 2025 15:13:59 -0700 Subject: [PATCH 3/3] Update Track event names --- .../jetpack-crm-integration-settings-plugin-state.js | 4 ++-- .../jetpack-newsletter-integration-settings-plugin-state.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js b/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js index 9df78b23a01f3..55681d8381aa5 100644 --- a/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js +++ b/projects/packages/forms/src/blocks/contact-form/components/jetpack-crm-integration/jetpack-crm-integration-settings-plugin-state.js @@ -56,7 +56,7 @@ const CRMPluginIsNotInstalled = ( { installAndActivateCRMPlugin, isInstalling }