|
1 | 1 | import { NativeModules } from 'react-native';
|
2 | 2 |
|
3 | 3 | interface IMyTracker {
|
| 4 | + /** |
| 5 | + * Initializing the tracker |
| 6 | + */ |
4 | 7 | initTracker(SDK_KEY: string): void;
|
| 8 | + /** |
| 9 | + * An arbitrary event with a given name. |
| 10 | + */ |
5 | 11 | trackEvent(name: string): void;
|
| 12 | + /** |
| 13 | + * An arbitrary event with a given name. The optional attributes parameter allows you to set arbitrary key-value parameters for the event. Maximum length of name, key and value is 255 characters. |
| 14 | + */ |
6 | 15 | trackEventWithParams(name: string, attributes: Object): void;
|
| 16 | + /** |
| 17 | + * To track statistics not only by device, but also by user, set the customUserId parameter. This is the unique identifier of the user in your project, which you assign to him at the moment of registration. It must remain unchanged even if the user logs in on a different device. By setting this parameter, you can estimate the size and activity of the app's audience, regardless of how many devices the user has your app on. And you won't lose the history of accumulated data on the user if he decides to switch devices. |
| 18 | + * It is important to set the parameter before event tracking to pass the user ID with each tracked event. |
| 19 | + */ |
7 | 20 | setCustomUserId(USER_ID: string): void;
|
| 21 | + /** |
| 22 | + * Authorization event. The method must be called immediately after the user registers with the application. vkConnectId can be empty string. |
| 23 | + */ |
8 | 24 | trackLoginEvent(userId: string, vkConnectId: string): void;
|
| 25 | + /** |
| 26 | + * Authorization event. The method must be called immediately after the user registers with the application. vkConnectId can be empty string. The user ID must be passed in the userId parameter. |
| 27 | + */ |
9 | 28 | trackLoginEventWithParams(
|
10 | 29 | userId: string,
|
11 | 30 | vkConnectId: string,
|
12 | 31 | attributes: Object
|
13 | 32 | ): void;
|
| 33 | + /** |
| 34 | + * An event to send an invitation. |
| 35 | + */ |
14 | 36 | trackInviteEvent(): void;
|
| 37 | + /** |
| 38 | + * An event to send an invitation. The optional eventParams parameter allows you to set arbitrary key-value parameters for the event. The maximum length of key and value is 255 characters. |
| 39 | + */ |
15 | 40 | trackInviteEventWithParams(attributes: Object): void;
|
| 41 | + /** |
| 42 | + * Forcing all events to be sent and resetting the send timer. |
| 43 | +To reduce the channel load and minimize the impact on application performance, the SDK buffers all events on the device before sending them to the server, and regularly sends the collected data in a compressed packet. By default, data is sent to the server every 15 minutes. This interval can be set via the bufferingPeriod parameter from 1 second to 1 day. If the user has closed the application, it will be sent the next time it is started. But some events are very important to get to the analytics as early as possible, especially in the first sessions after the installation of the application. The flush() method will help here. |
| 44 | + */ |
16 | 45 | flush(): void;
|
| 46 | + /** |
| 47 | + * Registration event. The method must be called immediately after the user registers with the application. vkConnectId can be empty string. |
| 48 | + */ |
17 | 49 | trackRegistrationEvent(userId: string, vkConnectId: string): void;
|
| 50 | + /** |
| 51 | + * Registration event. The method must be called immediately after the user registers with the application. vkConnectId can be empty string. The user ID must be passed in the userId parameter. |
| 52 | + */ |
18 | 53 | trackRegistrationEventWithParams(
|
19 | 54 | userId: string,
|
20 | 55 | vkConnectId: string,
|
21 | 56 | attributes: Object
|
22 | 57 | ): void;
|
| 58 | + /** |
| 59 | + * The event of reaching a level without level number (level parameter). |
| 60 | + */ |
23 | 61 | trackLevel(): void;
|
| 62 | + /** |
| 63 | + * The event of reaching a level with level number (level parameter). |
| 64 | + */ |
24 | 65 | trackLevelWithLevel(level: number): void;
|
| 66 | + /** |
| 67 | + * The event of reaching a level with level number (level parameter). Additional parameter eventParams allows to set arbitrary key-value parameters for event. Maximum length of key and value is 255 characters. |
| 68 | + */ |
25 | 69 | trackLevelWithLevelWithParams(level: number, params: Object): void;
|
| 70 | + /** |
| 71 | + * Tracking application launches. The default is true. |
| 72 | + * @default true |
| 73 | + */ |
26 | 74 | trackLaunchEnable(enable: boolean): void;
|
| 75 | + /** |
| 76 | + * Interval in seconds during which a new startup will not be counted and the session will be interrupted when the application is minimized. The default is 30 seconds. You can set the value in the range of 30-7200 seconds. |
| 77 | + * @default 30 |
| 78 | + */ |
27 | 79 | trackLaunchTimeout(seconds: number): void;
|
| 80 | + /** |
| 81 | + * Interval in seconds during which events will be accumulated on the device before being sent to the server. The default setting is 900 seconds. You can set the value in the range of 1-86400 seconds (1 day). |
| 82 | + * @default 900 |
| 83 | + */ |
28 | 84 | bufferingPeriod(seconds: number): void;
|
| 85 | + /** |
| 86 | + * Interval in seconds after installing or updating an application, during which events will be immediately sent to the server without local buffering. The default is 0 seconds (immediate sending is disabled). You can set a value in the range of 0-432000 seconds (5 days). |
| 87 | + */ |
29 | 88 | forcingPeriod(seconds: number): void;
|
| 89 | + /** |
| 90 | + * Automatic in-app purchase tracking. The default is true. |
| 91 | + * @default true |
| 92 | + */ |
30 | 93 | autotrackPurchase(enable: boolean): void;
|
| 94 | + /** |
| 95 | + * Tracking the user's location. The default is false. |
| 96 | +If your application requests access to the device's location, you can enable this option to improve the accuracy of statistics related to the user's geography. In some cases, location tracking also improves attribution and predictive model performance. |
| 97 | + * @default 0 |
| 98 | + * @platform IOS: |
| 99 | + * 0 — location is not tracked; |
| 100 | + * 1 — uses the system's cached value; |
| 101 | + * 2 — uses a request for the current location (default); |
| 102 | + * @platform Android: |
| 103 | + * 0 - do not track the user's location (default); |
| 104 | + * 1 or 2 - track the user's location; |
| 105 | + */ |
31 | 106 | trackLocation(number: 0 | 1 | 2): void;
|
| 107 | + /** |
| 108 | + * The region where the statistics collection server is located. The need to change the region may arise, for example, due to legal requirements. Available values: |
| 109 | + * @default 0 |
| 110 | + * 0 — region not set(default value) |
| 111 | + * 1 — server located on the territory of the Russian Federation |
| 112 | + * 2 — server located in Europe |
| 113 | + */ |
32 | 114 | region(region: 0 | 1 | 2): void;
|
| 115 | + /** |
| 116 | + * Enables/disables debug mode. The default is false. |
| 117 | + * @default 0 |
| 118 | + */ |
33 | 119 | setDebugMode(enable: boolean): void;
|
34 | 120 | }
|
35 | 121 | const MyTracker: IMyTracker = NativeModules.MyTracker;
|
|
0 commit comments