Ottieni attributi (Node.js)
Descrizione
getAttributes() viene utilizzato per recuperare esperienze di sperimentazione e personalizzate da Target ed estrarre i valori degli attributi.
Metodo
getAttributes
TargetClient.getAttributes(mboxNames: Array, options: Object): Promise
Parametri
Nome
Tipo
Obbligatorio
Predefinito
mboxNames
Array
Sì
None (Nessuno)
options
Oggetto
No
None (Nessuno)
Promessa
Promise restituito da TargetClient.getAttributes() risolve un oggetto con i seguenti metodi:
Metodo
Tipo restituito
Descrizione
getValue(mboxName, key)
Any
Restituisce il valore per il nome mbox e la chiave attributo specificati
asObject(mboxName)
Oggetto
Restituisce un oggetto json semplice con coppie chiave-valore
getResponse()
Restituisce l'oggetto di risposta normalmente restituito da
getOffersEsempio
Node.js
const TargetClient = require("@adobe/target-nodejs-sdk");
const CONFIG = {
client: "acmeclient",
organizationId: "1234567890@AdobeOrg"
};
const targetClient = TargetClient.create(CONFIG);
const offerAttributes = await targetClient.getAttributes(["demo-engineering-flags"]);
//returns just the value of searchProviderId from the mbox offer
const searchProviderId = offerAttributes.getValue("demo-engineering-flags", "searchProviderId");
//returns a simple JSON object representing the mbox offer
const engineeringFlags = offerAttributes.asObject("demo-engineering-flags");
// the value of engineeringFlags looks like this
// {
// "cdnHostname": "cdn.cloud.corp.net",
// "searchProviderId": 143,
// "hasLegacyAccess": false
// }
const assetUrl = `http://${engineeringFlags.cdnHostname}/path/to/asset`;
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3