Skip to content

Commit 0d5ab54

Browse files
committed
feat: js doc
1 parent 8da4359 commit 0d5ab54

File tree

2 files changed

+97
-11
lines changed

2 files changed

+97
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ MyTracker.bufferingPeriod(30);
4444
MyTracker.forcingPeriod(30);
4545

4646
//for IOS:
47-
// 0 = MRLocationTrackingModeNone — отслеживание местоположения не производится
48-
// 1 = MRLocationTrackingModeCached — используется закэшированное системой значение
49-
// 2 = MRLocationTrackingModeActive — используется запрос текущего местоположения (по умолчанию)
47+
// 0 = MRLocationTrackingModeNone — location is not tracked
48+
// 1 = MRLocationTrackingModeCached — uses the system's cached value
49+
// 2 = MRLocationTrackingModeActive — uses a request for the current location (default)
5050
// for Android:
51-
// 0 = false - не отслеживать местоположение пользователя (по умолчанию)
52-
// 1 or 2 = true - отслеживать местоположение пользователя
51+
// 0 = false - do not track the user's location (default)
52+
// 1 or 2 = true - track the user's location
5353
MyTracker.trackLocation(0);
5454

5555
//for IOS:
56-
// 0 = MRRegionNotSet — значение по умолчанию
57-
// 1 = MRRegionRu — сервер, расположенный на территории Российской Федерации
58-
// 2 = MRRegionEu — сервер, расположенный на территории Европы
56+
// 0 = MRRegionNotSet — default value
57+
// 1 = MRRegionRu — server located on the territory of the Russian Federation
58+
// 2 = MRRegionEu — server located in Europe
5959
// for Android:
60-
// 0 - значение по умолчанию
61-
// 1 = Region.RU — сервер, расположенный на территории Российской Федерации
62-
// 2 = Region.EU — сервер, расположенный на территории Европы
60+
// 0 - default value
61+
// 1 = Region.RU — server located on the territory of the Russian Federation
62+
// 2 = Region.EU — server located in Europe
6363
MyTracker.region(0);
6464

6565
MyTracker.setDebugMode(false);

src/index.tsx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,121 @@
11
import { NativeModules } from 'react-native';
22

33
interface IMyTracker {
4+
/**
5+
* Initializing the tracker
6+
*/
47
initTracker(SDK_KEY: string): void;
8+
/**
9+
* An arbitrary event with a given name.
10+
*/
511
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+
*/
615
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+
*/
720
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+
*/
824
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+
*/
928
trackLoginEventWithParams(
1029
userId: string,
1130
vkConnectId: string,
1231
attributes: Object
1332
): void;
33+
/**
34+
* An event to send an invitation.
35+
*/
1436
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+
*/
1540
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+
*/
1645
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+
*/
1749
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+
*/
1853
trackRegistrationEventWithParams(
1954
userId: string,
2055
vkConnectId: string,
2156
attributes: Object
2257
): void;
58+
/**
59+
* The event of reaching a level without level number (level parameter).
60+
*/
2361
trackLevel(): void;
62+
/**
63+
* The event of reaching a level with level number (level parameter).
64+
*/
2465
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+
*/
2569
trackLevelWithLevelWithParams(level: number, params: Object): void;
70+
/**
71+
* Tracking application launches. The default is true.
72+
* @default true
73+
*/
2674
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+
*/
2779
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+
*/
2884
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+
*/
2988
forcingPeriod(seconds: number): void;
89+
/**
90+
* Automatic in-app purchase tracking. The default is true.
91+
* @default true
92+
*/
3093
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+
*/
31106
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+
*/
32114
region(region: 0 | 1 | 2): void;
115+
/**
116+
* Enables/disables debug mode. The default is false.
117+
* @default 0
118+
*/
33119
setDebugMode(enable: boolean): void;
34120
}
35121
const MyTracker: IMyTracker = NativeModules.MyTracker;

0 commit comments

Comments
 (0)