Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.adjust.sdk.plugin;
import com.adjust.sdk.AdjustEvent;
import com.adjust.sdk.AdjustFactory;
import com.adjust.sdk.ILogger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* AdjustSociomantic Class
* Created by Nicolas Brugneaux [email protected] on 01/04/15.
*/
public abstract class AdjustSociomantic {
public final static String SCMCategory = "category";
public final static String SCMProducts = "products";
public final static String SCMProductName = "fn";
public final static String SCMSalePrice = "price";
public final static String SCMAmount = "amount";
public final static String SCMCurrency = "currency";
public final static String SCMProductURL = "url";
public final static String SCMProductImageURL = "photo";
public final static String SCMBrand = "brand";
public final static String SCMDescription = "description";
public final static String SCMTimestamp = "date";
public final static String SCMValidityTimestamp = "valid";
public final static String SCMQuantity = "quantity";
public final static String SCMScore = "score";
public final static String SCMProductID = "identifier";
public final static String SCMActionConfirmed = "confirmed";
public final static String SCMCustomerAgeGroup = "agegroup";
public final static String SCMCustomerEducation = "education";
public final static String SCMCustomerGender = "gender";
public final static String SCMCustomerID = "identifier";
public final static String SCMCustomerMHash = "mhash";
public final static String SCMCustomerSegment = "segment";
public final static String SCMCustomerTargeting = "targeting";
public final static String SCMTransaction = "transaction";
private final static List productAliases = Arrays.asList(
SCMCategory,
SCMProductName,
SCMSalePrice,
SCMAmount,
SCMCurrency,
SCMProductURL,
SCMProductImageURL,
SCMBrand,
SCMDescription,
SCMTimestamp,
SCMValidityTimestamp,
SCMQuantity,
SCMScore
);
private final static List basketAliases = Arrays.asList(
SCMProductID,
SCMAmount,
SCMCurrency,
SCMQuantity
);
private final static List saleAliases = Arrays.asList(
SCMAmount,
SCMCurrency
);
private final static List customerAliases = Arrays.asList(
SCMCustomerAgeGroup,
SCMCustomerEducation,
SCMCustomerGender,
SCMCustomerID,
SCMCustomerMHash,
SCMCustomerSegment,
SCMCustomerTargeting
);
private static String adpanId;
private static ILogger logger = AdjustFactory.getLogger();
public static void injectPartnerIdInSociomanticEvents(String newAdpanId) {
adpanId = newAdpanId;
}
public static void injectCustomerDataIntoEvent(AdjustEvent event, Map customerData) {
if (null == event) {
logger.error("Event object is required.");
return;
}
if (null == customerData) {
logger.error("Customer data is required.");
return;
}
Map data = new HashMap();
for (Entry entry: customerData.entrySet()) {
if (!customerAliases.contains(entry.getKey())) {
logger.warn("Key must belong to the customer Aliases, entry: %s was discarded", entry.getKey());
}
else {
data.put(entry.getKey(), entry.getValue());
}
}
String dob = stringify(data);
addPartnerParameter(event, "socio_dob", dob);
}
public static void injectHomePageIntoEvent(AdjustEvent event) {
if (null == event) {
logger.error("Event object is required.");
}
addPartnerParameter(event);
}
public static void injectViewListingIntoEvent(AdjustEvent event, List categories) {
injectViewListingIntoEvent(event, categories, null);
}
public static void injectViewListingIntoEvent(AdjustEvent event, List categories, String date) {
if (null == event) {
logger.error("Event object is required.");
return;
}
if (null == categories) {
logger.error("Categories list is required.");
return;
}
Map co = new HashMap();
if (null != date) {
co.put(SCMTimestamp, date);
}
co.put(SCMCategory, categories);
addPartnerParameter(event, "socio_co", stringify(co));
}
public static void injectProductIntoEvent(AdjustEvent event, String productId) {
injectProductIntoEvent(event, productId, null);
}
public static void injectProductIntoEvent(AdjustEvent event, String productId, Map parameters) {
if (null == event) {
logger.error("Event object is required.");
return;
}
if (null == productId || "".equals(productId)) {
logger.error("Product ID is required.");
return;
}
Map>> po = new HashMap>>(1);
List