Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
fix: appsflyer attribution (segmentio#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asgaroth authored May 23, 2022
1 parent 3e157bf commit 494df24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions packages/core/src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {
Context,
DeepPartial,
GroupTraits,
IntegrationSettings,
JsonMap,
PluginType,
SegmentAPIIntegrations,
SegmentAPISettings,
SegmentEvent,
UpdateType,
UserInfoState,
Expand Down Expand Up @@ -351,20 +351,23 @@ export class SegmentClient {

/**
* Adds a new plugin to the currently loaded set.
* @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
* @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
*/
add({
add<P extends Plugin>({
plugin,
settings,
}: {
plugin: Plugin;
settings?: Plugin extends DestinationPlugin ? SegmentAPISettings : never;
plugin: P;
settings?: P extends DestinationPlugin ? IntegrationSettings : never;
}) {
// plugins can either be added immediately or
// can be cached and added later during the next state update
// this is to avoid adding plugins before network requests made as part of setup have resolved
if (settings !== undefined && plugin.type === PluginType.destination) {
this.store.settings.add((plugin as DestinationPlugin).key, settings);
this.store.settings.add(
(plugin as unknown as DestinationPlugin).key,
settings
);
}

if (!this.store.isReady.get()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AppsflyerPlugin extends DestinationPlugin {
},
};

if (is_first_launch === 'true') {
if (JSON.parse(is_first_launch) === true) {
if (af_status === 'Non-organic') {
this.analytics?.track('Install Attributed', properties);
} else {
Expand Down

0 comments on commit 494df24

Please sign in to comment.