Advertisement
emanuel1109

moves - IOS - Objective C- Code Snippets

Jul 25th, 2022 (edited)
1,167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  // 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
  2. [FIRAnalytics setUserID:@"123456"]
  3.  
  4. // 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
  5. [FIRAnalytics setUserPropertyString:"insert_sub_status_here" forName:@"user_sub_status"]; // 'free trial', 'canceled', 'monthly', 'yearly', 'expired'
  6.  
  7.  
  8. // 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
  9. [FIRAnalytics logEventWithName:@"sign_up_started"
  10.                     parameters:@{
  11.                                  @"method": "email/apple" // the method of registration, if facebook is also an option, please include it here
  12.                                  }];
  13.  
  14. // This event fires when a user completes the signup
  15. [FIRAnalytics logEventWithName:@"sign_up_completed"
  16.                     parameters:@{
  17.                                  @"method": "email/apple" // the method of registration, if facebook is also an option, please include it here
  18.                                  }];
  19.  
  20.  // 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
  21. [FIRAnalytics setUserID:@"123456"]
  22.  
  23. // This event fires when a user clicks to start the survey
  24. [FIRAnalytics logEventWithName:@"survey_started"
  25.                     parameters:@{
  26.                                  @"type": "mandatory" // the survey on mobile is usually forced (a user cannot skip it)
  27.                                  }];
  28.  
  29. // This event fires when a user finishes the survey
  30. [FIRAnalytics logEventWithName:@"survey_finished"
  31.                     parameters:@{
  32.                                  @"type": "mandatory", // the survey on mobile is usually forced (a user cannot skip it)
  33.                                 @"is_instructor": "true/false" // if the user ticked the 'I am instructor' box then it's true
  34.                                  }];
  35.  
  36. // if the user checks the 'I am instructor' checkbox on the survey, save it as a user parameter
  37. [FIRAnalytics setUserPropertyString:"true/false" forName:@is_instructor]; // 'true' or 'false' depends on the answer, default value: "false"
  38.  
  39.  
  40. // This event fires when a user clicks on any button that redirects to starting a free trial
  41. [FIRAnalytics logEventWithName:@"cta_clicked"
  42.                     parameters:@{
  43.                                  @"page_title": "insert_page_title_here" // insert the title of the page the button was clicked on     
  44.                                  }];
  45.  
  46.  
  47. // 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)
  48. [FIRAnalytics logEventWithName:@"reactivation_initiated"];
  49.  
  50. // 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)
  51. // Prepare purchase params
  52. NSMutableDictionary *purchaseParams = [@{
  53.   kFIRParameterTransactionID: @"T12345", // transaction id
  54.   kFIRParameterAffiliation: @"alomoves", // insert store name region here
  55.   kFIRParameterCurrency: @"USD", // leave static if user can only be charged with USD
  56.   kFIRParameterValue: @14.98, // order total (excluding tax) (the amount the user paid when he activated the plan excluding tax)
  57.   kFIRParameterTax: @2.58, // insert tax (if available or exist in the store)
  58.   kFIRParameterCoupon: @"SUMMER_FUN" // if coupon was applied to the order, include it here
  59. } mutableCopy];
  60.  
  61. // Add items
  62. purchaseParams[kFIRParameterItems] = [@{
  63.   kFIRParameterItemID: @"membership activated - monthly/annually", // monthly or annually depends on the plan the user chose
  64.   kFIRParameterItemName: @"membership activated - monthly/annually", // monthly or annually depends on the plan the user chose
  65.   kFIRParameterPrice: @9.99, // insert an actual product price. Number or a string. Don't include currency code
  66.   kFIRParameterQuantity: @1 // product quantity. leave static
  67. } mutableCopy];
  68.  
  69. // Log purchase event
  70. [FIRAnalytics logEventWithName:kFIREventPurchase parameters:purchaseParams]; // name of the event. In this case, it always must be kFIREventPurchase
  71.  
  72.  
  73. // This event fires when a user chose a payment plan, captures the payment plan chosen, captures the payment plan chosen.
  74. [FIRAnalytics logEventWithName:@"payment_plan_chosen"
  75.                     parameters:@{
  76.                                  @"type": "monthly/annually" // payment plan type
  77.                                  }];
  78.  
  79.  
  80. // This event fires after a user placed his credit card information and paid on App Store and his trial started
  81. [FIRAnalytics logEventWithName:@"trial_started"
  82.                     parameters:@{
  83.                                  @"name": "14 Days Trial - Annual/Monthly" // Annual or Monthly depends on the trial he started
  84.                                  }];
  85.  
  86.  
  87. // This event fires when a user has a class opened (on page load of a class)
  88. [FIRAnalytics logEventWithName:@"class_viewed"
  89.                     parameters:@{
  90.                                  @"class": "insert_class_name_here",  // insert the class name here
  91.                                  @"series": "insert_series_name_here", // insert the series name here
  92.                                  @"difficulty": "insert_difficulty_here",  // insert the difficulty here
  93.                                  @"intensity": "insert_intesity_here",  // insert the intensity here
  94.                                  @"instructor": "insert_class_instructor_name" // insert the instructor here  
  95.                                  }];
  96.  
  97.  
  98. // This event fires when a user has a user saved a class (added to practice)
  99. [FIRAnalytics logEventWithName:@"class_saved"
  100.                     parameters:@{
  101.                                  @"class": "insert_class_name_here",  // insert the class name here
  102.                                  @"series": "insert_series_name_here", // insert the series name here
  103.                                  @"difficulty": "insert_difficulty_here",  // insert the difficulty here
  104.                                  @"intensity": "insert_intesity_here",  // insert the intensity here
  105.                                  @"instructor": "insert_class_instructor_name" // insert the instructor here  
  106.                                  }];
  107.  
  108.  
  109. // This event fires when a user has a series opened (on a page load of a series page)
  110. [FIRAnalytics logEventWithName:@"series_viewed"
  111.                     parameters:@{
  112.                                  @"series": "insert_series_name_here", // insert the series name here
  113.                                  @"difficulty": "insert_difficulty_here",  // insert the difficulty here
  114.                                  @"intensity": "insert_intesity_here",  // insert the intensity here
  115.                                  @"instructor": "insert_class_instructor_name" // insert the instructor here  
  116.                                  }];
  117.  
  118. // This event fires when a user adds a series to his practice
  119. [FIRAnalytics logEventWithName:@"series_saved"
  120.                     parameters:@{
  121.                                  @"series": "insert_series_name_here", // insert the series name here
  122.                                  @"difficulty": "insert_difficulty_here",  // insert the difficulty here
  123.                                  @"intensity": "insert_intesity_here",  // insert the intensity here
  124.                                  @"instructor": "insert_class_instructor_name" // insert the instructor here  
  125.                                  }];
  126.  
  127. // This event fires when a user plays the series intro video, usually the video next to the series description on the series page
  128. [FIRAnalytics logEventWithName:@"series_intro_played"
  129.                     parameters:@{
  130.                                  @"series": "insert_series_name_here", // insert the series name here
  131.                                  @"difficulty": "insert_difficulty_here",  // insert the difficulty here
  132.                                  @"intensity": "insert_intesity_here",  // insert the intensity here
  133.                                  @"instructor": "insert_class_instructor_name" // insert the instructor here
  134.                                  }];
  135.  
  136. // This event fires when a user views an instructor page (on a page load of instructor page)
  137. [FIRAnalytics logEventWithName:@"instructor_viewed"
  138.                     parameters:@{
  139.                                 @"instructor": "insert_instructor_name"
  140.                                  }];
  141.  
  142.  
  143. // This event fires when a user plays a video
  144. [FIRAnalytics logEventWithName:@"video_played"
  145.                     parameters:@{
  146.                                 @"title": "insert_video_name_here", // insert video title (could be the name of the class)
  147.                                 @"class": "insert_class_name_here",  // insert class name  
  148.                                 @"series": "insert_series_name_here", // insert the series that video is part of
  149.                                 @"difficulty": "insert_difficulty_here",  // insert difficulty here
  150.                                 @"intensity": "insert_intesity_here",  // insert intensity here
  151.                                 @"instructor": "insert_class_instructor_name" // insert instructor here
  152.                                  }];
  153.  
  154.  
  155. // This event fires every 10 seconds when a video is being played.
  156. [FIRAnalytics logEventWithName:@"video_watched_time"
  157.                     parameters:@{
  158.                                 @"duration" : 10, // 10 seconds unless defined otherwise  
  159.                                 @"title": "insert_video_name_here", // insert video title (could be the name of the class)
  160.                                 @"class": "insert_class_name_here",  // insert class name  
  161.                                 @"series": "insert_series_name_here", // insert the series that video is part of
  162.                                 @"difficulty": "insert_difficulty_here",  // insert difficulty here
  163.                                 @"intensity": "insert_intesity_here", // insert intensity here
  164.                                 @"instructor": "insert_class_instructor_name" // insert instructor here  
  165.                                  }];
  166.  
  167. // This event fires when a user viewed 10%, 25%, 50%, 75% and 90% of the video
  168. [FIRAnalytics logEventWithName:@"video_watched_percent"
  169.                     parameters:@{
  170.                                 @"percent" : 10, // 10, 25, 50, 75, 90
  171.                                 @"title": "insert_video_name_here", // insert video title (could be the name of the class)
  172.                                 @"class": "insert_class_name_here",  // insert class name  
  173.                                 @"series": "insert_series_name_here", // insert the series that video is part of
  174.                                 @"difficulty": "insert_difficulty_here",  // insert difficulty here
  175.                                 @"intensity": "insert_intesity_here", // insert intensity here
  176.                                 @"instructor": "insert_class_instructor_name" // insert instructor here  
  177.                                  }];
  178.  
  179. // This event fires when a user finishes watching a video
  180. [FIRAnalytics logEventWithName:@"video_finished"
  181.                     parameters:@{
  182.                                 @"title": "insert_video_name_here", // insert video title (could be the name of the class)
  183.                                 @"class": "insert_class_name_here",  // insert class name  
  184.                                 @"series": "insert_series_name_here", // insert the series that video is part of
  185.                                 @"difficulty": "insert_difficulty_here",  // insert difficulty here
  186.                                 @"intensity": "insert_intesity_here", // insert intensity here
  187.                                 @"instructor": "insert_class_instructor_name" // insert instructor here  
  188.                                  }];
  189.  
  190.  
  191. // This event fires when a user filters the duration
  192. [FIRAnalytics logEventWithName:@"duration_filtered"
  193.                     parameters:@{
  194.                                 @"filter_value": "insert_value_chosen"}]; // insert the value of the filter that was chosen
  195.  
  196. // This event fires when a user filters the instructor
  197. [FIRAnalytics logEventWithName:@"instructor_filtered"
  198.                     parameters:@{
  199.                                 @"filter_value": "insert_value_chosen"}]; // insert the value of the filter that was chosen
  200.  
  201. // This event fires when a user filters the style
  202. [FIRAnalytics logEventWithName:@"style_filtered"
  203.                     parameters:@{
  204.                                 @"filter_value": "insert_value_chosen"}]; // insert the value of the filter that was chosen
  205.  
  206. // This event fires when a user filters the difficulty
  207. [FIRAnalytics logEventWithName:@"difficulty_filtered"
  208.                     parameters:@{
  209.                                 @"filter_value": "insert_value_chosen"}]; // insert the value of the filter that was chosen
  210.  
  211. // This event fires when a user filters the intensity
  212. [FIRAnalytics logEventWithName:@"intensity_filtered"
  213.                     parameters:@{
  214.                                 @"filter_value": "insert_value_chosen"}]; // insert the value of the filter that was chosen
  215.  
  216. // This event fires when a user uses the sort function
  217. [FIRAnalytics logEventWithName:@"sorted_by"
  218.                     parameters:@{
  219.                                 @"filter_value": "insert_value_chosen"}]; // insert the value of the filter that was chosen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement