Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // if a user is logged in when he launched the app or he finished signing up or he logged in to his account, fire this line of code, insert the userId dynamically
- Analytics.setUserID("123456") // insert the user id like it appears in the database
- // if a user is logged in when it launched the app or he logged in to his account, fire this line of code, insert the user sub status type dynamically, if a user started his trial you can fire this line as well to reflect the change
- Analytics.setUserProperty("insert_user_sub_status", forName: "user_sub_status") // 'free trial', 'canceled', 'monthly', 'yearly', 'expired'
- // This event fires when a user starts the sign up (after he entered his email and clicks 'sign in/sign up'), only if he doesn't have an account with this email
- Analytics.logEvent("sign_up_started", parameters: [
- "method": "email/apple" as NSObject // the method of registration, if facebook is also an option, please include it here
- ])
- // This event fires when a user completes the signup
- Analytics.logEvent("sign_up_completed", parameters: [
- "method": "email/apple" as NSObject // the method of registration, if facebook is also an option, please include it here
- ])
- // if a user is logged in when he launched the app or he finished signing up or he logged in to his account, fire this line of code, insert the userId dynamically
- Analytics.setUserID("123456")
- // This event fires when a user clicks to start the survey
- Analytics.logEvent("survey_started", parameters: [
- "type": "mandatory" as NSObject // the survey on mobile is usually forced (a user cannot skip it)
- ])
- // This event fires when a user finishes the survey
- Analytics.logEvent("survey_finished", parameters: [
- "type": "mandatory" as NSObject, // the survey on mobile is usually forced (a user cannot skip it)
- "is_instructor" : "true/false" // if he checked the 'I am instructor' box then it's true
- ])
- // if the user checks the 'I am instructor' checkbox on the survey, save it as a user parameter
- Analytics.setUserProperty(is_instructor, forName: "true/false") // 'true' or 'false' depends on the answer, default value: "false"
- // This event fires when a user clicks on any button that redirects to starting a free trial
- Analytics.logEvent("cta_clicked")
- // This event fires when a user clicks to 'activate membership' if he is on a free trial or clicks on 'sign up' after his membership expired (not sure if this option is available on mobile, if it is available, please implement it)
- Analytics.logEvent("reactivation_initiated")
- // This event fires when a user finishes to 'activate membership' after his membership expired (not sure if this option is available on mobile (meaning if your app has this feature), if it is available, please implement it like I describe below)
- // Prepare purchase params
- var purchaseParams: [String: Any] = [
- AnalyticsParameterTransactionID: "T12345", // transaction id
- AnalyticsParameterAffiliation: "alomoves", // insert store name region here
- AnalyticsParameterCurrency: "USD", // leave static if user can only be charged with USD
- AnalyticsParameterValue: 14.98, // order total (excluding tax) (the amount the user paid when he activated the plan excluding tax)
- AnalyticsParameterTax: 2.58, // insert tax (if available or exist in the store)
- AnalyticsParameterCoupon: "SUMMER_FUN" // if coupon was applied to the order, include it here
- ]
- // Add items
- purchaseParams[AnalyticsParameterItems] = [ // an array with all products
- AnalyticsParameterItemID: "membership activated - monthly/annually", // monthly or annually depends on the plan the user chose
- AnalyticsParameterItemName: "membership activated - monthly/annually", // monthly or annually depends on the plan the user chose
- AnalyticsParameterPrice: 9.99, // insert an actual product price. Number or a string. Don't include currency code
- AnalyticsParameterQuantity: 1 // product quantity. leave static
- ]
- // Log purchase event
- Analytics.logEvent(AnalyticsEventPurchase, parameters: purchaseParams) // name of the event. In this case, it always must be AnalyticsEventPurchase
- // This event fires when a user chose a payment plan, captures the payment plan chosen.
- Analytics.logEvent("payment_plan_chosen", parameters: [
- "type": "monthly/annually" as NSObject // payment plan type
- ])
- // This event fires after a user placed his credit card information and paid on App Store and his trial started
- Analytics.logEvent("trial_started", parameters: [
- "name": "14 Days Trial - Annual/Monthly" as NSObject // Annual or Monthly depends on the trial he started
- ])
- // This event fires when a user has a class opened (on page load of a class)
- Analytics.logEvent("class_viewed", parameters: [
- "class": "insert_class_name_here" as NSObject, // insert the class name here
- "series": "insert_series_name_here" as NSObject, // insert the series name here
- "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert the intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here
- ])
- // This event fires when a user has a user saved a class (added to practice)
- Analytics.logEvent("class_saved", parameters: [
- "class": "insert_class_name_here" as NSObject, // insert the class name here
- "series": "insert_series_name_here" as NSObject, // insert the series name here
- "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert the intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here
- ])
- // This event fires when a user has a series opened (on page load of a series)
- Analytics.logEvent("series_viewed", parameters: [
- "category": "insert_category_here" as NSObject, // fitness, mindfulness, skills, yoga, set your intention
- "series": "insert_series_name_here" as NSObject, // insert the series name here
- "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert the intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here
- ])
- // This event fires when a user adds a series to his practice
- Analytics.logEvent("series_saved", parameters: [
- "series": "insert_series_name_here" as NSObject, // insert the series name here
- "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert the intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here
- ])
- // This event fires when a user plays the series intro video, usually the video next to the series description on the series page
- Analytics.logEvent("series_intro_played", parameters: [
- "series": "insert_series_name_here" as NSObject, // insert the series name here
- "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert the intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here
- ])
- // This event fires when a user views an instructor page (on page load of an instructor page)
- Analytics.logEvent("instructor_viewed", parameters: [
- "instructor": "insert_instructor_name" as NSObject
- ])
- // This event fires when a user plays a video
- Analytics.logEvent("video_played", parameters: [
- "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class)
- "class": "insert_class_name_here" as NSObject, // insert class name
- "series": "insert_series_name_here" as NSObject, // insert the series that video is part of
- "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert instructor here
- ])
- // This event fires every 10 seconds when a video is being played.
- Analytics.logEvent("video_watched_time", parameters: [
- "duration" : 10 as NSObject,// 10 seconds unless defined otherwise
- "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class)
- "class": "insert_class_name_here" as NSObject, // insert class name
- "series": "insert_series_name_here" as NSObject, // insert the series that video is part of
- "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert instructor here
- ])
- // This event fires when a user viewed 10%, 25%, 50%, 75% and 90% of the video
- Analytics.logEvent("video_watched_percent", parameters: [
- "percent": 10 as NSObject,// 10, 25, 50, 75, 90
- "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class)
- "class": "insert_class_name_here" as NSObject, // insert class name
- "series": "insert_series_name_here" as NSObject, // insert the series that video is part of
- "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert instructor here
- ])
- // This event fires when a user finishes watching a video
- Analytics.logEvent("video_finished", parameters: [
- "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class)
- "class": "insert_class_name_here" as NSObject, // insert class name
- "series": "insert_series_name_here" as NSObject, // insert the series that video is part of
- "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here
- "intensity": "insert_intesity_here" as NSObject, // insert intensity here
- "instructor": "insert_class_instructor_name" as NSObject // insert instructor here
- ])
- // This event fires when a user filters the duration
- Analytics.logEvent("duration_filtered", parameters: [
- "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen
- ])
- // This event fires when a user filters the instructor
- Analytics.logEvent("instructor_filtered", parameters: [
- "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen
- ])
- // This event fires when a user filters the style
- Analytics.logEvent("style_filtered", parameters: [
- "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen
- ])
- // This event fires when a user filters the difficulty
- Analytics.logEvent("difficulty_filtered", parameters: [
- "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen
- ])
- // This event fires when a user filters the intensity
- Analytics.logEvent("intensity_filtered", parameters: [
- "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen
- ])
- // This event fires when a user uses the sort function
- Analytics.logEvent("sorted_by", parameters: [
- "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement