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

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Forms: Added tracking for plugin installations.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -50,8 +51,15 @@ const CRMPluginIsInstalling = ( { isActivating } ) => {
};

const CRMPluginIsNotInstalled = ( { installAndActivateCRMPlugin, isInstalling } ) => {
const { tracks } = useAnalytics();
let button = (
<Button variant="secondary" onClick={ installAndActivateCRMPlugin }>
<Button
variant="secondary"
onClick={ () => {
tracks.recordEvent( 'jetpack_forms_crm_plugin_install_click' );
installAndActivateCRMPlugin();
} }
>
{ __( 'Install Jetpack CRM', 'jetpack-forms' ) }
</Button>
);
Expand All @@ -75,18 +83,25 @@ const CRMPluginIsNotInstalled = ( { installAndActivateCRMPlugin, isInstalling }
};

const CRMPluginIsInstalled = ( { activateCRMPlugin, isInstalling } ) => {
const { tracks } = useAnalytics();
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.

'jetpack-forms'
) }
</em>
<br />
{ isInstalling && <CRMPluginIsInstalling isActivating /> }
{ ! isInstalling && (
<Button variant="secondary" onClick={ activateCRMPlugin }>
<Button
variant="secondary"
onClick={ () => {
tracks.recordEvent( 'jetpack_forms_crm_plugin_activate_click' );
activateCRMPlugin();
} }
>
{ __( 'Activate the Jetpack CRM plugin', 'jetpack-forms' ) }
</Button>
) }
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -33,6 +33,7 @@ const CreativeMailPluginIsNotInstalled = ( {
installAndActivateCreativeMailPlugin,
isInstalling,
} ) => {
const { tracks } = useAnalytics();
return (
<p className="jetpack-contact-form__integration-panel">
<em style={ { color: 'rgba(38, 46, 57, 0.7)' } }>
Expand All @@ -43,7 +44,13 @@ const CreativeMailPluginIsNotInstalled = ( {
<br />
{ isInstalling && <CreativeMailPluginIsInstalling /> }
{ ! isInstalling && (
<Button variant="secondary" onClick={ installAndActivateCreativeMailPlugin }>
<Button
variant="secondary"
onClick={ () => {
tracks.recordEvent( 'jetpack_forms_creativemail_plugin_install_click' );
installAndActivateCreativeMailPlugin();
} }
>
{ __( 'Install Creative Mail plugin', 'jetpack-forms' ) }
</Button>
) }
Expand All @@ -53,6 +60,7 @@ const CreativeMailPluginIsNotInstalled = ( {
};

const CreativeMailPluginIsInstalled = ( { activateCreativeMailPlugin, isInstalling } ) => {
const { tracks } = useAnalytics();
return (
<p className="jetpack-contact-form__integration-panel">
<em>
Expand All @@ -64,7 +72,13 @@ const CreativeMailPluginIsInstalled = ( { activateCreativeMailPlugin, isInstalli
<br />
{ isInstalling && <CreativeMailPluginIsInstalling isActivating /> }
{ ! isInstalling && (
<Button variant="secondary" onClick={ activateCreativeMailPlugin }>
<Button
variant="secondary"
onClick={ () => {
tracks.recordEvent( 'jetpack_forms_creativemail_plugin_activate_click' );
activateCreativeMailPlugin();
} }
>
{ __( 'Activate Creative Mail Plugin', 'jetpack-forms' ) }
</Button>
) }
Expand All @@ -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' ) }
<br />
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.

<ExternalLink href={ getCreativeMailPluginUrl() }>
{ __( 'Open Creative Mail settings', 'jetpack-forms' ) }
Expand Down
Loading