帮助中心
|
Sociomantic 插件集成
您可以使用以下方法之一实现 Adjust SDK 与 Sociomantic 事件的集成。
操作前须知
您需要针对平台下载并设置 Adjust SDK。按照下方链接中的说明操作,开始使用功能。
设置环境
iOS
Cocoapods
如果您在使用 Cocoapods,请将以下行加入 podfile 来集成 Adjust Sociomantic 插件:
pod 'Adjust/Sociomantic'
Carthage
如果您在使用 Carthage,请将以下行加入 Cartfile 来集成 Adjust Sociomantic 插件:
github "adjust/ios_sdk" "sociomantic"
从来源安装
您可以通过以下方法手动将 Adjust Sociomantic 插件加入项目中:
- 在从发布页面下载的存档中找到
plugin/Sociomantic
文件夹。 - 将
ADJSociomantic.h
和ADJSociomantic.m
文件拖拽进您项目中的Adjust
文件夹。 - Choose options for adding these files (选择添加文件选项)对话框出现时,勾选 Copy items if needed 并选择 Create groups 。
安卓
Maven
如果您使用的是 Maven,请添加下列 dependency 至您的 build.grade
文件:
dependencies {
implementation 'com.adjust.sdk:adjust-android:4.28.2'
implementation 'com.adjust.sdk:adjust-android-criteo:4.28.2'
}
作为 JAR 添加
您也可以访问我们的发布页面,将插件作为 JAR 文件添加。
Sociomantic 事件
安装 Sociomantic 插件后,您就能调用 Sociomantic 事件方法和下列常量。您应当将它们用作 dictionary 中的属性名称。
Sociomantic 常量 - iOS
NSString *const SCMCategory;
NSString *const SCMProductName;
NSString *const SCMSalePrice;
NSString *const SCMProductURL;
NSString *const SCMProductImageURL;
NSString *const SCMBrand;
NSString *const SCMDescription;
NSString *const SCMTimestamp;
NSString *const SCMValidityTimestamp;
NSString *const SCMQuantity;
NSString *const SCMScore;
NSString *const SCMProductID;
NSString *const SCMAmount;
NSString *const SCMCurrency;
NSString *const SCMActionConfirmed;
NSString *const SCMActionConfirmed;
NSString *const SCMCustomerAgeGroup;
NSString *const SCMCustomerEducation;
NSString *const SCMCustomerGender;
NSString *const SCMCustomerID;
NSString *const SCMCustomerMHash;
NSString *const SCMCustomerSegment;
NSString *const SCMCustomerTargeting;
Sociomantic 常量 - 安卓
final static String SCMCategory;
final static String SCMProductName;
final static String SCMSalePrice;
final static String SCMAmount;
final static String SCMCurrency;
final static String SCMProductURL;
final static String SCMProductImageURL;
final static String SCMBrand;
final static String SCMDescription;
final static String SCMTimestamp;
final static String SCMValidityTimestamp;
final static String SCMQuantity;
final static String SCMScore;
final static String SCMProductID;
final static String SCMActionConfirmed;
final static String SCMCustomerAgeGroup;
final static String SCMCustomerEducation;
final static String SCMCustomerGender;
final static String SCMCustomerID;
final static String SCMCustomerMHash;
final static String SCMCustomerSegment;
final static String SCMCustomerTargeting;
final static String SCMTransaction;
在发送任何 Sociomantic 事件之前,您应当按照下方呈现的方式设置合作伙伴 ID:
Objective-C
#import "ADJSociomantic.h"
[ADJSociomantic injectPartnerIdIntoSociomanticEvents:@"{sociomanticPartnerId}"];
Swift
ADJSociomantic.injectPartnerId(intoSociomanticEvents: "{sociomanticPartnerId}")
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustSociomantic.injectPartnerIdInSociomanticEvents("{sociomanticPartnerId}");
设置好合作伙伴 ID 后,就可以集成不同的 Sociomantic 事件了。
示例
客户端事件
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:ANY_TOKEN];
NSDictionary *customerData = @{
SCMCustomerID: @"123456"
};
[ADJSociomantic injectCustomerDataIntoEvent:event withData:customerData];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: ANY_TOKEN)
let customerData = [
SCMCustomerID: "123456"
]
ADJSociomantic.injectCustomerData(into:event, withData: customerData)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(HOMEPAGE_TOKEN);
Map<String, String> customerData = new HashMap<>();
customerData.put(AdjustSociomantic.SCMCustomerAgeGroup, "0");
AdjustSociomantic.injectCustomerDataIntoEvent(event, customerData);
Adjust.trackEvent(event);
查看主页
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:HOMEPAGE_TOKEN];
[ADJSociomantic injectHomePageIntoEvent:event];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: HOMEPAGE_TOKEN)
ADJSociomatic.injectHomePage(into: event)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(HOMEPAGE_TOKEN);
Adjust.trackEvent(event);
查看列表
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:LISTING_TOKEN];
NSArray *categories = @[@"category_1", @"category_2", @"category_3"];
NSString *date = @"1427792434";
[ADJSociomantic injectViewListingIntoEvent:event withCategories:categories];
// You also can provide a date like this
[ADJSociomantic injectViewListingIntoEvent:event withCategories:categories withDate:date];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: LISTING_TOKEN)
let categories = ["category_1", "category_2", "category_3"]
let date = "1427792434"
ADJSociomantic.injectViewListing(into:event, withCategories: categories)
// You also can provide a date like this
ADJSociomantic.injectViewListing(into:event, withCategories: categories, withDate: date)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(LISTING_TOKEN);
List<string> categories = Arrays.asList("cat1", "cat2", "cat3");
String date = "1427792434"
AdjustSociomantic.injectViewListingIntoEvent(event, categories);
Adjust.trackEvent(event);
// You also can provide a date like this.
AdjustSociomantic.injectViewListingIntoEvent(event, categories, date);
Adjust.trackEvent(event);
浏览产品
请注意:
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:PRODUCT_VIEW_TOKEN];
NSDictionary *params = @{
SCMCategory : @[@"cat1", @"cat2"],
SCMProductName : @"stuff",
SCMDescription : @"pure awesomeness"
};
[ADJSociomantic injectViewProductIntoEvent:event productId:@"productId_4" withParameters:params];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: PRODUCT_VIEW_TOKEN)
let params = [
SCMCategory: ["cat1", "cat2"],
SCMProductName: "stuff",
SCMDescription: "pure awesomeness"
]
ADJSociomantic.injectViewProduct(into:event, productId: "productId_4", withParameters: params)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(PRODUCT_VIEW_TOKEN);
Map<String, Object> product = new HashMap<>();
List<string> categories = Arrays.asList("cat1", "cat2", "cat3");
product.put(AdjustSociomantic.SCMCategory, categories);
AdjustSociomantic.injectProductIntoEvent(event, "123456");
Adjust.trackEvent(event);
// You can also provide product information.
AdjustSociomantic.injectProductIntoEvent(event, "123456", product);
Adjust.trackEvent(event);
可用产品参数
参数名称 | 要求 | 描述 | 请注意 |
---|---|---|---|
SCMCategory | 必需* | 产品类别 (整个类别路径) | 类别或列表界面跟踪代码中提供的类别信息应当与动态或产品页面跟踪代码中的类别信息一致。 |
SCMProductName | 必需* | 产品名称 | 特殊字符不需要编码,但应当以正确的 UTF-8 格式发送。请不要使用任何 HTML 标记。 |
SCMSalePrice | 必需* | 十进制值促销价格 (例如 2.99) | 请使用点 (.) 作为小数分隔符,不要使用任何千位数分隔符。 |
SCMAmount | 必需* | 十进制值正常价格 (例如 3.99) | 请使用点 (.) 作为小数分隔符,不要使用任何千位数分隔符。 |
SCMCurrency | 必需* | ISO 4217 格式货币代码 (例如 EUR) | 固定货币代码。应当已在跟踪代码示例中为您提供。 |
SCMProductURL> | 必需* | 产品 URL (深度链接) | 请提供能够正常运作的深度链接,最好不要带有任何点击跟踪参数 (如 Google Analytics、HURRA、Eulerian 等),务必始终使用带 http:// 的深度链接 |
SCMProductImageURL | 必需* | 产品图像 URL | 请提供大小适宜的图片。为了在广告中达到最佳展示效果,图片应当至少为 200x200px,并保持相同的长宽比。 |
SCMBrand | 必需* | 产品品牌 | 特殊字符不需要编码,但应当以正确的 UTF-8 格式发送 (与上文 SCMProductName 相同)。请不要使用任何 HTML 标记。 |
SCMDescription | 可选 | 简短产品描述 | 特殊字符不需要编码,但应当以正确的 UTF-8 格式发送 (与上文 SCMProductName 相同)。请不要使用任何 HTML 标记。 |
SCMTimestamp | 可选 | 产品可用期限的截止时间戳 (请使用格林尼治标准时间) | 请提供访客搜索过的日期。该时间戳应当为包装在 NSNumber 中的 NSTimeInterval (参见示例)。 |
SCMValidityTimestamp | 可选 | 产品可用期限的截止时间戳 (请使用格林尼治标准时间) | 请提供产品可用期限的截止 unix 时间戳。对于始终可用的产品,请使用 0。该时间戳应当为包装在 NSNumber 中的 NSTimeInterval (与上文 SCMTimestamp 相同)。 |
SCMQuantity | 可选 | 库存产品数量 | 请先与您的 Sociomantic 联系人讨论,确定后再集成该字段 |
SCMScore | 可选 | 产品优先级分数 ( 0 - 10.0 之间的值) | 请先与您的 Sociomantic 联系人讨论,确定后再集成该字段 |
Cart
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:CART_TOKEN];
NSDictionary *product5 = @{
SCMAmount : @100,
SCMCurrency : @"EUR",
SCMQuantity : @1,
SCMProductID : @"productId_5",
};
NSString *product6 = @"productId_6";
NSDictionary *product7 = @{
SCMProductID : @"productId_7"
};
NSArray * productList = @[product5, product6, product7];
[ADJSociomantic injectCartIntoEvent:event cart:productList];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: CART_TOKEN)
let product5 = [
SCMAmount: NSNumber(value: 100),
SCMCurrency: "EUR",
SCMQuantity: NSNumber(value: 1),
SCMProductID: "productId_5"
]
let product6 = "productId_6"
let product7 = [
SCMProductID: "productId_7"
]
let productList = [product5, product6, product7]
ADJSociomantic.injectCart(into:event, cart: productList)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(BASKET_TOKEN);
Map<String, Object> product1 = new HashMap<>();
product1.put(AdjustSociomantic.SCMProductID, "1");
product1.put(AdjustSociomantic.SCMAmount, 42);
product1.put(AdjustSociomantic.SCMCurrency, "EUR");
product1.put(AdjustSociomantic.SCMQuantity, 1);
Map<String, Object> product2 = new HashMap<>();
product2.put(AdjustSociomantic.SCMProductID, "2");
String product3 = "3";
List<object> products = Arrays.asList(product1, product2, product3);
AdjustSociomantic.injectCartIntoEvent(event, products);
Adjust.trackEvent(event);
可用 cart 参数
参数名称 | 要求 | 描述 | 请注意 |
---|---|---|---|
SCMProductID | 必要参数 | 产品 ID | 该产品 ID 不应包含任何色彩与尺寸衍类的子 ID。 |
SCMAmount | 可选 | 十进制值产品价格 (例如 2.99) | 请使用点 (.) 作为小数分隔符,不要使用任何千位数分隔符。即便产品数量值大于 1,也请提供单个产品价格。 |
SCMCurrency | 可选 | ISO 4217 格式货币代码 (例如 EUR) | 固定货币代码。应当已在跟踪代码示例中为您提供。 |
SCMQuantity | 可选 | 选定产品数量 | 请使用整数值。 |
未确认交易
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:TRANSACTION_TOKEN];
NSString *product5 = @"productId_5";
NSDictionary *product6 = @{
SCMQuantity : @3,
SCMProductID : @"productId_6"
};
NSArray * productList = @[product5, product6];
[ADJSociomantic injectTransactionIntoEvent:event transactionId:@"123456" withProducts:productList];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: TRANSACTION_TOKEN)
let product5 = "productId_5"
let product6 = [
SCMQuantity: NSNumber(value: 3),
SCMProductID: "productId_6"
]
let productList = [product5, product6]
ADJSociomantic.injectTransaction(into:event, transactionId: "123456", withProducts: productList)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(SALE_TOKEN);
Map<String, Object> product1 = new HashMap<>();
product1.put(AdjustSociomantic.SCMProductID, "1");
product1.put(AdjustSociomantic.SCMAmount, 42);
product1.put(AdjustSociomantic.SCMQuantity, 1);
Map<String, Object> product2 = new HashMap<>();
product2.put(AdjustSociomantic.SCMProductID, "2");
String product3 = "3";
List<object> products = Arrays.asList(product1, product2, product3);
AdjustSociomantic.injectTransactionIntoEvent(event, "123456", products);
Adjust.trackEvent(event);
或带参数:
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:TRANSACTION_TOKEN];
NSString *product5 = @"productId_5";
NSDictionary *product6 = @{
SCMQuantity : @3,
SCMProductID : @"productId_6"
};
NSArray *productList = @[product5, product6];
NSDictionary *parameters = @{
SCMQuantity: @4 // 3 times product6 and 1 product5
};
[ADJSociomantic injectTransactionIntoEvent:event transactionId:@"123456" withProducts:productList withParameters:parameters];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: TRANSACTION_TOKEN)
let product5 = "productId_5"
let product6 = [
SCMQuantity: NSNumber(value: 3),
SCMProductID: "productId_6"
]
let productList = [product5, product6]
let parameters = [
SCMQuantity: NSNumber(value: 4 /* 3 times product6 and 1 product5 */)
]
ADJSociomantic.injectTransaction(into:event, transactionId: "123456", withProducts: productList, withParameters: parameters)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(SALE_TOKEN);
Map<String, Object> product1 = new HashMap<>();
product1.put(AdjustSociomantic.SCMProductID, "1");
product1.put(AdjustSociomantic.SCMAmount, 42);
product1.put(AdjustSociomantic.SCMQuantity, 1);
Map<String, Object> product2 = new HashMap<>();
product2.put(AdjustSociomantic.SCMProductID, "2");
String product3 = "3";
List<object> products = Arrays.asList(product1, product2, product3);
Map<String, Object> parameters = new HashMap<>();
parameters.put(AdjustSociomantic.SCMCurrency, "EUR");
parameters.put(AdjustSociomantic.SCMAmount, 42);
AdjustSociomantic.injectTransactionIntoEvent(event, "123456", products, parameters);
Adjust.trackEvent(event);
已确认交易
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:TRANSACTION_TOKEN];
NSString *product5 = @"productId_5";
NSDictionary *product6 = @{
SCMQuantity : @3,
SCMProductID : @"productId_6"
};
NSArray * productList = @[product5, product6];
[ADJSociomantic injectConfirmedTransactionIntoEvent:event transactionId:@"123456" withProducts:productList];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: TRANSACTION_TOKEN)
let product5 = "productId_5"
let product6 = [
SCMQuantity: NSNumber(value: 3),
SCMProductID: "productId_6"
]
let productList = [product5, product6]
ADJSociomantic.injectConfirmedTransaction(into:event, transactionId: "123456", withProducts: productList)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(SALE_TOKEN);
Map<String, Object> product1 = new HashMap<>();
product1.put(AdjustSociomantic.SCMProductID, "1");
product1.put(AdjustSociomantic.SCMAmount, 42);
product1.put(AdjustSociomantic.SCMQuantity, 1);
Map<String, Object> product2 = new HashMap<>();
product2.put(AdjustSociomantic.SCMProductID, "2");
String product3 = "3";
List<object> products = Arrays.asList(product1, product2, product3);
AdjustSociomantic.injectConfirmedTransactionIntoEvent(event, "123456", products);
Adjust.trackEvent(event);
或带参数:
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:TRANSACTION_TOKEN];
NSString *product5 = @"productId_5";
NSDictionary *product6 = @{
SCMQuantity : @3,
SCMProductID : @"productId_6"
};
NSArray *productList = @[product5, product6];
NSDictionary *parameters = @{
SCMQuantity: @4 // 3 times product6 and 1 product5
};
[ADJSociomantic injectConfirmedTransactionIntoEvent:event transactionId:@"123456" withProducts:productList withParameters:parameters];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: TRANSACTION_TOKEN)
let product5 = "productId_5"
let product6 = [
SCMQuantity: NSNumber(value: 3),
SCMProductID: "productId_6"
]
let productList = [product5, product6]
let parameters = [
SCMQuantity: NSNumber(value: 4 /* 3 times product6 and 1 product5 */)
]
ADJSociomantic.injectConfirmedTransaction(into:event, transactionId: "123456", withProducts: productList, withParameters: parameters)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(SALE_TOKEN);
Map<String, Object> product1 = new HashMap<>();
product1.put(AdjustSociomantic.SCMProductID, "1");
product1.put(AdjustSociomantic.SCMAmount, 42);
product1.put(AdjustSociomantic.SCMQuantity, 1);
Map<String, Object> product2 = new HashMap<>();
product2.put(AdjustSociomantic.SCMProductID, "2");
String product3 = "3";
List<object> products = Arrays.asList(product1, product2, product3);
Map<String, Object> parameters = new HashMap<>();
parameters.put(AdjustSociomantic.SCMCurrency, "EUR");
parameters.put(AdjustSociomantic.SCMAmount, 42);
AdjustSociomantic.injectConfirmedTransactionIntoEvent(event, "123456", products, parameters);
Adjust.trackEvent(event);
可用 cart 参数
参数名称 | 要求 | 描述 | 请注意 |
---|---|---|---|
SCMAmount | 可选 | 十进制值产品价格 (例如 2.99) | 请使用点 (.) 作为小数分隔符,不要使用任何千位数分隔符。即便产品数量值大于 1,也请提供单个产品价格。 |
SCMCurrency | 可选 | ISO 4217 格式货币代码 (例如 EUR) | 固定货币代码。应当已在跟踪代码示例中为您提供。 |
SCMQuantity | 可选 | 选定产品数量 | 请使用整数值。 |
Lead 事件
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:LEAD_TOKEN];
[ADJSociomantic injectLeadIntoEvent:event leadID:@"123456789"];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: LEAD_TOKEN)
ADJSociomantic.injectLead(into:event, leadID: "123456789")
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(LEAD_TOKEN);
AdjustSociomantic.injectLeadIntoEvent(event, "123456");
Adjust.trackEvent(event);
或已确认的 lead:
Objective-C
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:LEAD_TOKEN];
[ADJSociomantic injectLeadIntoEvent:event leadID:@"123456789" andConfirmed:YES];
[Adjust trackEvent:event];
Swift
let event = ADJEvent(eventToken: LEAD_TOKEN)
ADJSociomantic.injectLead(into:event, leadID: "123456789", andConfirmed: true)
Adjust.trackEvent(event)
Java
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(LEAD_TOKEN);
AdjustSociomantic.injectLeadIntoEvent(event, "123456", Boolean.TRUE);
Adjust.trackEvent(event);