Skip to content

Commit 175a592

Browse files
authored
Merge pull request #327 from Countly/event-module
added event module
2 parents 40fdd33 + 0b9f064 commit 175a592

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1208
-521
lines changed

CHANGELOG.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
## X.X.X
1+
## 24.4.0
22
* ! Minor breaking change ! Tracking of foreground and background time for APM is disabled by default
33

4-
* Added 'disableAdditionalIntentRedirectionChecks' config method
4+
* Added `disableAdditionalIntentRedirectionChecks` config method
55
* Added a new metric for detecting whether or not a device has a hinge for Android
6-
* Added four new APM configuration options under the 'apm' interface of 'CountlyConfig':
7-
* 'enableForegroundBackgroundTracking' for enabling automatic F/B time tracking
8-
* 'enableAppStartTimeTracking' for enabling automatic app launch time tracking (Android only)
9-
* 'enableManualAppLoadedTrigger' for enabling the manipulation of app load time finished timestamp
10-
* 'setAppStartTimestampOverride' for enabling the manipulation of app load time starting timestamp
11-
12-
Deprecated 'enableApm' config option. Use instead 'apm.enableAppStartTimeTracking'. (for iOS also 'enableForegroundBackgroundTracking' must be used)
13-
14-
* Fixed a bug in `getRemoteConfigValueForKeyP` and `remoteConfigClearValues` where those functions would produce a "Property 'callback' doesn't exist", if they are called before initializing the SDK.
15-
16-
* Updated the underlying Android SDK version to 24.1.1
17-
* Updated the underlying iOS SDK version to 24.1.0
6+
* Added four new APM configuration options under the `CountlyConfig.apm` interface:
7+
* `enableForegroundBackgroundTracking` for enabling automatic F/B time tracking
8+
* `enableAppStartTimeTracking` for enabling automatic app launch time tracking (Android only)
9+
* `enableManualAppLoadedTrigger` for enabling the manipulation of app load time finished timestamp
10+
* `setAppStartTimestampOverride` for enabling the manipulation of app load time starting timestamp
11+
* Added a new Event interface (`Countly.events`) that groups event related calls:
12+
* `recordEvent` for recording an event
13+
* `startEvent` for starting a timed event
14+
* `cancelEvent` for canceling an ongoing timed event
15+
* `endEvent` for ending a timed event and record it
16+
17+
* Mitigated an issue with `getRemoteConfigValueForKeyP` and `remoteConfigClearValues` happening when they were called before initializing the SDK
18+
19+
* Deprecated `enableApm` config option. Use `apm.enableAppStartTimeTracking` instead (for iOS also `enableForegroundBackgroundTracking` must be used)
20+
* Deprecated the old events methods:
21+
* `sendEvent` use `Countly.events.recordEvent` instead
22+
* `startEvent` use `Countly.events.startEvent` instead
23+
* `cancelEvent` use `Countly.events.cancelEvent` instead
24+
* `endEvent` use `Countly.events.endEvent` instead
25+
26+
* Updated the underlying Android SDK version to 24.4.0
27+
* Updated the underlying iOS SDK version to 24.4.0
1828

1929
## 23.12.0
2030
* Added TS type declerations to the SDK

Countly.d.ts

Lines changed: 113 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface Segmentation {
2-
[key: string]: string;
2+
[key: string]: number | string | boolean;
33
}
44

55
interface CountlyEventOptions {
@@ -67,17 +67,17 @@ declare module "countly-sdk-react-native-bridge" {
6767
import type CountlyConfig from "countly-sdk-react-native-bridge/CountlyConfig";
6868

6969
namespace Countly {
70-
serverUrl: string;
71-
appKey: string;
72-
eventEmitter: any;
73-
CountlyReactNative: any;
74-
_isCrashReportingEnabled: boolean;
75-
_isInitialized: boolean;
76-
_isPushInitialized: boolean;
77-
widgetShownCallbackName: string;
78-
widgetClosedCallbackName: string;
79-
ratingWidgetCallbackName: string;
80-
pushNotificationCallbackName: string;
70+
string;
71+
string;
72+
any;
73+
any;
74+
boolean;
75+
boolean;
76+
boolean;
77+
string;
78+
string;
79+
string;
80+
string;
8181
export const TemporaryDeviceIDString: string;
8282
export interface messagingMode {
8383
DEVELOPMENT: string;
@@ -126,6 +126,56 @@ declare module "countly-sdk-react-native-bridge" {
126126
export function reportFeedbackWidgetManually(widgetInfo: FeedbackWidget, widgetData: object, widgetResult: RatingWidgetResult | object): Promise<ErrorObject>;
127127
}
128128

129+
/**
130+
* Countly Event Module
131+
*/
132+
namespace events {
133+
/**
134+
* Records an event.
135+
* Event will be saved to the internal queue and will be sent to the server with the next trigger.
136+
*
137+
* @param {string} eventName - Name of the event (This will be displayed on the dashboard)
138+
* @param {Segmentation} segmentation - Extra information to send with your event as key/value pairs
139+
* @param {number} eventCount - Indicates how many times this event has happened (Default is 1)
140+
* @param {number} eventSum - A numerical value that is attached to this event (Will be summed up on the dashboard for all events with the same name)
141+
* @return {void}
142+
*/
143+
export function recordEvent(eventName: string, segmentation?: Segmentation, eventCount?: number, eventSum?: number): void;
144+
145+
/**
146+
*
147+
* Starts a Timed Event
148+
* If 'endEvent' is not called (with the same event name) no event will be recorded.
149+
*
150+
* @param {string} eventName - name of the event
151+
* @return {void}
152+
*/
153+
export function startEvent(eventName: string): void;
154+
155+
/**
156+
*
157+
* Ends a Timed Event if it is started.
158+
* Should be called after startEvent.
159+
* This will behave like recordEvent.
160+
*
161+
* @param {string} eventName - Name of the event (This will be displayed on the dashboard)
162+
* @param {Segmentation} segmentation - Extra information to send with your event as key/value pairs
163+
* @param {number} eventCount - Indicates how many times this event has happened (Default is 1)
164+
* @param {number} eventSum - A numerical value that is attached to this event (Will be summed up on the dashboard for all events with the same name)
165+
* @return {void} void
166+
*/
167+
export function endEvent(eventName: string, segmentation?: Segmentation, eventCount?: number, eventSum?: number): void;
168+
169+
/**
170+
*
171+
* Cancels a Timed Event if it is started.
172+
*
173+
* @param {string} eventName - name of the event
174+
* @return {void}
175+
*/
176+
export function cancelEvent(eventName: string): void;
177+
}
178+
129179
/**
130180
* Initialize Countly
131181
*
@@ -167,6 +217,7 @@ declare module "countly-sdk-react-native-bridge" {
167217
/**
168218
*
169219
* Used to send various types of event;
220+
* @deprecated in 24.4.0 : use 'Countly.events.recordEvent' instead of this.
170221
*
171222
* @param {CountlyEventOptions} options event
172223
* @return {string | void} error message or void
@@ -444,6 +495,7 @@ declare module "countly-sdk-react-native-bridge" {
444495
/**
445496
*
446497
* Start Event
498+
* @deprecated in 24.4.0 : use 'Countly.events.startEvent' instead of this.
447499
*
448500
* @param {string} eventName name of event
449501
* @return {string | void} error message or void
@@ -453,6 +505,7 @@ declare module "countly-sdk-react-native-bridge" {
453505
/**
454506
*
455507
* Cancel Event
508+
* @deprecated in 24.4.0 : use 'Countly.events.cancelEvent' instead of this.
456509
*
457510
* @param {string} eventName name of event
458511
* @return {string | void} error message or void
@@ -462,6 +515,7 @@ declare module "countly-sdk-react-native-bridge" {
462515
/**
463516
*
464517
* End Event
518+
* @deprecated in 24.4.0 : use 'Countly.events.endEvent' instead of this.
465519
*
466520
* @param {string | object} options event options
467521
* @return {string | void} error message or void
@@ -1032,11 +1086,11 @@ declare module "countly-sdk-react-native-bridge" {
10321086
* @return {string | void} error message or void
10331087
*/
10341088
export function setCustomMetrics(customMetric: CustomMetric): string | void;
1035-
validateUserDataValue: ValidationFunction;
1036-
validateUserDataType: ValidationFunction;
1037-
validateValidUserData: ValidationFunction;
1038-
validateParseInt: ValidationFunction;
1039-
logWarning: (functionName: string, warning: string) => Promise<void>;
1089+
ValidationFunction;
1090+
ValidationFunction;
1091+
ValidationFunction;
1092+
ValidationFunction;
1093+
(functionName: string, warning: string) => Promise<void>;
10401094
}
10411095

10421096
export default Countly;
@@ -1082,103 +1136,103 @@ declare module "countly-sdk-react-native-bridge/CountlyConfig" {
10821136
*
10831137
*/
10841138
declare class CountlyConfig {
1085-
/**
1139+
/**
10861140
* @param {string} serverURL server url
10871141
* @param {string} appKey application key
10881142
*/
1089-
constructor(serverURL: string, appKey: string);
1143+
constructor(serverURL: string, appKey: string);
10901144

1091-
/**
1145+
/**
10921146
* getter for CountlyConfigApm instance that is used to access CountlyConfigApm methods
10931147
*/
1094-
apm: CountlyConfigApm;
1148+
apm: CountlyConfigApm;
10951149

1096-
/**
1150+
/**
10971151
* Method to set the server url
10981152
*
10991153
* @param {string} serverURL server url
11001154
*/
1101-
setServerURL(serverURL: string): CountlyConfig;
1155+
setServerURL(serverURL: string): CountlyConfig;
11021156

1103-
/**
1157+
/**
11041158
* Method to set the app key
11051159
*
11061160
* @param {string} appKey application key
11071161
*/
1108-
setAppKey(appKey: string): CountlyConfig;
1162+
setAppKey(appKey: string): CountlyConfig;
11091163

1110-
/**
1164+
/**
11111165
* Method to set the device id
11121166
*
11131167
* @param {string} deviceID device id
11141168
*/
1115-
setDeviceID(deviceID: string): CountlyConfig;
1169+
setDeviceID(deviceID: string): CountlyConfig;
11161170

1117-
/**
1171+
/**
11181172
* Method to enable countly internal debugging logs
11191173
*
11201174
* @param {boolean} loggingEnabled enable
11211175
* if true, countly sdk would log to console.
11221176
*/
1123-
setLoggingEnabled(loggingEnabled: boolean): CountlyConfig;
1177+
setLoggingEnabled(loggingEnabled: boolean): CountlyConfig;
11241178

1125-
/**
1179+
/**
11261180
* Method to enable crash reporting to report unhandled crashes to Countly
11271181
*/
1128-
enableCrashReporting(): CountlyConfig;
1182+
enableCrashReporting(): CountlyConfig;
11291183

1130-
/**
1184+
/**
11311185
* Method to set if the consent feature is enabled.
11321186
*
11331187
* If set to true, no feature will work without consent being given.
11341188
*
11351189
* @param {boolean} shouldRequireConsent required. True: It is enabled. False:
11361190
* It is disabled.
11371191
*/
1138-
setRequiresConsent(shouldRequireConsent: boolean): CountlyConfig;
1192+
setRequiresConsent(shouldRequireConsent: boolean): CountlyConfig;
11391193

1140-
/**
1194+
/**
11411195
* Method to give consent for specific features before init
11421196
*
11431197
* @param {string[]} consents consents e.g ['location', 'sessions',
11441198
* 'attribution', 'push', 'events', 'views', 'crashes', 'users', 'push',
11451199
* 'star-rating', 'apm', 'feedback', 'remote-config']
11461200
*/
1147-
giveConsent(consents: readonly string[]): CountlyConfig;
1201+
giveConsent(consents: readonly string[]): CountlyConfig;
11481202

1149-
/**
1203+
/**
11501204
* Method to set the user initial location
11511205
*
11521206
* @param {string} locationCountryCode country code e.g 'TR'
11531207
* @param {string} locationCity city e.g 'Istanbul'
11541208
* @param {string} locationGpsCoordinates gps coordinates e.g '41.0082,28.9784'
11551209
* @param {string} locationIpAddress ip address e.g '10.2.33.12'
11561210
*/
1157-
setLocation(locationCountryCode: string, locationCity: string, locationGpsCoordinates: string, locationIpAddress: string): CountlyConfig;
1211+
setLocation(locationCountryCode: string, locationCity: string, locationGpsCoordinates: string, locationIpAddress: string): CountlyConfig;
11581212

1159-
/**
1213+
/**
11601214
* Method to enable tamper protection. This sets the optional salt to be
11611215
* used for calculating the checksum of requested data which will be sent
11621216
* with each request
11631217
*
11641218
* @param {string} tamperingProtectionSalt salt
11651219
*/
1166-
enableParameterTamperingProtection(tamperingProtectionSalt: string): CountlyConfig;
1220+
enableParameterTamperingProtection(tamperingProtectionSalt: string): CountlyConfig;
11671221

1168-
/**
1222+
/**
11691223
* @deprecated in 24.1.0 : use 'countlyConfig.apm' interface instead of 'config.enableApm'.
11701224
*
11711225
* Method to enable application performance monitoring which includes the recording of app start time.
11721226
*/
1173-
enableApm(): CountlyConfig;
1227+
enableApm(): CountlyConfig;
11741228

1175-
/**
1229+
/**
11761230
* AdditionalIntentRedirectionChecks are enabled by default.
11771231
* This method should be used to disable them.
11781232
*/
1179-
disableAdditionalIntentRedirectionChecks(): CountlyConfig;
1233+
disableAdditionalIntentRedirectionChecks(): CountlyConfig;
11801234

1181-
/**
1235+
/**
11821236
* Method to set the push token type
11831237
* @deprecated
11841238
* Use setPushTokenType() instead to set pushToken
@@ -1188,66 +1242,66 @@ declare module "countly-sdk-react-native-bridge/CountlyConfig" {
11881242
* @param {string} channelName channel name
11891243
* @param {string} channelDescription channel description
11901244
*/
1191-
pushTokenType(tokenType: TokenType, channelName: string, channelDescription: string): CountlyConfig;
1245+
pushTokenType(tokenType: TokenType, channelName: string, channelDescription: string): CountlyConfig;
11921246

1193-
/**
1247+
/**
11941248
* Method to set the push token type
11951249
* NB: ONLY FOR iOS
11961250
*
11971251
* @param {Countly.messagingMode} tokenType token type
11981252
* Possible values include 'DEVELOPMENT', 'PRODUCTION', 'ADHOC'.
11991253
*/
1200-
setPushTokenType(tokenType: messagingMode): CountlyConfig;
1254+
setPushTokenType(tokenType: messagingMode): CountlyConfig;
12011255

1202-
/**
1256+
/**
12031257
* Method to set the push channel name and description
12041258
* NB: ONLY FOR ANDROID
12051259
*
12061260
* @param {string} name channel name
12071261
* @param {string} description channel description
12081262
*/
1209-
setPushNotificationChannelInformation(name: string, description: string): CountlyConfig;
1263+
setPushNotificationChannelInformation(name: string, description: string): CountlyConfig;
12101264

1211-
/**
1265+
/**
12121266
* Method to set the push notification accent color
12131267
* NB: ONLY FOR ANDROID
12141268
*
12151269
* @param {string} accentColor notification accent color
12161270
* example '#000000'
12171271
*/
1218-
setPushNotificationAccentColor(accentColor: string): CountlyConfig;
1272+
setPushNotificationAccentColor(accentColor: string): CountlyConfig;
12191273

1220-
/**
1274+
/**
12211275
* Method to configure intent redirection check
12221276
*
12231277
* @param {string[]} allowedIntentClassNames allowed intent class names
12241278
* @param {string[]} allowedIntentPackageNames allowed intent package name
12251279
*/
1226-
configureIntentRedirectionCheck(allowedIntentClassNames: readonly string[], allowedIntentPackageNames: readonly string[]): CountlyConfig;
1280+
configureIntentRedirectionCheck(allowedIntentClassNames: readonly string[], allowedIntentPackageNames: readonly string[]): CountlyConfig;
12271281

1228-
/**
1282+
/**
12291283
* Method to set star rating dialog text
12301284
*
12311285
* @param {string} starRatingTextTitle title
12321286
* @param {string} starRatingTextMessage message
12331287
* @param {string} starRatingTextDismiss dismiss
12341288
*/
1235-
setStarRatingDialogTexts(starRatingTextTitle: string, starRatingTextMessage: string, starRatingTextDismiss: string): CountlyConfig;
1289+
setStarRatingDialogTexts(starRatingTextTitle: string, starRatingTextMessage: string, starRatingTextDismiss: string): CountlyConfig;
12361290

1237-
/**
1291+
/**
12381292
* Report direct user attribution
12391293
*
12401294
* @param {string} campaignType campaign type
12411295
* @param {object} campaignData campaign data
12421296
*/
1243-
recordDirectAttribution(campaignType: string, campaignData: object): CountlyConfig;
1297+
recordDirectAttribution(campaignType: string, campaignData: object): CountlyConfig;
12441298

1245-
/**
1299+
/**
12461300
* Report indirect user attribution
12471301
*
12481302
* @param {object} attributionValues attribution values
12491303
*/
1250-
recordIndirectAttribution(attributionValues: object): CountlyConfig;
1304+
recordIndirectAttribution(attributionValues: object): CountlyConfig;
12511305
}
12521306

12531307
export default CountlyConfig;

0 commit comments

Comments
 (0)