DocumentationTarget Developer Guide

Initialize the Node.js SDK

Last update: July 17, 2023
  • Topics:
  • APIs/SDKs

CREATED FOR:

  • Developer

Description

Use the create method in order to initialize the Node.js SDK and instantiate the Target client to make calls to Adobe Target for experiments and personalized experiences.

Method

create

TargetClient.create(options: Object): TargetClient

Parameters

options has the following structure:

NameTypeRequiredDefaultDescription
clientStringYesNoneAdobe Target Client ID
organizationIdStringYesNoneExperience Cloud Organization ID
environmentStringNoproductionTarget environment name. In the Target UI, Administration > Environments.
timeoutNumberNo3000Timeout in milliseconds
serverDomainStringNo*client*.tt.omtrdc.netOverrides default hostname
secureBooleanNotrueUnset to enforce HTTP scheme
loggerObjectNoNOOP loggerReplaces the default NOOP logger
targetLocationHintStringNoNoneTarget location hint
fetchApiFunctionNoglobal.fetch or window.fetchfetch is used by the SDK for http requests. By default node-fetch or the browser implementation of fetch is used. But an alternative implementation can be provided using fetchApi
propertyTokenStringNoNoneTarget Property Token. If specified here, all getOffers calls will use this value. For on-device decisioning, the SDK will only download the artifact that contains the qualified activities for the property token set in propertyToken
decisioningMethodStringNoserver-sideDetermines which decisioning method to use (on-device, server-side, hybrid)
pollingIntervalNumberNo300000 (5 minutes)Polling interval for the on-device decisioning rule artifact (in milliseconds)
artifactLocationStringNoNoneA fully qualified url to the on-device decisioning rule artifact. Overrides internally determined location.
artifactPayloadObjectNoNoneThe JSON payload of the on-device decisioning rule artifact. If specified, it is used instead of requesting one from a URL.
eventsObject<String,Function>NoNoneAn optional object with event name keys and callback function values
telemetryEnabledBooleanNotrueWhen enabled, Adobe will collect SDK feature usage and performance telemetry data. Personal data is not collected.

Example

Node.js

const CONFIG = {
    client: "acmeclient",
    organizationId: "1234567890@AdobeOrg",
    events: {clientReady: targetClientReady }
};

const targetClient = TargetClient.create(CONFIG);

function targetClientReady() {
    // make calls to Adobe Target
}
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3