您可以集成 Adjust SDK 和 Sociomantic 事件。
设置环境
Maven
如果您使用的是 Maven,请将以下依赖添加至您的 build.gradle
文件:
implementation 'com.adjust.sdk:adjust-android:4.38.5'
implementation 'com.adjust.sdk:adjust-android-criteo:4.38.5'
JAR
您也可以访问我们的发布页面,将插件作为 JAR 文件添加。
Sociomantic 事件
安装 Sociomantic 插件后,您就能调用 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:
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustSociomantic.injectPartnerIdInSociomanticEvents("{sociomanticPartnerId}");
设置好合作伙伴 ID 后,就可以集成不同的 Sociomantic 事件了。
示例
客户事件
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);
查看主页
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(HOMEPAGE_TOKEN);
Adjust.trackEvent(event);
查看产品页面
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);
浏览产品
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:// 的深度链接 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 联系人讨论,确定后再集成该字段 |
购物车
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");
List<object> products = Arrays.asList(product1, product2, product3);
AdjustSociomantic.injectCartIntoEvent(event, products);
Adjust.trackEvent(event);
可用购物车参数
参数名称 | 要求 | 描述 | 请注意 |
---|
SCMProductID | 必要参数 | 产品 ID | 该产品 ID 不应包含任何色彩与尺寸衍类的子 ID。 |
SCMAmount | 可选 | 十进制值产品价格 (例如:2.99) | 请使用点 (.) 作为小数分隔符,不要使用任何千位数分隔符。即便产品数量值大于 1,也请提供单个产品价格。 |
SCMCurrency | 可选 | ISO 4217 格式货币代码 (例如:EUR) | 固定货币代码。应当已在跟踪代码示例中为您提供。 |
SCMQuantity | 可选 | 选定产品数量 | 请使用整数值。 |
未确认交易
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");
List<object> products = Arrays.asList(product1, product2, product3);
AdjustSociomantic.injectTransactionIntoEvent(event, "123456", products);
Adjust.trackEvent(event);
或带参数:
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");
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);
已确认交易
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");
List<object> products = Arrays.asList(product1, product2, product3);
AdjustSociomantic.injectConfirmedTransactionIntoEvent(event, "123456", products);
Adjust.trackEvent(event);
或带参数:
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");
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);
可用购物车参数
参数名称 | 要求 | 描述 | 请注意 |
---|
SCMAmount | 可选 | 十进制值产品价格 (例如:2.99) | 请使用点 (.) 作为小数分隔符,不要使用任何千位数分隔符。即便产品数量值大于 1,也请提供单个产品价格。 |
SCMCurrency | 可选 | ISO 4217 格式货币代码 (例如:EUR) | 固定货币代码。应当已在跟踪代码示例中为您提供。 |
SCMQuantity | 可选 | 选定产品数量 | 请使用整数值。 |
Lead 事件
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(LEAD_TOKEN);
AdjustSociomantic.injectLeadIntoEvent(event, "123456");
Adjust.trackEvent(event);
或已确认的 lead:
import com.adjust.sdk.plugin.AdjustSociomantic;
AdjustEvent event = new AdjustEvent(LEAD_TOKEN);
AdjustSociomantic.injectLeadIntoEvent(event, "123456", Boolean.TRUE);
Adjust.trackEvent(event);