Skip to main content
Version: SDK 5.0.x

Class JusttrackSdkBuilder

Initialize your instance of the justtrack SDK by using the JusttrackSdkBuilder. You have to initialize the justtrack SDK before you can use any of its features.

Constructors

Constructor

new JusttrackSdkBuilder(apiToken: string): JusttrackSdkBuilder

Initialize a new builder.

Parameters

NameTypeDescription
apiTokenstringThe API token provided for your client.

Returns

JusttrackSdkBuilder

Methods

initialize

initialize(): Promise<void>

Initialize the justtrack SDK. This must be called before any other function.

Returns

Promise<void>

withAutomaticInAppPurchaseTracking

withAutomaticInAppPurchaseTracking(enabled: boolean): JusttrackSdkBuilder

Allows you to control whether the justtrack SDK automatically forwards in-app purchases. Default: yes

Parameters

NameTypeDescription
enabledbooleanboolean for enabling.

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withEnableFirebaseIntegration

withEnableFirebaseIntegration(enabled: boolean): JusttrackSdkBuilder

Specify whether we should automatically integrate with the Firebase SDK and send the Firebase app instance id of the user to the justtrack backend. Default: yes

Parameters

NameTypeDescription
enabledbooleanboolean for enabling.

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withInactivityTimeFrameHours

withInactivityTimeFrameHours(  

    inactivityTimeFrameHours: number,
): JusttrackSdkBuilder

Set the time in hours between app opens in which we try to attribute the user again. Default: 48h

An inactive user did not open the app for this time frame and will check for a new attribution on the next app open. Thus, by default a user is inactive if they don't open the app at least every other day.

Parameters

NameTypeDescription
inactivityTimeFrameHoursnumberAfter how many hours will a user be inactive.

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withManualStart

withManualStart(isManual: boolean): JusttrackSdkBuilder

Dictates the nature of the start method call. If set to true then the start method will have to be called by app developers after justtrack SDK initialization. If set to false, which is the default value, then the start method will be automatically called by justtrack SDK after initialization.

Parameters

NameTypeDescription
isManualbooleanwhether the sdk should start manually or not

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withReAttributionTimeFrameDays

withReAttributionTimeFrameDays(  

    reAttributionTimeFrameDays: number,
): JusttrackSdkBuilder

Set the time in days between attributions after which we fetch a new up-to-date attribution. Default: 14 days

A user eligible for re-attribution will fetch an attribution on the next app open. Thus, every active user will by default check every two weeks for a new attribution.

Parameters

NameTypeDescription
reAttributionTimeFrameDaysnumberAfter how many days will a user be eligible for re-attribution.

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withReFetchReAttributionDelaySeconds

withReFetchReAttributionDelaySeconds(  

    reFetchReAttributionDelaySeconds: number,
): JusttrackSdkBuilder

Set the time in seconds between attribution requests if a retargeting opportunity is detected. Default: 5 seconds

Set to a negative number to deactivate fetching the attribution again.

Parameters

NameTypeDescription
reFetchReAttributionDelaySecondsnumberThe number of seconds until the attribution is fetched a second time.

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withTrackingId

withTrackingId(  

    trackingId: null | string,
    trackingProvider: string,
): JusttrackSdkBuilder

Set the tracking id the SDK will send to the backend.

The tracking id and provider must be shorter than 4096 characters and consist only of printable ASCII characters (U+0020 to U+007E).

Parameters

NameTypeDescription
trackingIdnull | stringThe tracking id the SDK will send to the backend.
trackingProviderstringThe tracking provider which supplied the trackingId

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.

withUserId

withUserId(userId: string): JusttrackSdkBuilder

Forward a user id to the justtrack backend upon SDK init.

The user id must be shorter than 4096 characters and consist only of printable ASCII characters (U+0020 to U+007E).

Parameters

NameTypeDescription
userIdstringThe user id to forward.

Returns

JusttrackSdkBuilder

The builder so you can chain methods if you want.