Skip to content

Commit 494df24

Browse files
authored
fix: appsflyer attribution (#547)
1 parent 3e157bf commit 494df24

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/core/src/analytics.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import {
2222
Context,
2323
DeepPartial,
2424
GroupTraits,
25+
IntegrationSettings,
2526
JsonMap,
2627
PluginType,
2728
SegmentAPIIntegrations,
28-
SegmentAPISettings,
2929
SegmentEvent,
3030
UpdateType,
3131
UserInfoState,
@@ -351,20 +351,23 @@ export class SegmentClient {
351351

352352
/**
353353
* Adds a new plugin to the currently loaded set.
354-
* @param {{ plugin: Plugin, settings?: SegmentAPISettings }} Plugin to be added. Settings are optional if you want to force a configuration instead of the Segment Cloud received one
354+
* @param {{ plugin: Plugin, settings?: IntegrationSettings }} Plugin to be added. Settings are optional if you want to force a configuration instead of the Segment Cloud received one
355355
*/
356-
add({
356+
add<P extends Plugin>({
357357
plugin,
358358
settings,
359359
}: {
360-
plugin: Plugin;
361-
settings?: Plugin extends DestinationPlugin ? SegmentAPISettings : never;
360+
plugin: P;
361+
settings?: P extends DestinationPlugin ? IntegrationSettings : never;
362362
}) {
363363
// plugins can either be added immediately or
364364
// can be cached and added later during the next state update
365365
// this is to avoid adding plugins before network requests made as part of setup have resolved
366366
if (settings !== undefined && plugin.type === PluginType.destination) {
367-
this.store.settings.add((plugin as DestinationPlugin).key, settings);
367+
this.store.settings.add(
368+
(plugin as unknown as DestinationPlugin).key,
369+
settings
370+
);
368371
}
369372

370373
if (!this.store.isReady.get()) {

packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class AppsflyerPlugin extends DestinationPlugin {
8585
},
8686
};
8787

88-
if (is_first_launch === 'true') {
88+
if (JSON.parse(is_first_launch) === true) {
8989
if (af_status === 'Non-organic') {
9090
this.analytics?.track('Install Attributed', properties);
9191
} else {

0 commit comments

Comments
 (0)