Sociomantic plugin integration
You can integrate the Adjust SDK with Sociomantic events by following one of the methods below.
Before you begin
You need to download and set up the Adjust SDK for your platform. Follow the instructions linked below to get started.
Set up your environment
iOS
Cocoapods
If you're using Cocoapods, add the following line to your podfile to integrate the Adjust Sociomantic plugin:
pod 'Adjust/Sociomantic'
Carthage
If you're using Carthage, add the following line to your Cartfile to integrate the Adjust Sociomantic plugin:
github "adjust/ios_sdk" "sociomantic"
Install from source
You can add the Adjust Sociomantic plugin to your project manually by doing the following:
- Locate the
plugin/Sociomantic
folder inside the archive you downloaded from the release page. - Drag the
ADJSociomantic.h
andADJSociomantic.m
files into theAdjust
folder inside your project. - When the Choose options for adding these files dialog appears, check the Copy items if needed checkbox and select the radio button to Create groups.
Android
Maven
If you are using Maven, add the following dependency to your build.gradle
file:
dependencies {
implementation 'com.adjust.sdk:adjust-android:4.28.2'
implementation 'com.adjust.sdk:adjust-android-criteo:4.28.2'
}
Add as JAR
You can also add the plugin as a JAR file from our releases page.
React
In your .js
file, add the following import statement:
import { Adjust, AdjustEvent, AdjustConfig } from 'react-native-adjust';`
In your App.js
file, initialize the Adjust SDK with the following code:
constructor(props) {
super(props);
const adjustConfig = new AdjustConfig("{YourAppToken}", AdjustConfig.EnvironmentSandbox);
Adjust.create(adjustConfig);
}
componentWillUnmount() {
Adjust.componentWillUnmount();
}
Replace {YourAppToken}
with the app token found in your Adjust dashboard.
Sociomantic events
Once you have installed the Sociomantic plugin, you will have access to the Sociomantic events methods as well as the following constants. You should use these as the property names of your dictionaries.
Sociomantic constants 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 constants Android
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;
Before sending any Sociomantic events, you should set a partner ID as shown below:
#import "ADJSociomantic.h"
[ADJSociomantic injectPartnerIdIntoSociomanticEvents:@"{sociomanticPartnerId}"];
Once you have set your partner ID, you can integrate the different Sociomantic events.
Examples
Customer event
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:ANY_TOKEN];
NSDictionary *customerData = @{
SCMCustomerID: @"123456"
};
[ADJSociomantic injectCustomerDataIntoEvent:event withData:customerData];
[Adjust trackEvent:event];
View home page
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:HOMEPAGE_TOKEN];
[ADJSociomantic injectHomePageIntoEvent:event];
[Adjust trackEvent:event];
View listing
#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];
View product
#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];
Available product parameters
Parameter name | Requirement | Description | Note |
---|---|---|---|
SCMCategory | Required* | Product category (entire category path) | Category information provided in the tracking code on category or listing pages should match the category information provided in the feed or in the tracking code of product pages. |
SCMProductName | Required* | Product name | Special characters should not be encoded but provided in proper UTF-8. Do not use any HTML markup. |
SCMSalePrice | Required* | Sale price as decimal value (e.g. 2.99) | Please use a dot as a decimal separator and do not use any thousand separators. |
SCMAmount | Required* | Regular price as decimal value (e.g. 3.99) | Please use a dot as a decimal separator and do not use any thousand separators. |
SCMCurrency | Required* | Currency code in ISO 4217 format (e.g. EUR) | Fixed currency code. Should have been provided to you in the tracking code examples. |
SCMProductURL> | Required* | Product URL (deeplink) | Please provide a working deeplink ideally without any click tracking parameter (Google Analytics, HURRA, Eulerian, etc.), Please always use deeplinks with http:// |
SCMProductImageURL | Required* | Product image URL | Please provide images in a reasonable size. For an optimal appearance in the ads the images should be at least 200x200px and should have the same aspect ratio. |
SCMBrand | Required* | Product brand | Special characters should not be encoded but provided in proper UTF-8 (Same as SCMProductName above). Do not use any HTML markup. |
SCMDescription | Optional | Short product description | Special characters should not be encoded but provided in proper UTF-8 (Same as SCMProductName above). Do not use any HTML markup. |
SCMTimestamp | Optional | Timestamp until when the product is available (please use GMT time) | Please provide the date a visitor has searched for. It should be an NSTimeInterval wrapped in NSNumber (see example). |
SCMValidityTimestamp | Optional | Timestamp until when the product is available (please use GMT time) | Please provide the unix timestamp until when the product is available. Please use 0 for products that are always available. It should be an NSTimeInterval wrapped in NSNumber (Same as SCMTimestamp above). |
SCMQuantity | Optional | Number of products in stock | Please integrate this field only after discussion with your personal Sociomantic contact |
SCMScore | Optional | Priority score of the product (value range is between 0 to 10.0) | Please integrate this field only after discussion with your personal Sociomantic contact |
Cart
#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];
Available cart parameters
Parameter name | Requirement | Description | Note |
---|---|---|---|
SCMProductID | Required | Product ID | Please provide the product ID without any subIDs for any color or size variations. |
SCMAmount | Optional | Product price as decimal value (e.g. 2.99) | Please use a dot as a decimal separator and do not use any thousand separators. Please only provide price per product, even if quantity has a value larger than 1. |
SCMCurrency | Optional | Currency code in ISO 4217 format (e.g. EUR) | Fixed currency code. Should have been provided to you in the tracking code examples. |
SCMQuantity | Optional | Quantity of the product selected | Please use an integer value. |
Unconfirmed transaction
#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];
Or with parameters:
#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];
Confirmed transactions
#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];
Or with parameters:
#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];
Available cart parameters
Parameter name | Requirement | Description | Note |
---|---|---|---|
SCMAmount | Optional | Product price as decimal value (e.g. 2.99) | Please use a dot as a decimal separator and do not use any thousand separators. Please only provide price per product, even if quantity has a value larger than 1. |
SCMCurrency | Optional | Currency code in ISO 4217 format (e.g. EUR) | Fixed currency code. Should have been provided to you in the tracking code examples. |
SCMQuantity | Optional | Quantity of the product selected | Please use an integer value. |
Lead event
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:LEAD_TOKEN];
[ADJSociomantic injectLeadIntoEvent:event leadID:@"123456789"];
[Adjust trackEvent:event];
Or confirmed lead:
#import "ADJSociomantic.h"
ADJEvent *event = [ADJEvent eventWithEventToken:LEAD_TOKEN];
[ADJSociomantic injectLeadIntoEvent:event leadID:@"123456789" andConfirmed:YES];
[Adjust trackEvent:event];