Wiki source code of Flutter integration
Last modified by Developer on 2020/03/19 15:21
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{box cssClass="floatinginfobox" title="**Page Contents**"}} | ||
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
5 | = 1. Overview = | ||
6 | |||
7 | The plugin is located at pub repositories [[(pub repositories)>>https://pub.dev/packages/flutter_mobigate]] | ||
8 | This plugin is built for: | ||
9 | |||
10 | * Mobigate SDK version 1.0.6 | ||
11 | |||
12 | = 2. Adding SDK to the project = | ||
13 | |||
14 | **First, add this to your package's pubspec.yaml file** | ||
15 | |||
16 | {{code language=""}} | ||
17 | dependencies: | ||
18 | flutter_mobigate: ^1.0.2 | ||
19 | {{/code}} | ||
20 | |||
21 | **Install packages from the command line** | ||
22 | |||
23 | {{code language=""}} | ||
24 | $ flutter pub get | ||
25 | {{/code}} | ||
26 | |||
27 | = 3. Api methods = | ||
28 | |||
29 | To use any method from the plugin add import: | ||
30 | |||
31 | {{code language="dart"}} | ||
32 | import 'package:flutter_mobigate/flutter_mobigate.dart'; | ||
33 | {{/code}} | ||
34 | |||
35 | == 3.1 MobigateSDK class initialization == | ||
36 | |||
37 | Initialize class with //MobigateSDK(MobigateOptions options)// | ||
38 | |||
39 | //MobigateOptions(apiKey,{appIdentifier, appInstallationSource,email,cusUserId,enableUserFields,dataGatherPolicy,notificationText,enableIdProfiles})// | ||
40 | |||
41 | {{showhide id="2" showmessage="MobigateOptions" hidemessage="MobigateOptions"}} | ||
42 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
43 | |=(% style="background-color:powderblue" %)Name|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Default|=(% style="background-color:powderblue" %)Description | ||
44 | | appIdentifier|String| | Application identifier | ||
45 | |appInstallationSource |String| | App installation source e.g., google-play, organic. | ||
46 | |email |String | | Set's user email. | ||
47 | |cusUserId |String | | You may use your custom userID for marking data. By default we are using device ID and emails for matching. Set it before starting the service using MobigateSDk.Builder method. | ||
48 | | enableUserFields|Json Array | | Enable custom fields in user data. By default MobienceSDK is gathering all identifiers, which it can read. You can choose one of these field: ["email", "imei", "imsi", "msisdn", "mac", "serial"] see [[plugin user field constants>>https://wiki.spicymobile.pl/wiki/mobigatesdk/view/Main/sdkintegration/reactnativeintegration/#H4.1Userfieldconstants]]. | ||
49 | | dataGatherPolicy| Json Object| | Enable custom data gater policy. By default MobienceSDK gather all data it can read and hide notification icon. Check below DataGatherPolicy options for more details. | ||
50 | | notificationText|String | | if state = Mobigate.DATA_GATHER_POLICY_DEFAULT you can pass custom foreground service notification text. | ||
51 | | enableIdProfiles|Boolean |false | turns on / off the IDs profiles system. | ||
52 | {{/showhide}} | ||
53 | |||
54 | {{showhide id="3" showmessage="DataGatherPolicy options" hidemessage="DataGatherPolicy options"}} | ||
55 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
56 | |=(% style="background-color:powderblue" %)Name|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Default|=(% style="background-color:powderblue" %)Description | ||
57 | | monitorState|String| | Possible monitor states: [[plugin constants>>https://wiki.spicymobile.pl/wiki/mobigatesdk/view/Main/sdkintegration/reactnativeintegration/#H4.2Datagatherpolicyconstants]]. More info about gathering data [[here>>https://wiki.spicymobile.pl/wiki/mobigatesdk/view/Main/mobigatesdkintegrationforandroiddevelopers/#H5.8Datagatherpolicy]] | ||
58 | {{/showhide}} | ||
59 | |||
60 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
61 | {{code language="dart"}} | ||
62 | MobigateSDK mobigateInstance = MobigateSDK(MobigateOptions( | ||
63 | "V0K6jhiIfem6CRWHYZ59Nmj3oFBBKbJsnSsWfR2JNq7ktblOUXwbJoBQTpWnw2uSwW76gpiu2kun50jweTY69B" | ||
64 | )); | ||
65 | {{/code}} | ||
66 | {{/showhide}} | ||
67 | |||
68 | == 3.2 SDK initialization == | ||
69 | |||
70 | You must initialize the library before running it. Use //Future<String> init// method for that: | ||
71 | |||
72 | **mobigateInstance.init()** | ||
73 | |||
74 | Return: | ||
75 | |||
76 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
77 | |=(% style="background-color:powderblue" %)Message|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
78 | |success|String|returns success message | ||
79 | |error|String|returns error message | ||
80 | |||
81 | When the library is already initialized run it. Use //Future<String> startSdk()// method for that: | ||
82 | |||
83 | **mobigateInstance.startSdk();** | ||
84 | |||
85 | Return: | ||
86 | |||
87 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
88 | |=(% style="background-color:powderblue" %)Message|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
89 | |success|String|returns success message | ||
90 | |error|String|returns error message | ||
91 | |||
92 | == 3.3 Tracking in app events == | ||
93 | |||
94 | In-App Events provide insight on what is happening in your app. It is recommended to take the time and define the events you would like to measure. | ||
95 | |||
96 | === 3.3.1 Overview === | ||
97 | |||
98 | An event consists of two fields that you (% style="display:none" %) (%%)can use to describe a user's interaction with your app content: | ||
99 | |||
100 | (% class="table-bordered table-hover" %) | ||
101 | |(% style="background-color:powderblue; width:200px" %)**Field name**|(% style="background-color:powderblue; width:200px" %)**Type**|(% style="background-color:powderblue; width:200px" %)**Required**|(% style="background-color:powderblue; width:200px" %)**Description** | ||
102 | |(% style="width:200px" %)Category|(% style="width:200px" %)String|(% style="width:200px" %)yes|(% style="width:200px" %)Event category | ||
103 | |(% style="width:200px" %)Parameter|(% style="width:200px" %)String|(% style="width:200px" %)no|(% style="width:200px" %)Event parameter. | ||
104 | There can be more than one | ||
105 | |||
106 | You can use any event category or parameter string of your choice. However, flutter_mobigate plugin contains recommended event categories and parameters via String constants (see [[Event categories>>doc:||anchor="H3.2.3Eventcategories"]] and [[Event parameters>>doc:||anchor="H3.2.4Eventparameters"]]). | ||
107 | |||
108 | === 3.3.2 Implementation === | ||
109 | |||
110 | Tracking in-app events is performed by two methods: | ||
111 | |||
112 | **void trackEvent(Category category)** | ||
113 | |||
114 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
115 | |=(% style="background-color:powderblue" %)Parameter|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
116 | |Category|Category class |Category class built with help of CategoryBuilder | ||
117 | |||
118 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
119 | {{code language="dart"}} | ||
120 | mobigateInstance.trackEvent((CategoryBuilder(EventCategory.BEGIN_TRIAL) | ||
121 | ..setParameter(EventParameter.CITY, "Warsaw") | ||
122 | ..setParameter(EventParameter.CONTENT_ID, 523456) | ||
123 | ..setParameter(EventParameter.COUPON_CODE, 97636572) | ||
124 | ..setParameter(EventParameter.CUSTOMER_SEGMENT, [1, 2, 4])) | ||
125 | .build()); | ||
126 | {{/code}} | ||
127 | {{/showhide}} | ||
128 | |||
129 | |||
130 | **void trackAppInstall(int timestamp)** | ||
131 | |||
132 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
133 | |=(% style="background-color:powderblue" %)Parameter|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
134 | |timestamp|double|Unix timestamp in milliseconds | ||
135 | |||
136 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
137 | {{code language="javascript"}} | ||
138 | sendTrackEvent = () => { | ||
139 | if (Platform.OS === 'android') { | ||
140 | Mobigate.trackAppInstall(1578042916000) | ||
141 | } | ||
142 | } | ||
143 | {{/code}} | ||
144 | {{/showhide}} | ||
145 | |||
146 | === 3.3.3 Event categories === | ||
147 | |||
148 | The following section describes the recommended structure of each event category. In-app events categories are defined as part of plugin String constants. | ||
149 | |||
150 | |||
151 | {{showhide id="1" showmessage="LEVEL_ACCOMPLISHED" hidemessage="LEVEL_ACCOMPLISHED" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: 0px"}} | ||
152 | |||
153 | \\**Description:** Track accomplished game level achievement | ||
154 | **Event category:** LEVEL_ACCOMPLISHED | ||
155 | **Recommended parameters:** LEVEL, SCORE | ||
156 | {{/showhide}} | ||
157 | |||
158 | {{showhide id="2" showmessage="ADD_PAYMENT_INFO" hidemessage="ADD_PAYMENT_INFO" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
159 | |||
160 | \\**Description:** Track payment info | ||
161 | **Event category:** ADD_PAYMENT_INFO | ||
162 | **Recommended parameters:** SUCCESS | ||
163 | {{/showhide}} | ||
164 | |||
165 | {{showhide id="3" showmessage="ADD_TO_BASKET" hidemessage="ADD_TO_BASKET" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
166 | |||
167 | \\**Description:** Track add item to basket | ||
168 | **Event category:** ADD_TO_BASKET | ||
169 | **Recommended parameters:** PRICE, CONTENT_TYPE, CONTENT_ID, CONTENT, CURRENCY, QUANTITY | ||
170 | {{/showhide}} | ||
171 | |||
172 | {{showhide id="4" showmessage="REMOVED_FROM_BASKET" hidemessage="REMOVED_FROM_BASKET" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
173 | |||
174 | \\**Description:** Track removed item from basket | ||
175 | **Event category:** REMOVED_FROM_BASKET | ||
176 | **Recommended parameters:** PRICE, CONTENT_TYPE, CONTENT_ID, CONTENT, CURRENCY, QUANTITY | ||
177 | {{/showhide}} | ||
178 | |||
179 | {{showhide id="5" showmessage="ADD_TO_WISH_LIST" hidemessage="ADD_TO_WISH_LIST" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
180 | |||
181 | \\**Description:** Track add item to wish list | ||
182 | **Event category:** ADD_TO_WISH_LIST | ||
183 | **Recommended parameters:** PRICE, CONTENT_TYPE, CONTENT_ID, CONTENT, CURRENCY, QUANTITY | ||
184 | {{/showhide}} | ||
185 | |||
186 | {{showhide id="6" showmessage="REGISTRATION" hidemessage="REGISTRATION" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
187 | |||
188 | \\**Description:** Track registration | ||
189 | **Event category:** REGISTRATION | ||
190 | **Recommended parameters:** REGISTRATION_METHOD | ||
191 | {{/showhide}} | ||
192 | |||
193 | {{showhide id="7" showmessage="TUTORIAL_COMPLETION" hidemessage="TUTORIAL_COMPLETION" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
194 | |||
195 | \\**Description:** Track tutorial completion | ||
196 | **Event category:** TUTORIAL_COMPLETION | ||
197 | **Recommended parameters:** SUCCESS, CONTENT, CONTENT_ID | ||
198 | {{/showhide}} | ||
199 | |||
200 | {{showhide id="8" showmessage="TRIGGER_CHECKOUT" hidemessage="TRIGGER_CHECKOUT" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
201 | |||
202 | \\**Description:** Track triggered checkout | ||
203 | **Event category:** TRIGGER_CHECKOUT | ||
204 | **Recommended parameters:** PROCE, CONTENT_TYPE, CONTENT_ID, CONTENT, QUANTITY, PAYMENT_INFO_AVAILABLE, CURRENCY | ||
205 | {{/showhide}} | ||
206 | |||
207 | {{showhide id="9" showmessage="PURCHASE" hidemessage="PURCHASE" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
208 | |||
209 | \\**Description:** Track purchased item | ||
210 | **Event category:** PURCHASE | ||
211 | **Recommended parameters:** REVENUE, CONTENT_TYPE, CONTENT_ID, CONTENT, PRICE, QUANTITY, CURRENCY, ORDER_ID | ||
212 | {{/showhide}} | ||
213 | |||
214 | {{showhide id="10" showmessage="SUBSCRIBE" hidemessage="SUBSCRIBE" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
215 | |||
216 | \\**Description:** Track subscription purchase | ||
217 | **Event category:** SUBSCRIBE | ||
218 | **Recommended parameters:** REVENUE, CURRENCY | ||
219 | {{/showhide}} | ||
220 | |||
221 | {{showhide id="11" showmessage="BEGIN_TRIAL" hidemessage="BEGIN_TRIAL" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
222 | |||
223 | \\**Description:** Track begin trail of product | ||
224 | **Event category:** BEGIN_TRIAL | ||
225 | **Recommended parameters:** PRICE, CURRENCY | ||
226 | {{/showhide}} | ||
227 | |||
228 | {{showhide id="12" showmessage="RATE" hidemessage="RATE" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
229 | |||
230 | \\**Description:** Track app/item rate | ||
231 | **Event category:** RATE | ||
232 | **Recommended parameters:** RATING_VALUE, CONTENT_TYPE, CONTENT_ID, CONTENT, MAX_RATING_VALUE | ||
233 | {{/showhide}} | ||
234 | |||
235 | {{showhide id="13" showmessage="SEARCH" hidemessage="SEARCH" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
236 | \\**Description:** Track search event | ||
237 | **Event category:** SEARCH | ||
238 | **Recommended parameters:** CONTENT_TYPE, SEARCH_STRING, SUCCESS | ||
239 | {{/showhide}} | ||
240 | |||
241 | {{showhide id="14" showmessage="USED_CREDIT" hidemessage="USED_CREDIT" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
242 | \\**Description:** Track use of credit | ||
243 | **Event category:** USED_CREDIT | ||
244 | **Recommended parameters:** PRICE, CONTENT_TYPE, CONTENT_ID, CONTENT | ||
245 | {{/showhide}} | ||
246 | |||
247 | {{showhide id="15" showmessage="UNLOCKED_ACHIEVEMENT" hidemessage="UNLOCKED_ACHIEVEMENT" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
248 | \\**Description:** Track achievement unlock | ||
249 | **Event category:** UNLOCKED_ACHIEVEMENT | ||
250 | **Recommended parameters:** DESCRIPTION | ||
251 | {{/showhide}} | ||
252 | |||
253 | {{showhide id="16" showmessage="VIEW_CONTENT" hidemessage="VIEW_CONTENT" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
254 | \\**Description:** Track content view event | ||
255 | **Event category:** VIEW_CONTENT | ||
256 | **Recommended parameters:** PRICE, CONTENT_TYPE, CONTENT_ID, CONTENT, CURRENCY | ||
257 | {{/showhide}} | ||
258 | |||
259 | {{showhide id="17" showmessage="VIEW_LIST" hidemessage="VIEW_LIST" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
260 | \\**Description:** Track list event | ||
261 | **Event category:** VIEW_LIST | ||
262 | **Recommended parameters:** CONTENT_TYPE, CONTENT_LIST | ||
263 | {{/showhide}} | ||
264 | |||
265 | {{showhide id="18" showmessage="CLICK_AD" hidemessage="CLICK_AD" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
266 | \\**Description:** Track ad click | ||
267 | **Event category:** CLICK_AD | ||
268 | **Recommended parameters:** CONTENT_TYPE, CONTENT_ID | ||
269 | {{/showhide}} | ||
270 | |||
271 | {{showhide id="19" showmessage="VIEW_AD" hidemessage="VIEW_AD" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
272 | \\**Description:** Track view ad | ||
273 | **Event category:** VIEW_AD | ||
274 | **Recommended parameters:** CONTENT_TYPE, CONTENT_ID | ||
275 | {{/showhide}} | ||
276 | |||
277 | {{showhide id="20" showmessage="EVENT_BOOKING" hidemessage="EVENT_BOOKING" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
278 | \\**Description:** Track booking event | ||
279 | **Event category:** EVENT_BOOKING | ||
280 | **Recommended parameters:** REVENUE, DESTINATION_A, DESTINATION_B, CLASS, DESCRIPTION, CUSTOMER_USER_ID, CONTENT_TYPE, CONTENT_ID, DATE_A, DATE_B | ||
281 | {{/showhide}} | ||
282 | |||
283 | {{showhide id="21" showmessage="SHARE" hidemessage="SHARE" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
284 | \\**Description:** Track share event | ||
285 | **Event category:** SHARE | ||
286 | **Recommended parameters:** DESCRIPTION | ||
287 | {{/showhide}} | ||
288 | |||
289 | {{showhide id="22" showmessage="INVITE" hidemessage="INVITE" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
290 | \\**Description:** Track social invite event | ||
291 | **Event category:** INVITE | ||
292 | **Recommended parameters:** NONE | ||
293 | {{/showhide}} | ||
294 | |||
295 | {{showhide id="23" showmessage="LOGIN" hidemessage="LOGIN" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
296 | \\**Description:** Track user login event | ||
297 | **Event category:** LOGIN | ||
298 | **Recommended parameters:** NONE | ||
299 | {{/showhide}} | ||
300 | |||
301 | {{showhide id="24" showmessage="EVENT_RETURN" hidemessage="EVENT_RETURN" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
302 | \\**Description:** Track re engagement event | ||
303 | **Event category:** EVENT_RETURN | ||
304 | **Recommended parameters:** NONE | ||
305 | {{/showhide}} | ||
306 | |||
307 | {{showhide id="25" showmessage="OPENED_PUSH_NOTIFICATION" hidemessage="OPENED_PUSH_NOTIFICATION" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
308 | \\**Description:** Track user opened push notification | ||
309 | **Event category:** OPENED_PUSH_NOTIFICATION | ||
310 | **Recommended parameters:** NONE | ||
311 | {{/showhide}} | ||
312 | |||
313 | {{showhide id="26" showmessage="UPDATE" hidemessage="UPDATE" effect="slide" effectduration="0.3" style="border-radius: 5px; border: 1px solid powderblue; padding: 7px 7px 7px 30px; margin: -1px 0px 0px 0px"}} | ||
314 | \\**Description:** Track update event | ||
315 | **Event category:** UPDATE | ||
316 | **Recommended parameters:** CONTENT_ID | ||
317 | {{/showhide}} | ||
318 | |||
319 | === 3.3.4 Event parameters === | ||
320 | |||
321 | In addition each category that is passed with event may have optional parameters defined as part of the plugin constants, or custom defined as String. Below is a list of recommended parameters. | ||
322 | |||
323 | {{showhide id="1" showmessage="Parameters list" hidemessage="Parameters list" effect="slide" effectduration="0.3"}} | ||
324 | |||
325 | (% class="table-bordered table-hover" %) | ||
326 | |(% style="background-color:powderblue; width:200px" %)**Parameter enum**|(% style="background-color:powderblue; width:200px" %)**Recommended value** | ||
327 | |(% style="width:200px" %)REVENUE|(% style="width:200px" %)FLoat | ||
328 | |(% style="width:200px" %)PRICE|(% style="width:200px" %)Float | ||
329 | |(% style="width:200px" %)LEVEL|(% style="width:200px" %)Integer | ||
330 | |(% style="width:200px" %)SUCCESS|(% style="width:200px" %)Boolean | ||
331 | |(% style="width:200px" %)CONTENT_TYPE|(% style="width:200px" %)String | ||
332 | |(% style="width:200px" %)CONTENT_LIST|(% style="width:200px" %)Array of strings | ||
333 | |(% style="width:200px" %)CONTENT_ID|(% style="width:200px" %)String | ||
334 | |(% style="width:200px" %)CURRENCY|(% style="width:200px" %)String | ||
335 | |(% style="width:200px" %)REGISTRATION_METHOD|(% style="width:200px" %)String | ||
336 | |(% style="width:200px" %)QUANTITY|(% style="width:200px" %)Integer | ||
337 | |(% style="width:200px" %)PAYMENT_INFO_AVAILABLE|(% style="width:200px" %)Boolean | ||
338 | |(% style="width:200px" %)RATING_VALUE|(% style="width:200px" %)Float | ||
339 | |(% style="width:200px" %)MAX_RATING_VALUE|(% style="width:200px" %)Float | ||
340 | |(% style="width:200px" %)SEARCH_STRING|(% style="width:200px" %)String | ||
341 | |(% style="width:200px" %)DESCRIPTION|(% style="width:200px" %)String | ||
342 | |(% style="width:200px" %)SCORE|(% style="width:200px" %)Integer | ||
343 | |(% style="width:200px" %)DESTINATION_A|(% style="width:200px" %)String | ||
344 | |(% style="width:200px" %)DESTINATION_B|(% style="width:200px" %)String | ||
345 | |(% style="width:200px" %)CLASS|(% style="width:200px" %)String | ||
346 | |(% style="width:200px" %)DATE_A|(% style="width:200px" %)String | ||
347 | |(% style="width:200px" %)DATE_B|(% style="width:200px" %)String | ||
348 | |(% style="width:200px" %)EVENT_START|(% style="width:200px" %)Unixtime | ||
349 | |(% style="width:200px" %)EVENT_END|(% style="width:200px" %)Unixtime | ||
350 | |(% style="width:200px" %)LATITUDE|(% style="width:200px" %)Double | ||
351 | |(% style="width:200px" %)LONGITUDE|(% style="width:200px" %)Double | ||
352 | |(% style="width:200px" %)CUSTOMER_USER_ID|(% style="width:200px" %)String | ||
353 | |(% style="width:200px" %)CUSTOMER_SEGMENT|(% style="width:200px" %)String | ||
354 | |(% style="width:200px" %)VALIDATED|(% style="width:200px" %)String | ||
355 | |(% style="width:200px" %)RECEIPT_ID|(% style="width:200px" %)String | ||
356 | |(% style="width:200px" %)ORDER_ID|(% style="width:200px" %)String | ||
357 | |(% style="width:200px" %)TUTORIAL_ID|(% style="width:200px" %)String | ||
358 | |(% style="width:200px" %)ACHIEVEMENT_ID|(% style="width:200px" %)String | ||
359 | |(% style="width:200px" %)VIRTUAL_CURRENCY_NAME|(% style="width:200px" %)String | ||
360 | |(% style="width:200px" %)DEEP_LINK|(% style="width:200px" %)String | ||
361 | |(% style="width:200px" %)OLD_VERSION|(% style="width:200px" %)String | ||
362 | |(% style="width:200px" %)NEW_VERSION|(% style="width:200px" %)String | ||
363 | |(% style="width:200px" %)REVIEW_TEXT|(% style="width:200px" %)String | ||
364 | |(% style="width:200px" %)COUPON_CODE|(% style="width:200px" %)String | ||
365 | |(% style="width:200px" %)DEPARTING_DEPARTURE_DATE|(% style="width:200px" %)String | ||
366 | |(% style="width:200px" %)RETURNING_DEPARTURE_DATE|(% style="width:200px" %)String | ||
367 | |(% style="width:200px" %)DESTINATION_LIST|(% style="width:200px" %)String[] | ||
368 | |(% style="width:200px" %)CITY|(% style="width:200px" %)String | ||
369 | |(% style="width:200px" %)REGION|(% style="width:200px" %)String | ||
370 | |(% style="width:200px" %)COUNTRY|(% style="width:200px" %)String | ||
371 | |(% style="width:200px" %)DEPARTING_ARRIVAL_DATE|(% style="width:200px" %)String | ||
372 | |(% style="width:200px" %)RETURNING_ARRIVAL_DATE|(% style="width:200px" %)String | ||
373 | |(% style="width:200px" %)SUGGESTED_DESTINATIONS|(% style="width:200px" %)String[] | ||
374 | |(% style="width:200px" %)TRAVEL_START|(% style="width:200px" %)String | ||
375 | |(% style="width:200px" %)TRAVEL_END|(% style="width:200px" %)String | ||
376 | |(% style="width:200px" %)NUM_ADULTS|(% style="width:200px" %)Integer | ||
377 | |(% style="width:200px" %)NUM_CHILDREN|(% style="width:200px" %)Integer | ||
378 | |(% style="width:200px" %)NUM_INFANTS|(% style="width:200px" %)Integer | ||
379 | |(% style="width:200px" %)SUGGESTED_HOTELS|(% style="width:200px" %)String[] | ||
380 | |(% style="width:200px" %)USER_SCORE|(% style="width:200px" %)Float | ||
381 | |(% style="width:200px" %)HOTEL_SCORE|(% style="width:200px" %)Float | ||
382 | |(% style="width:200px" %)PURCHASE_CURRENCY|(% style="width:200px" %)String | ||
383 | |(% style="width:200px" %)PREFERRED_STAR_RATINGS|(% style="width:200px" %)Integer[2] | ||
384 | |(% style="width:200px" %)PREFERRED_PRICE_RANGE|(% style="width:200px" %)Integer[2] | ||
385 | |(% style="width:200px" %)PREFERRED_NEIGHBORHOODS|(% style="width:200px" %)String[] | ||
386 | |(% style="width:200px" %)PREFERRED_NUM_STOPS|(% style="width:200px" %)Integer | ||
387 | |(% style="width:200px" %)CONTENT|(% style="width:200px" %)String | ||
388 | |(% style="width:200px" %)PARAM_1|(% style="width:200px" %)String | ||
389 | |(% style="width:200px" %)PARAM_2|(% style="width:200px" %)String | ||
390 | |(% style="width:200px" %)PARAM_3|(% style="width:200px" %)String | ||
391 | |(% style="width:200px" %)PARAM_4|(% style="width:200px" %)String | ||
392 | |(% style="width:200px" %)PARAM_5|(% style="width:200px" %)String | ||
393 | |(% style="width:200px" %)PARAM_6|(% style="width:200px" %)String | ||
394 | |(% style="width:200px" %)PARAM_7|(% style="width:200px" %)String | ||
395 | |(% style="width:200px" %)PARAM_8|(% style="width:200px" %)String | ||
396 | |(% style="width:200px" %)PARAM_9|(% style="width:200px" %)String | ||
397 | |(% style="width:200px" %)PARAM_10|(% style="width:200px" %)String | ||
398 | |||
399 | {{/showhide}} | ||
400 | |||
401 | == 3.4 Remaining methods == | ||
402 | |||
403 | **void setCollectAll()** | ||
404 | This method enables all data collectors. By default all data collectors are enabled. | ||
405 | |||
406 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
407 | {{code language="dart"}} | ||
408 | mobigateInstance.setCollectAll(); | ||
409 | {{/code}} | ||
410 | {{/showhide}} | ||
411 | |||
412 | (% style="color:powderblue" %) | ||
413 | ---- | ||
414 | |||
415 | **void configureDataCollectors(bool enable, List<int> collectors)** | ||
416 | Enable or disable DataCollector by array collectors input | ||
417 | |||
418 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
419 | |=(% style="background-color:powderblue" %)Name|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
420 | |enable|boolean|true if enable, false if disable | ||
421 | |collectors|array of [[data collector const>>doc:||anchor="H4.3Datacollectorsconstants"]]|e.g.,[Mobigate.DATA_COLLECTOR_BATTERY, DATA_COLLECTOR_GEOLOCATION] | ||
422 | |||
423 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
424 | {{code language="dart"}} | ||
425 | mobigateInstance.configureDataCollectors(true, [ | ||
426 | DataCollector.APPS_LIST, | ||
427 | DataCollector.APPS_USAGE, | ||
428 | DataCollector.BROWSER | ||
429 | ]); | ||
430 | {{/code}} | ||
431 | {{/showhide}} | ||
432 | |||
433 | (% style="color:powderblue" %) | ||
434 | ---- | ||
435 | |||
436 | **void disableAllDataCollector()** | ||
437 | Disable all data collectors | ||
438 | |||
439 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
440 | {{code language="dart"}} | ||
441 | mobigateInstance.disableAllDataCollector(); | ||
442 | {{/code}} | ||
443 | {{/showhide}} | ||
444 | |||
445 | (% style="color:powderblue" %) | ||
446 | ---- | ||
447 | |||
448 | **void setEmail(String email)** | ||
449 | Set user's email | ||
450 | |||
451 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
452 | |=(% style="background-color:powderblue" %)Name|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
453 | |email |String |user's email address | ||
454 | |||
455 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
456 | {{code language="dart"}} | ||
457 | mobigateInstance.setEmail('test@spicymobile.pl'); | ||
458 | {{/code}} | ||
459 | {{/showhide}} | ||
460 | |||
461 | (% style="color:powderblue" %) | ||
462 | ---- | ||
463 | |||
464 | **Future<String> getEmail()** | ||
465 | Get previously set user email. Return email on success, error otherwise. | ||
466 | |||
467 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
468 | {{code language="dart"}} | ||
469 | final String email = await mobigateInstance.getEmail(); | ||
470 | {{/code}} | ||
471 | {{/showhide}} | ||
472 | |||
473 | (% style="color:powderblue" %) | ||
474 | ---- | ||
475 | |||
476 | **void setFbToken(String token)** | ||
477 | Set fb token for social network collector | ||
478 | |||
479 | (% class="table-bordered table-hover" style="border-color:powderblue" %) | ||
480 | |=(% style="background-color:powderblue" %)Name|=(% style="background-color:powderblue" %)Type|=(% style="background-color:powderblue" %)Description | ||
481 | |token |string |facebook token | ||
482 | |||
483 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
484 | {{code language="dart"}} | ||
485 | mobigateInstance.setFbToken('dsf87esy789fys9dfu08sds54s6547c8s8doc4'); | ||
486 | {{/code}} | ||
487 | {{/showhide}} | ||
488 | |||
489 | (% style="color:powderblue" %) | ||
490 | ---- | ||
491 | |||
492 | **Future<String> getSDKInfo()** | ||
493 | Getting information about the library. Return on success sdk info string, error otherwise. | ||
494 | |||
495 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
496 | {{code language="dart"}} | ||
497 | final String sdkInfo = await mobigateInstance.getSDKInfo(); | ||
498 | {{/code}} | ||
499 | {{/showhide}} | ||
500 | |||
501 | (% style="color:powderblue" %) | ||
502 | ---- | ||
503 | |||
504 | **Future<String> getSDKUniqueIdentifier()** | ||
505 | Return unique SDK identificator. Return on success sdk unique identifier, error otherwise. | ||
506 | |||
507 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
508 | {{code language="dart"}} | ||
509 | final String sdkUniqueIdentifier = await mobigateInstance.getSDKUniqueIdentifier(); | ||
510 | {{/code}} | ||
511 | {{/showhide}} | ||
512 | |||
513 | (% style="color:powderblue" %) | ||
514 | ---- | ||
515 | |||
516 | **Future<List<int>> getIDsProfiles()** | ||
517 | Method returns IDs profiles. List of IDs profiles in the application memory is updated (synchronized with the server) at specified intervals. To enable functionality, use the 'enableIDsProfiles (boolean enable)' method. Returns the identifiers of IDs profiles (ex. 5,9,20), returns '0' if list of user IDs profiles is empty, returns 'null' if the system has not yet communicated | ||
518 | |||
519 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
520 | {{code language="dart"}} | ||
521 | final List<int> idsProfiles = await mobigateInstance.getIDsProfiles(); | ||
522 | {{/code}} | ||
523 | {{/showhide}} | ||
524 | |||
525 | (% style="color:powderblue" %) | ||
526 | ---- | ||
527 | |||
528 | **Future<Map<String, int>> getAdOceanTargeting()** | ||
529 | Getting numerical variables, that can be used for ads targeting. Method must be called from separate thread. Return 3 different identifiers of a user, encoded into a map of AdOcean numerical variables | ||
530 | |||
531 | {{showhide id="3" showmessage="Example" hidemessage="Example"}} | ||
532 | {{code language="dart"}} | ||
533 | final Map<String,int> adOceanTargeting = await mobigateInstance.getAdOceanTargeting(); | ||
534 | {{/code}} | ||
535 | {{/showhide}} | ||
536 | |||
537 | = 4. Constants = | ||
538 | |||
539 | The plugin provides many helpful constants for easier implementation. | ||
540 | |||
541 | == 4.1 User field constants == | ||
542 | |||
543 | Used to set custom user fields inside //Mobigate.init()// method: | ||
544 | |||
545 | * UserField.USER_FIELD_EMAIL | ||
546 | * UserField.USER_FIELD_IMSI | ||
547 | * UserField.USER_FIELD_IMEI | ||
548 | * UserField.USER_FIELD_SERIAL | ||
549 | |||
550 | == 4.2 Data gather policy constants == | ||
551 | |||
552 | Used to set how the library collects data: | ||
553 | |||
554 | * MonitorState.DATA_GATHER_POLICY_DEFAULT | ||
555 | * MonitorState.DATA_GATHER_POLICY_HIDE_TRAY | ||
556 | * MonitorState.DATA_GATHER_POLICY_BLOCK_DATA_BG | ||
557 | |||
558 | == 4.3 Data collectors constants == | ||
559 | |||
560 | Used to set which data the library should collect: | ||
561 | |||
562 | * DataCollector.APPS_LIST | ||
563 | * DataCollector.DATA_COLLECTOR_APPS_USAGE | ||
564 | * DataCollector.BATTERY | ||
565 | * DataCollector.BROWSER | ||
566 | * DataCollector.CALENDAR_EVENTS | ||
567 | * DataCollector.CPU_PROCESS | ||
568 | * DataCollector.DICTIONARY | ||
569 | * DataCollector.GEOLOCATION | ||
570 | * DataCollector.HEADSET_PLUG | ||
571 | * DataCollector.MEDIA_FILES | ||
572 | * DataCollector.MEMORY_USEAGE | ||
573 | * DataCollector.NETWORK_CONNECTION | ||
574 | * DataCollector.NETWORK_USEAGE | ||
575 | * DataCollector.PACKAGE_CHANGE | ||
576 | * DataCollector.PHONE_INFO | ||
577 | * DataCollector.ROAMING | ||
578 | * DataCollector.SCREEN_ORIENTED | ||
579 | * DataCollector.SIGNAL_STRENGTH | ||
580 | * DataCollector.PROFILE_MODE | ||
581 | * DataCollector.WIFI_DATA_CONNECTION | ||
582 | * DataCollector.PERMISSION_COLLECTOR | ||
583 | * DataCollector.NFC_COLLECTOR | ||
584 | * DataCollector.BLUETOOTH_COLLECTOR | ||
585 | * DataCollector.BLUETOOTH_DEVICES_COLLECTOR | ||
586 | * DataCollector.MOVEMENT_COLLECTOR | ||
587 | * DataCollector.FACEBOOK_NETWORK_COLLECTOR | ||
588 | * DataCollector.ROOT_COLLECTOR | ||
589 | |||
590 | == 4.4 Category and parameter constants == | ||
591 | |||
592 | Instead of using defined [[categories>>doc:||anchor="H3.3.3Eventcategories"]] or [[parameters>>doc:||anchor="H3.3.4Eventparameters"]] in the form of text, you can use constants defined in the plugin. All you have to do is use EventCategory or EventParameter class e.g., EventCategory.LEVEL_ACCOMPLISHED, EventCategory.PURCHASE, EventParameter.PRICE, EventParameter.LEVEL. | ||
593 | |||
594 | = 5. Sample app = | ||
595 | |||
596 | The sample application is located in the github repository [[here>>https://github.com/mobigatesdk/flutter_mobigate]] in //example// folder. |