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

Jetpack: Add coupon event properties to My Plan Partner Banner component #22705

Merged
merged 10 commits into from
Feb 7, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@ import { imagePath } from 'constants/urls';
import './style.scss';

const MyPlanBanner = props => {
const { productSlug, action, title, tagLine, trackingId } = props;
const { additionalEventProperties, productSlug, action, title, tagLine, trackingId } = props;

useEffect( () => {
analytics.tracks.recordEvent( 'jetpack_my_plan_banner_view', {
type: trackingId,
...additionalEventProperties,
} );
}, [ trackingId ] );
}, [ additionalEventProperties, trackingId ] );

const trackActionClick = useCallback( () => {
analytics.tracks.recordJetpackClick( {
target: trackingId,
feature: 'my-plan-banner',
page: 'my-plan',
...additionalEventProperties,
} );
}, [ trackingId ] );
}, [ additionalEventProperties, trackingId ] );

return (
<div className="jp-my-plan-banner">
Expand All @@ -51,9 +53,10 @@ const MyPlanBanner = props => {
};

MyPlanBanner.propTypes = {
action: PropTypes.element.isRequired,
productSlug: PropTypes.string.isRequired,
trackingId: PropTypes.string.isRequired,
action: PropTypes.element.isRequired,
additionalEventProperties: PropTypes.object,
tagLine: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node, PropTypes.element ] ),
title: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node, PropTypes.element ] ),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const MyPlanPartnerCoupon = ( { partnerCoupon, siteRawUrl } ) => {
partnerCoupon.product.title
) }
trackingId="jetpack-partner-coupon"
additionalEventProperties={ {
coupon: partnerCoupon.coupon_code,
} }
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Adding a new event property to a component that has not yet been shipped with Jetpack so it has no backwards impact