To use this feature, you first need to download and set up the Adjust SDK for your platform.
Set up your environment
Add the following line to your Podfile
:
Add following line to your Cartfile
:
github "adjust/ios_sdk" "trademob"
Install from source
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 /vercel/path0/src/content/docs/sdk/ios/v4/plugins/trademob.mdxADJTrademob.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 .
Trademob events
View listing
let event = ADJEvent ( eventToken : "{viewListingEventToken}" )
let itemIds = [ "itemId1" , "itemId2" , "itemId3" ]
ADJTrademob. injectViewListing ( into : event, itemIds : itemIds, metadata : metadata)
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
let event = ADJEvent ( eventToken : "{viewItemEventToken}" )
ADJTrademob. injectViewItem ( into : event, itemId : "itemId" , metadata : metadata)
ADJEvent * event = [ADJEvent eventWithEventToken: @"{viewItemEventToken}" ];
NSDictionary * metadata = @{ @"info1" : @"value1" , @"info2" : @"value2" };
[ADJTrademob injectViewItemIntoEvent: event itemId: @"itemId" metadata: metadata];
[Adjust trackEvent: event];
Add to basket
let event = ADJEvent ( eventToken : "{addToBasketEventToken}" )
let item1 = ADJTrademobItem ( id : "itemId1" , price : 120.4 , quantity : 1 )
let item2 = ADJTrademobItem ( id : "itemId2" , price : 20.1 , quantity : 4 )
let items = [item1, item2]
ADJTrademob. injectAddToBasket ( into : event, items : items, metadata : nil )
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
let event = ADJEvent ( eventToken : "{checkoutEventToken}" )
let item1 = ADJTrademobItem ( id : "itemId1" , price : 120.4 , quantity : 1 )
let item2 = ADJTrademobItem ( id : "itemId2" , price : 20.1 , quantity : 4 )
let items = [item1, item2]
ADJTrademob. injectCheckout ( into : event, items : items, metadata : metadata)
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];