Skip to content

Commit

Permalink
make the QM interface clearer
Browse files Browse the repository at this point in the history
small refactor to the way the custom qm event string is constructed in the cancellation journey
  • Loading branch information
Richard Bangay committed Nov 7, 2024
1 parent 36ea865 commit b5d8d62
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
19 changes: 13 additions & 6 deletions client/components/mma/cancel/CancellationJourneyFunnel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ export const CancellationJourneyFunnel = () => {
const productTypeKey = productType.productType;

const possiblePaidPlan = productDetail.subscription.currentPlans[0];
const qmEventString = `cancellation start | ${productType.friendlyName}${
isPaidSubscriptionPlan(possiblePaidPlan)
? ` | billing period: ${possiblePaidPlan.billingPeriod}`
: ''
}`;
window.QuantumMetricAPI?.sendEvent(184, 0, qmEventString);
const qmEventId = 184;
const qmIsConversionEvent = 0;
const qmEvent = [
'cancellation start',
productType.friendlyName,
isPaidSubscriptionPlan(possiblePaidPlan) &&
`billing period: ${possiblePaidPlan.billingPeriod}`,
].filter(Boolean);
window.QuantumMetricAPI?.sendEvent(
qmEventId,
qmIsConversionEvent,
qmEvent.join(' | '),
);

if (
!routerState?.dontShowOffer &&
Expand Down
7 changes: 6 additions & 1 deletion shared/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export interface Globals extends CommonGlobals {
stripeKeyDefaultCurrencies?: StripePublicKeySet;
}
interface QuantumMetricAPIPartial {
sendEvent: (param1: number, param2: number, event: string) => void;
sendEvent: (
eventId: number | string,
conversion?: number | boolean,
eventValue?: number | string,
attributes?: Record<string, string | boolean | number | undefined>,
) => void;
}
declare global {
interface Window {
Expand Down

0 comments on commit b5d8d62

Please sign in to comment.