Skip to content

Commit

Permalink
Jetpack: Add coupon event properties to My Plan Partner Banner compon…
Browse files Browse the repository at this point in the history
…ent (#22705)
  • Loading branch information
kallehauge authored Feb 7, 2022
1 parent 975d71f commit 01cddea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
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


0 comments on commit 01cddea

Please sign in to comment.