Trademob plugin integration You can integrate the Adjust SDK with Trademob events by following one of the methods below.
To use this feature, you first need to download and set up the Adjust SDK for your platform. Follow the instructions linked below to get started.
⚙️ iOS / Android
iOS Expand all
If you're using Cocoapods, add the following line to your podfile to integrate the Adjust Trademob plugin:
If you're using Carthage, add the following line to your Cartfile to integrate the Adjust Trademob plugin:
github "adjust/ios_sdk" "trademob"
You can add the Adjust Trademob plugin to your project manually by doing the following:
Locate the plugin/Trademob
folder inside the archive you downloaded from the release page Drag the ADJTrademob.h
and ADJTrademob.m
files into the Adjust
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 Expand all
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-trademob:4.28.2'
}
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.
Trademob events View listing
#import "ADJTrademob.h"
ADJEvent *event = [ADJEvent eventWithEventToken:@"{viewListingEventToken}"];
NSArray *itemIds = @[@"itemId1", @"itemId2", @"itemId3"];
NSDictionary *metadata = @{@"info1":@"value1", @"info2":@"value2"};
[ADJTrademob injectViewListingIntoEvent:event itemIds:itemIds metadata:metadata];
[Adjust trackEvent:event];
View item
#import "ADJTrademob.h"
ADJEvent *event = [ADJEvent eventWithEventToken:@"{viewItemEventToken}"];
NSDictionary *metadata = @{@"info1":@"value1", @"info2":@"value2"};
[ADJTrademob injectViewItemIntoEvent:event itemId:@"itemId" metadata:metadata];
[Adjust trackEvent:event];
Add to basket
#import "ADJTrademob.h"
ADJEvent *event = [ADJEvent eventWithEventToken:@"{addToBasketEventToken}"];
ADJTrademobItem *item1 = [[ADJTrademobItem alloc] initWithId:@"itemId1" price:120.4 quantity:1];
ADJTrademobItem *item2 = [[ADJTrademobItem alloc] initWithId:@"itemId2" price:20.1 quantity:4];
NSArray *items = @[item1, item2];
[ADJTrademob injectAddToBasketIntoEvent:event items:items metadata:nil];
[Adjust trackEvent:event];
Checkout
#import "ADJTrademob.h"
ADJEvent *event = [ADJEvent eventWithEventToken:@"{checkoutEventToken}"];
ADJTrademobItem *item1 = [[ADJTrademobItem alloc] initWithId:@"itemId1" price:120.4 quantity:1];
ADJTrademobItem *item2 = [[ADJTrademobItem alloc] initWithId:@"itemId2" price:20.1 quantity:4];
NSArray *items = @[item1, item2];
NSDictionary *metadata = @{@"info1":@"value1", @"info2":@"value2"};
[ADJTrademob injectCheckoutIntoEvent:event items:items metadata:metadata];
[Adjust trackEvent:event];