nativescript-dec-sdk
Progress Sitefinity 数字体验云 SDK for NativeScript。
npm i --save nativescript-dec-sdk

Progress Sitefinity 数字体验云 SDK 插件 for NativeScript apple android

NPM version

此插件的目的在于帮助和简化与 Progress Sitefinity 数字体验云 API 工作的开发者。它简化了将用户交互发送到 DEC 服务器以及从那里获取个性化信息的过程。

先决条件

需要有效的数字体验云账户才能使用此插件。

安装

tns plugin add nativescript-dec-sdk

使用

需要/导入 DecClient,然后使用正确的 Options 对象进行初始化。

JavaScript

var DecClient = require("nativescript-dec-sdk").DecClient;
var client = new DecClient({
apiKey: 'your DEC Data center Api key',
source: 'the data source name used by the client',
authToken: 'your DEC Data center Authentication token', // Not required - needed only if Personalization calls to DEC Data center are used.
apiServerUrl: 'Api server url' // Not required - only use if the url is a custom one.
});

TypeScript

import { DecClient } from "nativescript-dec-sdk";
let client = new DecClient({
apiKey: 'your DEC Data center Api key',
source: 'the data source name used by the client',
authToken: 'your DEC Data center Authentication token', // Not required - needed only if Personalization calls to DEC Data center are used.
apiServerUrl: 'Api server url' // Not required - only use if the url is a custom one.
});

API

个性化调用

函数

client.IsInPersonas(scoringIds, subjectKey)
  • scoringIds - 一个包含角色 ID 的数组。
  • subjectKey - 用户的 ID

函数

client.IsInLeads(scoringIds, subjectKey);
  • scoringIds - 一个包含潜在客户评分 ID 的数组。
  • subjectKey - 用户的 ID

函数

client.IsInCampaigns(campaignIds, subjectKey);
  • campaignIds - 一个包含潜在客户评分 ID 的数组。
  • subjectKey - 用户的 ID


交互

函数

client.writeInteraction(interaction);

交互应遵循以下结构

{
S: '', // The Interaction's Subject.
P: '', // The Interaction's Predicate.
O: '', // The Interaction's Object.
SM: {}, // The Interaction's Subject Metadata.
OM: {}, // The Interaction's Object Metadata.
MappedTo: {} // The Interaction's Mapping.
}

重要: 有效的交互应始终包含一个主题,并与其他属性组合使用。


函数

client.writeSubjectMetadata(subjectKey, metadata);
  • subjectKey - 用户的 ID
  • metadata - 一个元数据对象。

函数

client.writeObjectMetadata(subjectKey, metadata);
  • subjectKey - 用户的 ID
  • metadata - 一个元数据对象。

函数

client.addMapping(subjectKey, secondSubjectKey, secondDataSource);
  • subjectKey - 用户的 ID
  • secondSubjectKey - 来自其他来源的用户的 ID。
  • secondDataSource - 其他数据源。

函数

client.buildPersonalizationReportInteraction(personalizationReportParams);

个性化报告参数应遵循以下结构(所有属性都是必需的!

{
subjectKey: '', // The Subject key of the Application's user.
pageGuid: '', // The guid of the page currently personalized.
canonicalTitle: '', // The title of the page currently personalized.
canonicalUrl: '', // The url of the page currently personalized.
segment: '', // The segment by which the page is personalized - the Persona, the Lead Scoring or the Campaign.
language: '' // The language of the page currently personalized.
}