Skip to content

Commit 9b5734d

Browse files
authored
Remove refs to trackAttributionData and upgrade deps (#230)
* refactor(react-native): remove trackAttributionData property * fix(react-native): update deps * fix(react-native): mark property as deprecated instead of removing * fix(ios): update ios deps
1 parent 8a0bf12 commit 9b5734d

File tree

14 files changed

+66
-82
lines changed

14 files changed

+66
-82
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ analytics
8888
using: [mixpanel, firebase],
8989
recordScreenViews: true,
9090
trackAppLifecycleEvents: true,
91-
trackAttributionData: true,
9291

9392
android: {
9493
flushInterval: 60000, // 60 seconds

packages/core/RNAnalytics.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
2020
s.source_files = 'ios/**/*.{m,h}'
2121
s.static_framework = true
2222

23-
s.dependency 'Analytics', '~> 4.0'
23+
s.dependency 'Analytics', '~> 4.1'
2424
s.dependency 'React'
2525
end
2626

packages/core/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939
}
4040

4141
dependencies {
42-
api 'com.segment.analytics.android:analytics:4.+'
42+
api 'com.segment.analytics.android:analytics:4.9.0'
4343

4444
api 'com.facebook.react:react-native:+'
4545
api "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : defaultKotlinVersion}"

packages/core/android/src/main/java/com/segment/analytics/reactnative/core/RNAnalyticsModule.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ class RNAnalyticsModule(context: ReactApplicationContext): ReactContextBaseJavaM
128128
builder.recordScreenViews()
129129
}
130130

131-
132-
if(options.getBoolean("trackAttributionData")) {
133-
builder.trackAttributionInformation()
134-
}
135-
136131
if(options.hasKey("android") && options.getType("android") == ReadableType.Map) {
137132
val androidOptions = options.getMap("android")!!
138133
if(androidOptions.hasKey("flushInterval")) {

packages/core/docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
**Ƭ Integration**: *`function` \| `object`*
2626

27-
*Defined in analytics.ts:8*
27+
*Defined in [analytics.ts:8](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L8)*
2828

2929
___
3030

packages/core/docs/classes/analytics.client.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
**● ready**: *`false`* = false
4242

43-
*Defined in analytics.ts:147*
43+
*Defined in [analytics.ts:146](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L146)*
4444

4545
Whether the client is ready to send events to Segment.
4646

@@ -56,7 +56,7 @@ ___
5656

5757
**alias**(newId: *`string`*, options?: *[Options]()*): `Promise`<`void`>
5858

59-
*Defined in analytics.ts:325*
59+
*Defined in [analytics.ts:324](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L324)*
6060

6161
Merge two user identities, effectively connecting two sets of user data as one. This may not be supported by all integrations.
6262

@@ -78,7 +78,7 @@ ___
7878

7979
**catch**(handler: *[ErrorHandler]()*): `this`
8080

81-
*Defined in analytics.ts:162*
81+
*Defined in [analytics.ts:161](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L161)*
8282

8383
Catch React-Native bridge errors
8484

@@ -99,7 +99,7 @@ ___
9999

100100
**disable**(): `Promise`<`void`>
101101

102-
*Defined in analytics.ts:364*
102+
*Defined in [analytics.ts:363](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L363)*
103103

104104
Completely disable the sending of any analytics data.
105105

@@ -114,7 +114,7 @@ ___
114114

115115
**enable**(): `Promise`<`void`>
116116

117-
*Defined in analytics.ts:354*
117+
*Defined in [analytics.ts:353](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L353)*
118118

119119
Enable the sending of analytics data. Enabled by default.
120120

@@ -129,7 +129,7 @@ ___
129129

130130
**flush**(): `Promise`<`void`>
131131

132-
*Defined in analytics.ts:345*
132+
*Defined in [analytics.ts:344](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L344)*
133133

134134
Trigger an upload of all queued events.
135135

@@ -144,7 +144,7 @@ ___
144144

145145
**getAnonymousId**(): `Promise`<`string`>
146146

147-
*Defined in analytics.ts:369*
147+
*Defined in [analytics.ts:368](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L368)*
148148

149149
Retrieve the anonymousId.
150150

@@ -157,7 +157,7 @@ ___
157157

158158
**group**(groupId: *`string`*, traits?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
159159

160-
*Defined in analytics.ts:312*
160+
*Defined in [analytics.ts:311](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L311)*
161161

162162
Associate a user with a group, organization, company, project, or w/e _you_ call them.
163163

@@ -180,7 +180,7 @@ ___
180180

181181
**identify**(user: *`string`*, traits?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
182182

183-
*Defined in analytics.ts:299*
183+
*Defined in [analytics.ts:298](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L298)*
184184

185185
Associate a user with their unique ID and record traits about them.
186186

@@ -203,7 +203,7 @@ ___
203203

204204
**middleware**(middleware: *[Middleware]()*): `this`
205205

206-
*Defined in analytics.ts:208*
206+
*Defined in [analytics.ts:207](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L207)*
207207

208208
Append a new middleware to the middleware chain.
209209

@@ -241,7 +241,7 @@ ___
241241

242242
**reset**(): `Promise`<`void`>
243243

244-
*Defined in analytics.ts:335*
244+
*Defined in [analytics.ts:334](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L334)*
245245

246246
Reset any user state that is cached on the device.
247247

@@ -256,7 +256,7 @@ ___
256256

257257
**screen**(name: *`string`*, properties?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
258258

259-
*Defined in analytics.ts:284*
259+
*Defined in [analytics.ts:283](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L283)*
260260

261261
Record the screens or views your users see.
262262

@@ -279,7 +279,7 @@ ___
279279

280280
**setIDFA**(idfa: *`string`*): `void`
281281

282-
*Defined in analytics.ts:172*
282+
*Defined in [analytics.ts:171](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L171)*
283283

284284
Sets the IDFA value on iOS. Customers are now responsible for collecting IDFA on their own.
285285

@@ -298,7 +298,7 @@ ___
298298

299299
**setup**(writeKey: *`string`*, configuration?: *[Configuration](../interfaces/analytics.configuration.md)*): `Promise`<`void`>
300300

301-
*Defined in analytics.ts:247*
301+
*Defined in [analytics.ts:246](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L246)*
302302

303303
Setup the Analytics module. All calls made before are queued and only executed if the configuration was successful.
304304

@@ -328,7 +328,7 @@ ___
328328

329329
**track**(event: *`string`*, properties?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
330330

331-
*Defined in analytics.ts:266*
331+
*Defined in [analytics.ts:265](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L265)*
332332

333333
Record the actions your users perform.
334334

@@ -351,7 +351,7 @@ ___
351351

352352
**useNativeConfiguration**(): `this`
353353

354-
*Defined in analytics.ts:220*
354+
*Defined in [analytics.ts:219](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L219)*
355355

356356
Use the native configuration.
357357

packages/core/docs/interfaces/analytics.configuration.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
**● android**: *`undefined` \| `object`*
3333

34-
*Defined in analytics.ts:120*
34+
*Defined in [analytics.ts:119](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L119)*
3535

3636
Android specific settings.
3737

@@ -42,7 +42,7 @@ ___
4242

4343
**● debug**: *`undefined` \| `false` \| `true`*
4444

45-
*Defined in analytics.ts:38*
45+
*Defined in [analytics.ts:37](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L37)*
4646

4747
___
4848
<a id="defaultprojectsettings"></a>
@@ -51,7 +51,7 @@ ___
5151

5252
**● defaultProjectSettings**: *`undefined` \| `object`*
5353

54-
*Defined in analytics.ts:46*
54+
*Defined in [analytics.ts:45](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L45)*
5555

5656
Default project settings to use, if Segment.com cannot be reached. An example configuration can be found here, using your write key: [](https://cdn-settings.segment.com/v1/projects/YOUR_WRITE_KEY/settings)[https://cdn-settings.segment.com/v1/projects/YOUR\_WRITE\_KEY/settings](https://cdn-settings.segment.com/v1/projects/YOUR_WRITE_KEY/settings)
5757

@@ -62,7 +62,7 @@ ___
6262

6363
**● flushAt**: *`undefined` \| `number`*
6464

65-
*Defined in analytics.ts:54*
65+
*Defined in [analytics.ts:53](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L53)*
6666

6767
The number of queued events that the analytics client should flush at. Setting this to `1` will not queue any events and will use more battery.
6868

@@ -75,7 +75,7 @@ ___
7575

7676
**● ios**: *`undefined` \| `object`*
7777

78-
*Defined in analytics.ts:102*
78+
*Defined in [analytics.ts:101](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L101)*
7979

8080
iOS specific settings.
8181

@@ -86,7 +86,7 @@ ___
8686

8787
**● proxy**: *`undefined` \| `object`*
8888

89-
*Defined in analytics.ts:72*
89+
*Defined in [analytics.ts:71](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L71)*
9090

9191
Whether the analytics client should send all requests through your own hosted proxy rather than directly to Segment. See: iOS: [https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#proxy-http-calls](https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#proxy-http-calls) android: [https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/#proxy-http-calls](https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/#proxy-http-calls)
9292

@@ -99,7 +99,7 @@ ___
9999

100100
**● recordScreenViews**: *`undefined` \| `false` \| `true`*
101101

102-
*Defined in analytics.ts:19*
102+
*Defined in [analytics.ts:19](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L19)*
103103

104104
Whether the analytics client should automatically make a screen call when a view controller is added to a view hierarchy. Because the iOS underlying implementation uses method swizzling, we recommend initializing the analytics client as early as possible.
105105

@@ -112,7 +112,7 @@ ___
112112

113113
**● trackAppLifecycleEvents**: *`undefined` \| `false` \| `true`*
114114

115-
*Defined in analytics.ts:26*
115+
*Defined in [analytics.ts:26](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L26)*
116116

117117
Whether the analytics client should automatically track application lifecycle events, such as "Application Installed", "Application Updated" and "Application Opened".
118118

@@ -125,11 +125,9 @@ ___
125125

126126
**● trackAttributionData**: *`undefined` \| `false` \| `true`*
127127

128-
*Defined in analytics.ts:32*
128+
*Defined in [analytics.ts:31](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L31)*
129129

130-
Whether the analytics client should automatically track attribution data from enabled providers using the mobile service.
131-
132-
Disabled by default.
130+
*__deprecated__*: The property should not be used
133131

134132
___
135133
<a id="using"></a>
@@ -138,7 +136,7 @@ ___
138136

139137
**● using**: *[Integration](../#integration)[]*
140138

141-
*Defined in analytics.ts:37*
139+
*Defined in [analytics.ts:36](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L36)*
142140

143141
Register a set of integrations to be used with this Analytics instance.
144142

packages/core/ios/RNAnalytics/RNAnalytics.m

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ +(void)addIntegration:(id)factory {
2525

2626
+(void)initialize {
2727
[super initialize];
28-
28+
2929
RNAnalyticsIntegrations = [NSMutableSet new];
3030
RNAnalyticsIntegrationsLock = [NSLock new];
3131
}
@@ -57,50 +57,49 @@ +(void)initialize {
5757
}
5858

5959
SEGAnalyticsConfiguration* config = [SEGAnalyticsConfiguration configurationWithWriteKey:options[@"writeKey"]];
60-
60+
6161
config.recordScreenViews = [options[@"recordScreenViews"] boolValue];
6262
config.trackApplicationLifecycleEvents = [options[@"trackAppLifecycleEvents"] boolValue];
63-
config.trackAttributionData = [options[@"trackAttributionData"] boolValue];
6463
config.flushAt = [options[@"flushAt"] integerValue];
6564
config.enableAdvertisingTracking = RNAnalyaticsUseAdvertisingId = [options[@"ios"][@"trackAdvertising"] boolValue];
6665
config.defaultSettings = options[@"defaultProjectSettings"];
67-
66+
6867
// set this block regardless. the data will come in after the fact most likely.
6968
config.adSupportBlock = ^NSString * _Nonnull{
7069
return RNAnalyticsAdvertisingId;
7170
};
72-
71+
7372
if ([options valueForKey:@"proxy"]) {
7473
NSDictionary *proxyOptions = (NSDictionary *)[options valueForKey:@"proxy"];
75-
74+
7675
config.requestFactory = ^(NSURL *url) {
7776
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
78-
77+
7978
if ([proxyOptions valueForKey:@"scheme"]) {
8079
components.scheme = [proxyOptions[@"scheme"] stringValue];
8180
}
82-
81+
8382
if ([proxyOptions valueForKey:@"host"]) {
8483
components.host = [proxyOptions[@"host"] stringValue];
8584
}
86-
85+
8786
if ([proxyOptions valueForKey:@"port"]) {
8887
components.port = [NSNumber numberWithInt:[proxyOptions[@"port"] intValue]];
8988
}
90-
89+
9190
if ([proxyOptions valueForKey:@"path"]) {
9291
components.path = [[proxyOptions[@"path"] stringValue] stringByAppendingString:components.path];
9392
}
94-
93+
9594
NSURL *transformedURL = components.URL;
9695
return [NSMutableURLRequest requestWithURL:transformedURL];
9796
};
9897
}
99-
98+
10099
for(id factory in RNAnalyticsIntegrations) {
101100
[config use:factory];
102101
}
103-
102+
104103
[SEGAnalytics debug:[options[@"debug"] boolValue]];
105104

106105
@try {
@@ -109,14 +108,14 @@ +(void)initialize {
109108
@catch(NSError* error) {
110109
return rejecter(@"E_SEGMENT_ERROR", @"Unexpected native Analtyics error", error);
111110
}
112-
111+
113112
// On iOS we use method swizzling to intercept lifecycle events
114113
// However, React-Native calls our library after applicationDidFinishLaunchingWithOptions: is called
115114
// We fix this by manually calling this method at setup-time
116115
// TODO(fathyb): We should probably implement a dedicated API on the native part
117116
if(config.trackApplicationLifecycleEvents) {
118117
SEL selector = @selector(_applicationDidFinishLaunchingWithOptions:);
119-
118+
120119
if ([SEGAnalytics.sharedAnalytics respondsToSelector:selector]) {
121120
[SEGAnalytics.sharedAnalytics performSelector:selector
122121
withObject:_bridge.launchOptions];

packages/core/src/__tests__/configuration.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ it('uses the default configuration', async () => {
1919
flushAt: 20,
2020
recordScreenViews: false,
2121
trackAppLifecycleEvents: false,
22-
trackAttributionData: false,
2322
writeKey,
2423

2524
android: {
@@ -47,7 +46,6 @@ it('produces a valid configuration', async () => {
4746
flushAt: 42,
4847
recordScreenViews: true,
4948
trackAppLifecycleEvents: true,
50-
trackAttributionData: true,
5149

5250
android: {
5351
collectDeviceId: false,
@@ -72,7 +70,6 @@ it('produces a valid configuration', async () => {
7270
flushAt: 42,
7371
recordScreenViews: true,
7472
trackAppLifecycleEvents: true,
75-
trackAttributionData: true,
7673
writeKey,
7774

7875
android: {

0 commit comments

Comments
 (0)