File size: 1,139 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import { mayWeTrackByTracker } from '../tracker-buckets';
/**
* We'll be accessing rdt from the window object. These definitions are homemade and not from Reddit (not documented, as the example script is JS),
* but they make the validation happy.
*/
declare global {
interface Window {
rdt: any[] & { ( ...args: any[] ): void };
}
}
/**
* Tracks a lead (free trial) in Reddit.
*/
export const redditTrackerFreeTrialStarted = ( trial_flow_name: string ): void => {
if ( ! mayWeTrackByTracker( 'reddit' ) ) {
return;
}
const params = {
products: [
{
id: 'wpcom_creator_trial',
name: trial_flow_name,
category: 'free_trial',
},
],
};
window.rdt( 'track', 'SignUp', params );
};
/**
* Tracks a lead (free trial) in third-party trackers. `flow_name` is the name of the flow the user is coming from, e.g.
* "new-hosted-site", which can be supplied to the third-party trackers to identify different flows (depending on the analytics)
* provided by the third-party.
*/
export const recordFreeHostingTrialStarted = ( flow_name: string ) => {
// Reddit.
redditTrackerFreeTrialStarted( flow_name );
};
|