SHOW:
|
|
- or go back to the newest paste.
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 | - | Analytics.setUserID("123456") // insert the user id like it appears in the database |
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 | - | Analytics.setUserProperty("insert_user_sub_status", forName: "user_sub_status") // 'free trial', 'canceled', 'monthly', 'yearly', 'expired' |
5 | + | [FIRAnalytics setUserPropertyString:"insert_sub_status_here" forName:@"user_sub_status"]; // 'free trial', 'canceled', 'monthly', 'yearly', 'expired' |
6 | ||
7 | ||
8 | - | Analytics.logEvent("sign_up_started", parameters: [ |
8 | + | |
9 | - | "method": "email/apple" as NSObject // the method of registration, if facebook is also an option, please include it here |
9 | + | [FIRAnalytics logEventWithName:@"sign_up_started" |
10 | - | ]) |
10 | + | parameters:@{ |
11 | @"method": "email/apple" // the method of registration, if facebook is also an option, please include it here | |
12 | }]; | |
13 | - | Analytics.logEvent("sign_up_completed", parameters: [ |
13 | + | |
14 | - | "method": "email/apple" as NSObject // the method of registration, if facebook is also an option, please include it here |
14 | + | |
15 | - | ]) |
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 | - | Analytics.setUserID("123456") |
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 | - | Analytics.logEvent("survey_started", parameters: [ |
21 | + | [FIRAnalytics setUserID:@"123456"] |
22 | - | "type": "mandatory" as NSObject // the survey on mobile is usually forced (a user cannot skip it) |
22 | + | |
23 | - | ]) |
23 | + | |
24 | [FIRAnalytics logEventWithName:@"survey_started" | |
25 | parameters:@{ | |
26 | - | Analytics.logEvent("survey_finished", parameters: [ |
26 | + | @"type": "mandatory" // the survey on mobile is usually forced (a user cannot skip it) |
27 | - | "type": "mandatory" as NSObject, // the survey on mobile is usually forced (a user cannot skip it) |
27 | + | }]; |
28 | - | "is_instructor" : "true/false" // if he checked the 'I am instructor' box then it's true |
28 | + | |
29 | - | ]) |
29 | + | |
30 | [FIRAnalytics logEventWithName:@"survey_finished" | |
31 | parameters:@{ | |
32 | - | Analytics.setUserProperty(is_instructor, forName: "true/false") // 'true' or 'false' depends on the answer, default value: "false" |
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 | - | Analytics.logEvent("cta_clicked") |
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 | - | Analytics.logEvent("reactivation_initiated") |
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 | - | var purchaseParams: [String: Any] = [ |
42 | + | parameters:@{ |
43 | - | AnalyticsParameterTransactionID: "T12345", // transaction id |
43 | + | @"page_title": "insert_page_title_here" // insert the title of the page the button was clicked on |
44 | - | AnalyticsParameterAffiliation: "alomoves", // insert store name region here |
44 | + | }]; |
45 | - | AnalyticsParameterCurrency: "USD", // leave static if user can only be charged with USD |
45 | + | |
46 | - | AnalyticsParameterValue: 14.98, // order total (excluding tax) (the amount the user paid when he activated the plan excluding tax) |
46 | + | |
47 | - | AnalyticsParameterTax: 2.58, // insert tax (if available or exist in the store) |
47 | + | |
48 | - | AnalyticsParameterCoupon: "SUMMER_FUN" // if coupon was applied to the order, include it here |
48 | + | [FIRAnalytics logEventWithName:@"reactivation_initiated"]; |
49 | - | ] |
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 | - | purchaseParams[AnalyticsParameterItems] = [ // an array with all products |
52 | + | NSMutableDictionary *purchaseParams = [@{ |
53 | - | AnalyticsParameterItemID: "membership activated - monthly/annually", // monthly or annually depends on the plan the user chose |
53 | + | kFIRParameterTransactionID: @"T12345", // transaction id |
54 | - | AnalyticsParameterItemName: "membership activated - monthly/annually", // monthly or annually depends on the plan the user chose |
54 | + | kFIRParameterAffiliation: @"alomoves", // insert store name region here |
55 | - | AnalyticsParameterPrice: 9.99, // insert an actual product price. Number or a string. Don't include currency code |
55 | + | kFIRParameterCurrency: @"USD", // leave static if user can only be charged with USD |
56 | - | AnalyticsParameterQuantity: 1 // product quantity. leave static |
56 | + | kFIRParameterValue: @14.98, // order total (excluding tax) (the amount the user paid when he activated the plan excluding tax) |
57 | - | ] |
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 | - | Analytics.logEvent(AnalyticsEventPurchase, parameters: purchaseParams) // name of the event. In this case, it always must be AnalyticsEventPurchase |
60 | + | |
61 | - | |
61 | + | |
62 | purchaseParams[kFIRParameterItems] = [@{ | |
63 | - | // This event fires when a user chose a payment plan, captures the payment plan chosen. |
63 | + | kFIRParameterItemID: @"membership activated - monthly/annually", // monthly or annually depends on the plan the user chose |
64 | - | Analytics.logEvent("payment_plan_chosen", parameters: [ |
64 | + | kFIRParameterItemName: @"membership activated - monthly/annually", // monthly or annually depends on the plan the user chose |
65 | - | "type": "monthly/annually" as NSObject // payment plan type |
65 | + | kFIRParameterPrice: @9.99, // insert an actual product price. Number or a string. Don't include currency code |
66 | - | ]) |
66 | + | kFIRParameterQuantity: @1 // product quantity. leave static |
67 | } mutableCopy]; | |
68 | ||
69 | - | Analytics.logEvent("trial_started", parameters: [ |
69 | + | |
70 | - | "name": "14 Days Trial - Annual/Monthly" as NSObject // Annual or Monthly depends on the trial he started |
70 | + | [FIRAnalytics logEventWithName:kFIREventPurchase parameters:purchaseParams]; // name of the event. In this case, it always must be kFIREventPurchase |
71 | - | ]) |
71 | + | |
72 | ||
73 | // This event fires when a user chose a payment plan, captures the payment plan chosen, captures the payment plan chosen. | |
74 | - | Analytics.logEvent("class_viewed", parameters: [ |
74 | + | [FIRAnalytics logEventWithName:@"payment_plan_chosen" |
75 | - | "class": "insert_class_name_here" as NSObject, // insert the class name here |
75 | + | parameters:@{ |
76 | - | "series": "insert_series_name_here" as NSObject, // insert the series name here |
76 | + | @"type": "monthly/annually" // payment plan type |
77 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here |
77 | + | }]; |
78 | - | "intensity": "insert_intesity_here" as NSObject, // insert the intensity here |
78 | + | |
79 | - | "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here |
79 | + | |
80 | - | ]) |
80 | + | |
81 | [FIRAnalytics logEventWithName:@"trial_started" | |
82 | parameters:@{ | |
83 | - | Analytics.logEvent("class_saved", parameters: [ |
83 | + | @"name": "14 Days Trial - Annual/Monthly" // Annual or Monthly depends on the trial he started |
84 | - | "class": "insert_class_name_here" as NSObject, // insert the class name here |
84 | + | }]; |
85 | - | "series": "insert_series_name_here" as NSObject, // insert the series name here |
85 | + | |
86 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here |
86 | + | |
87 | - | "intensity": "insert_intesity_here" as NSObject, // insert the intensity here |
87 | + | |
88 | - | "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here |
88 | + | [FIRAnalytics logEventWithName:@"class_viewed" |
89 | - | ]) |
89 | + | parameters:@{ |
90 | @"class": "insert_class_name_here", // insert the class name here | |
91 | - | // This event fires when a user has a series opened (on page load of a series) |
91 | + | @"series": "insert_series_name_here", // insert the series name here |
92 | - | Analytics.logEvent("series_viewed", parameters: [ |
92 | + | @"difficulty": "insert_difficulty_here", // insert the difficulty here |
93 | - | "category": "insert_category_here" as NSObject, // fitness, mindfulness, skills, yoga, set your intention |
93 | + | @"intensity": "insert_intesity_here", // insert the intensity here |
94 | - | "series": "insert_series_name_here" as NSObject, // insert the series name here |
94 | + | @"instructor": "insert_class_instructor_name" // insert the instructor here |
95 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here |
95 | + | }]; |
96 | - | "intensity": "insert_intesity_here" as NSObject, // insert the intensity here |
96 | + | |
97 | - | "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here |
97 | + | |
98 | - | ]) |
98 | + | |
99 | [FIRAnalytics logEventWithName:@"class_saved" | |
100 | parameters:@{ | |
101 | - | Analytics.logEvent("series_saved", parameters: [ |
101 | + | @"class": "insert_class_name_here", // insert the class name here |
102 | - | "series": "insert_series_name_here" as NSObject, // insert the series name here |
102 | + | @"series": "insert_series_name_here", // insert the series name here |
103 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here |
103 | + | @"difficulty": "insert_difficulty_here", // insert the difficulty here |
104 | - | "intensity": "insert_intesity_here" as NSObject, // insert the intensity here |
104 | + | @"intensity": "insert_intesity_here", // insert the intensity here |
105 | - | "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here |
105 | + | @"instructor": "insert_class_instructor_name" // insert the instructor here |
106 | - | ]) |
106 | + | }]; |
107 | ||
108 | ||
109 | - | Analytics.logEvent("series_intro_played", parameters: [ |
109 | + | // This event fires when a user has a series opened (on a page load of a series page) |
110 | - | "series": "insert_series_name_here" as NSObject, // insert the series name here |
110 | + | [FIRAnalytics logEventWithName:@"series_viewed" |
111 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert the difficulty here |
111 | + | parameters:@{ |
112 | - | "intensity": "insert_intesity_here" as NSObject, // insert the intensity here |
112 | + | @"series": "insert_series_name_here", // insert the series name here |
113 | - | "instructor": "insert_class_instructor_name" as NSObject // insert the instructor here |
113 | + | @"difficulty": "insert_difficulty_here", // insert the difficulty here |
114 | - | ]) |
114 | + | @"intensity": "insert_intesity_here", // insert the intensity here |
115 | @"instructor": "insert_class_instructor_name" // insert the instructor here | |
116 | - | // This event fires when a user views an instructor page (on page load of an instructor page) |
116 | + | }]; |
117 | - | Analytics.logEvent("instructor_viewed", parameters: [ |
117 | + | |
118 | - | "instructor": "insert_instructor_name" as NSObject |
118 | + | |
119 | - | ]) |
119 | + | [FIRAnalytics logEventWithName:@"series_saved" |
120 | parameters:@{ | |
121 | @"series": "insert_series_name_here", // insert the series name here | |
122 | - | Analytics.logEvent("video_played", parameters: [ |
122 | + | @"difficulty": "insert_difficulty_here", // insert the difficulty here |
123 | - | "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class) |
123 | + | @"intensity": "insert_intesity_here", // insert the intensity here |
124 | - | "class": "insert_class_name_here" as NSObject, // insert class name |
124 | + | @"instructor": "insert_class_instructor_name" // insert the instructor here |
125 | - | "series": "insert_series_name_here" as NSObject, // insert the series that video is part of |
125 | + | }]; |
126 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here |
126 | + | |
127 | - | "intensity": "insert_intesity_here" as NSObject, // insert intensity here |
127 | + | |
128 | - | "instructor": "insert_class_instructor_name" as NSObject // insert instructor here |
128 | + | [FIRAnalytics logEventWithName:@"series_intro_played" |
129 | - | ]) |
129 | + | parameters:@{ |
130 | @"series": "insert_series_name_here", // insert the series name here | |
131 | @"difficulty": "insert_difficulty_here", // insert the difficulty here | |
132 | - | Analytics.logEvent("video_watched_time", parameters: [ |
132 | + | @"intensity": "insert_intesity_here", // insert the intensity here |
133 | - | "duration" : 10 as NSObject,// 10 seconds unless defined otherwise |
133 | + | @"instructor": "insert_class_instructor_name" // insert the instructor here |
134 | - | "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class) |
134 | + | }]; |
135 | - | "class": "insert_class_name_here" as NSObject, // insert class name |
135 | + | |
136 | - | "series": "insert_series_name_here" as NSObject, // insert the series that video is part of |
136 | + | // This event fires when a user views an instructor page (on a page load of instructor page) |
137 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here |
137 | + | [FIRAnalytics logEventWithName:@"instructor_viewed" |
138 | - | "intensity": "insert_intesity_here" as NSObject, // insert intensity here |
138 | + | parameters:@{ |
139 | - | "instructor": "insert_class_instructor_name" as NSObject // insert instructor here |
139 | + | @"instructor": "insert_instructor_name" |
140 | - | ]) |
140 | + | }]; |
141 | ||
142 | ||
143 | - | Analytics.logEvent("video_watched_percent", parameters: [ |
143 | + | |
144 | - | "percent": 10 as NSObject,// 10, 25, 50, 75, 90 |
144 | + | [FIRAnalytics logEventWithName:@"video_played" |
145 | - | "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class) |
145 | + | parameters:@{ |
146 | - | "class": "insert_class_name_here" as NSObject, // insert class name |
146 | + | @"title": "insert_video_name_here", // insert video title (could be the name of the class) |
147 | - | "series": "insert_series_name_here" as NSObject, // insert the series that video is part of |
147 | + | @"class": "insert_class_name_here", // insert class name |
148 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here |
148 | + | @"series": "insert_series_name_here", // insert the series that video is part of |
149 | - | "intensity": "insert_intesity_here" as NSObject, // insert intensity here |
149 | + | @"difficulty": "insert_difficulty_here", // insert difficulty here |
150 | - | "instructor": "insert_class_instructor_name" as NSObject // insert instructor here |
150 | + | @"intensity": "insert_intesity_here", // insert intensity here |
151 | - | ]) |
151 | + | @"instructor": "insert_class_instructor_name" // insert instructor here |
152 | }]; | |
153 | ||
154 | - | Analytics.logEvent("video_finished", parameters: [ |
154 | + | |
155 | - | "title": "insert_video_name_here" as NSObject, // insert video title (could be the name of the class) |
155 | + | |
156 | - | "class": "insert_class_name_here" as NSObject, // insert class name |
156 | + | [FIRAnalytics logEventWithName:@"video_watched_time" |
157 | - | "series": "insert_series_name_here" as NSObject, // insert the series that video is part of |
157 | + | parameters:@{ |
158 | - | "difficulty": "insert_difficulty_here" as NSObject, // insert difficulty here |
158 | + | @"duration" : 10, // 10 seconds unless defined otherwise |
159 | - | "intensity": "insert_intesity_here" as NSObject, // insert intensity here |
159 | + | @"title": "insert_video_name_here", // insert video title (could be the name of the class) |
160 | - | "instructor": "insert_class_instructor_name" as NSObject // insert instructor here |
160 | + | @"class": "insert_class_name_here", // insert class name |
161 | - | ]) |
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 | - | Analytics.logEvent("duration_filtered", parameters: [ |
164 | + | @"instructor": "insert_class_instructor_name" // insert instructor here |
165 | - | "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen |
165 | + | }]; |
166 | - | ]) |
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 | - | Analytics.logEvent("instructor_filtered", parameters: [ |
169 | + | parameters:@{ |
170 | - | "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen |
170 | + | @"percent" : 10, // 10, 25, 50, 75, 90 |
171 | - | ]) |
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 | - | Analytics.logEvent("style_filtered", parameters: [ |
174 | + | @"difficulty": "insert_difficulty_here", // insert difficulty here |
175 | - | "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen |
175 | + | @"intensity": "insert_intesity_here", // insert intensity here |
176 | - | ]) |
176 | + | @"instructor": "insert_class_instructor_name" // insert instructor here |
177 | }]; | |
178 | ||
179 | - | Analytics.logEvent("difficulty_filtered", parameters: [ |
179 | + | |
180 | - | "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen |
180 | + | [FIRAnalytics logEventWithName:@"video_finished" |
181 | - | ]) |
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 | - | Analytics.logEvent("intensity_filtered", parameters: [ |
184 | + | @"series": "insert_series_name_here", // insert the series that video is part of |
185 | - | "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen |
185 | + | @"difficulty": "insert_difficulty_here", // insert difficulty here |
186 | - | ]) |
186 | + | @"intensity": "insert_intesity_here", // insert intensity here |
187 | @"instructor": "insert_class_instructor_name" // insert instructor here | |
188 | }]; | |
189 | - | Analytics.logEvent("sorted_by", parameters: [ |
189 | + | |
190 | - | "filter_value": "insert_value_chosen" as NSObject // insert the value of the filter that was chosen |
190 | + | |
191 | - | ]) |
191 | + | |
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 |