ユーザーデータ
Salesforce Interactions Web SDK を使用して、インタラクションを関連付けてまたは関連付けずにユーザーのプロファイルデータを追跡します。
1{
2 user: {
3 anonymousId: '<Set by SDK>',
4 identities: {
5 loyaltyId: "885627312393"
6 },
7 attributes: {
8 firstName: 'Joe',
9 lastName: 'Smith',
10 email: 'joe.smith@domain.com'
11 }
12 }
13}ユーザーオブジェクト項目:
| 項目名 | 項目の型 | 説明 |
|---|---|---|
| anonymousId | string | この項目は SDK によって管理され、すべてのイベントに自動的に付加されます。 |
| user.attributes | object | ユーザー指定の値。 |
| user.identities | object | 匿名ユーザーを既知のユーザーにリンクするためのユーザー指定の値。 |
例
Web SDK を使用して、インタラクションを関連付けずにユーザープロファイルデータを取得する方法を次に示します。
1SalesforceInteractions.sendEvent({
2 user: {
3 identities: {
4 loyaltyId: "885627312393"
5 },
6 attributes: {
7 firstName: 'Joe',
8 lastName: 'Smith',
9 email: 'joe.smith@domain.com'
10 }
11 }
12})Web SDK を使用して、インタラクションを関連付けてユーザープロファイルデータを取得する方法を次に示します。
1SalesforceInteractions.sendEvent({
2 interaction: {
3 name: 'View Catalog Object',
4 catalogObject: {
5 type: 'Product',
6 id: 'product-xyz',
7 attributes: {
8 name: 'Product XYZ',
9 category: 'Clothing',
10 color: 'Red'
11 }
12 }
13 },
14 user: {
15 identities: {
16 loyaltyId: "885627312393"
17 },
18 attributes: {
19 firstName: 'Joe',
20 lastName: 'Smith',
21 email: 'joe.smith@domain.com'
22 }
23 }
24})サイトマップを使用してユーザープロファイルデータを取得する方法を次に示します。
1SalesforceInteractions.init().then(() => {
2 const sitemapConfig = {
3 global: {
4 onActionEvent: (event) => {
5 const email = window.user_info && window.user_info.email;
6 if (email) {
7 event.user = event.user || {};
8 event.user.attributes = event.user.attributes || {};
9 event.user.attributes.emailAddress = email;
10 }
11 return event;
12 },
13 },
14 pageTypes: [{
15 name: 'product_detail',
16 isMatch: () => true,
17 interaction: {
18 name: SalesforceInteractions.InteractionName.ViewCatalogObject,
19 catalogObject: {
20 type: 'Product',
21 id: 'product-xyz',
22 attributes: {
23 name: 'Product XYZ',
24 category: 'Clothing',
25 color: 'Red'
26 }
27 }
28 }
29 }]
30 }
31 SalesforceInteractions.initSitemap(sitemapConfig)
32})