Documentation

Introduction

How to start?

The integration of affilinet's Mobile SDK is straight forward. Just download the Mobile SDK Package for iOS or Android and go through this documentation to find all the necessary info.

What else you need to consider?

Integrating the affilinet Mobile SDK is just a first step, mainly done by development. Please consider also to:

  • Provide publishers with a link to your Mobile App in the login area
  • Provide publishers with a link to your Mobile Website in the login area
  • Integrate the web tracking into your Mobile Website
  • Considerations on the Demo app

    Inside the demo App code you need to replace the exisiting Program ID with your own program ID.

    in iOS
    1
    2
    3
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountID = {PROGRAM-ID};
    [[ANSession sharedInstance] openWithAccount:account andCountryCode:CountryCodeDE];
    
    in Android
    1
    2
    3
    4
    5
    6
    7
    Account account = new AdvertiserAccount({PROGRAM-ID});
    Session session = Session.getInstance();
    try {
        session.open(getApplicationContext(), account, CountryCode.DE);
    } catch (Exception e) {
        Log.v("affilinet", e.getMessage());
    }
    

    iOS Advertiser SDK

    Requirements

    • iOS 6 or later
    • A valid affilinet advertiser account
    • libxml2.dylib must be added to the Link Binary With Libraries section of the Build Phases tab of the project settings
    • ${SDK_ROOT}/usr/include/libxml2 must be added to the Header Search Paths of the Build Settings tab of the project settings
    • -ObjC flag must be added to the Other Linker Flags entry of the Build Settings tab of the project settings

    How to use

    1. In the Build Phases tab of the project settings add the libxml2.dylib to the Link Binary With Libraries section
    2. In the Build Settings tab of the project settings add to the Header Search Paths the following path: ${SDK_ROOT}/usr/include/libxml2
    3. Add the AffilinetAdvertiser.framework to the project directly or by adding pod 'AffilinetAdvertiser' to your podfile if using cocoapods
    4. Compile and run

    Class Overview

    ANSession

    The advertiser must always open a session before doing any type of requests with affilinet backend. The ANSession object should be used as a singleton throughout the whole application and is responsible for all requests to affilinet.

    Attribute Type Description
    account ANAdvertiserAccount The session’s account
    platform ANPlatform The session’s platform
    (^onRequestResponse)(ANRequest *, ANRequestResponse *) NSBlock Request Response block
    (^onRequestsError)(NSError *) NSBlock Requests Error block
    (^onRequestsFinished)(void) NSBlock Requests Finished block
    Method Returns Description
    sharedInstance ANSession Returns the singleton ANSession instance
    openWithAccount:(ANAdvertiserAccount*) andCountryCode:(ANCountryCode) void Opens a session with the specified account and Platform
    executeRequests:(NSArray *) void Executes the requests in the input array
    ANAdvertiserAccount

    The ANAdvertiserAccount class specifies the account to be used by the SDK on all requests to affilinet.

    Attribute Type Description Mandatory
    accountIDs NSArray* The advertiser’s account ids YES
    Method Returns Description
    advertiserAccountWithIDs:(NSArray* accountIds) AdvertiserAccount Class Constructor
    ANPlatform

    The ANPlatform specifies a country (with a platform) that can be later used to open a session with affilinet.

    Method Returns Description
    initWithCountryCode:(ANCountryCode) ANPlatform The initialization method of the class
    stringValue NSString Gets the country code as a string value
    domain NSString Gets the country affilinet domain
    ANCountryCode

    The ANCountryCode is an enumeration that makes it easier to specify a Country Code, with which you define the platform of your program with affilinet

    ANCountryCodeDE
    ANCountryCodeAT
    ANCountryCodeCH
    ANCountryCodeGB
    ANCountryCodeFR
    ANCountryCodeES
    ANCountryCodeNL
    ANCountryCodeBE
    ANCountryCodeLU
    ANRequest

    All requests to affilinet (javascript) are specified by ANRequest objects. The ANRequest class should not be used directly but instead it’s supposed to be subclassed (one can look at it as an abstract class in java, although there is no such concept in Objective-C).

    Attribute Type Description
    session ANSession The session
    protocol ANRequestProtocol The request web protocol
    Method Returns Description
    initWithSession:(ANSession) ANRequest Creates a new instance of a request
    ANRequestProtocol

    The ANRequestProtocol is an enumeration that makes it easier to specify a protocol.

    ANRequestProtocolHTTP
    ANRequestProtocolHTTPS
    ANOTOrderAdType

    The ANOTOrderAdType represents an order tracking class type.

    Attribute Type Description
    adType ANAdType The ad type
    adNumber NSInteger The ad number
    Method Returns Description
    initWithAdNumber:(NSInteger) andAdType:(ANAdType) ANOTOrderAdType Creates a new instance of an ad type
    ANAdType

    Ad type enumeration that represents a graphic banner, an html creative or a text link.

    kANAdTypeGraphicBanner
    kANAdTypeTextLink
    kANAdTypeHTMLCreative
    ANSaleTracking

    An ANSaleTracking represents an order tracking request to the affilinet backend.

    Attribute Type Description Mandatory
    order ANRTOrder The order YES (orderId, total > 0)
    rateNumber NSInteger The order rate mandatory only if server-sided attribution is used
    voucherCode NSString voucher code that was used with the order NO
    orderDescription NSString description that overwrites the rate name shown to publishers NO
    currency ANCurrency Currency NO
    adType ANOTOrderAdType ad type mandatory only if server-sided attribution is used
    clickDate NSDate click time mandatory only if server-sided attribution is used
    orderDate NSDate date and time of attributed basket creation mandatory only if server-sided attribution is used
    programSubID NSArray * program subids, max of 4 NO
    publisherId NSInteger publisher id mandatory only if server-sided attribution is used
    publisherSubID NSString publisher subId mandatory only if server-sided attribution is used
    ANLeadTracking

    An ANLeadTracking represents a lead tracking request to the affilinet backend.

    Attribute Type Description Mandatory
    order ANRTOrder order YES (orderId)
    orderRate ANOTOrderRate order rate mandatory, only if rate mapping is not used
    voucherCode NSString voucher code that was used with the order NO
    orderDescription NSString description that overwrites the rate name shown to publishers NO
    currency ANCurrency Currency NO
    adType ANOTOrderAdType ad type mandatory only if server-sided attribution is used
    clickDate NSDate click time mandatory only if server-sided attribution is used
    orderDate NSDate date and time of attributed basket creation mandatory only if server-sided attribution is used
    programSubID NSArray program subids, max of 4 NO
    publisherId NSInteger publisher id mandatory only if server-sided attribution is used
    publisherSubID NSString publisher subId mandatory only if server-sided attribution is used
    ANBasketTracking

    An ANBasketTracking represents a basket tracking request to the affilinet backend.

    Attribute Type Description Mandatory
    basketItems NSArray <ANOTBasketItem*> The items included in this order YES
    orderId NSString Unique identifier for this order YES
    orderDescription NSString Description of the order to be attributed NO
    orderRate ANOTOrderRate order rate mandatory, only if rate mapping is not used
    voucherCode NSString voucher code that was used with the order NO
    currency ANCurrency Currency NO
    programSubID NSArray program subids, max of 4 NO
    publisherId NSInteger publisher id mandatory only if server-sided attribution is used
    publisherSubID NSString publisher subId mandatory only if server-sided attribution is used
    adType ANOTOrderAdType ad type mandatory only if server-sided attribution is used
    clickDate NSDate click time mandatory only if server-sided attribution is used
    orderDate NSDate date and time of attributed basket creation mandatory only if server-sided attribution is used
    ANOTBasketItem

    An ANOTBasketItem represents one item in the basket order tracking.

    Attribute Type Description Mandatory
    articleNumber NSString The article number YES
    productName NSString The product name NO
    category NSString The product category NO
    quantity NSInteger The item quantity YES
    singlePrice double The item unit price YES
    brand NSString The product brand NO
    properties NSMutableArray An array of additional properties NO
    orderRate ANOTOrderRate The order rate NO
    ANOTOrderRate

    An ANOTOrderRate represents an order rate.

    Attribute Type Description Mandatory
    rateNumber NSInteger The rate number YES
    rateMode ANOTOrderRateMode The rate mode YES
    Method Returns Description
    initWithRateNumber:(NSInteger) andRateMode:(ANOTOrderRateMode) ANOTOrderRate Initializes a new instance of an order rate
    stringValue NSString Returns the current order rate mode as a string
    ANOTOrderRateMode

    Enumeration that represents a pay-per-lead or pay-per-sale rating mode

    OTOrderRateModeLead
    OTOrderRateModeSale
    ANCurrency

    An ANCurrency is used to define the currency of the net price of the order

    Method Returns Description
    initWithStringCode:(NSString *) currencyCode ANCurrency Initializes a new instance of a currency using a 3-letter currency code. Some currency codes are predefined with prefix `kANCurrencyCode`, but any 3-letter code can be used.
    stringValue NSString Returns the current currency code as a string
    ANRTProduct

    Represents a product that can be used for Profiling requests.

    Attribute Type Description Mandatory
    productId NSString The product id YES
    name NSString The product name NO
    price double The product price YES
    oldPrice double Original product price if the price has been reduced NO
    brand NSString Product brand name NO
    rating NSInteger Product rating. 0 (not rated) to 10 (highest rating) NO
    inStock BOOL Flag showing whether a product is in stock or not NO
    onSale BOOL Flag showing whether a product is reduced or not NO
    accessory BOOL Flag indicating a main product or an accessory NO
    clickUrl NSString Product page URL including tracking parameters (URL Encoded) NO
    imageUrl NSString Product image URL (URL Encoded) NO
    category ANRTProductCategory Product Category NO
    ANRTTravelProduct

    Class that represents a travel product that can be used for Profiling requests. Extends ANRTProduct.

    Attribute Type Description Mandatory
    productId NSString The product id YES
    name NSString The product name NO
    price double The product price YES
    oldPrice double Original product price if the price has been reduced NO
    brand NSString Product brand name NO
    rating NSInteger Product rating. 0 (not rated) to 10 (highest rating) NO
    inStock BOOL Flag showing whether a product is in stock or not NO
    onSale BOOL Flag showing whether a product is reduced or not NO
    accessory BOOL Flag indicating a main product or an accessory NO
    clickUrl NSString Product page URL including tracking parameters (URL Encoded) NO
    imageUrl NSString Product image URL (URL Encoded) NO
    category ANRTProductCategory Product Category NO
    departureDate NSDate The departure (start) date of the travel NO
    endDate NSDate The end date of the travel NO
    productType NSString Trip type (flight-only, package holiday etc.) NO
    kids BOOL Flag showing whether children are travelling as well NO
    numberOfAdults NSInteger Number of adults travelling NO
    hotelCategory NSString Hotel category (middle, luxury, etc.) NO
    pointOfDeparture NSString Point of departure NO
    pointOfDestination NSString Point of destination NO
    ANRTDatingProduct

    Class that represents a product that can be used for Profiling requests. Extends ANRTProduct.

    Attribute Type Description Mandatory
    productId NSString The product id YES
    name NSString The product name NO
    price double The product price YES
    oldPrice double Original product price if the price has been reduced NO
    brand NSString Product brand name NO
    rating NSInteger Product rating. 0 (not rated) to 10 (highest rating) NO
    inStock BOOL Flag showing whether a product is in stock or not NO
    onSale BOOL Flag showing whether a product is reduced or not NO
    accessory BOOL Flag indicating a main product or an accessory NO
    clickUrl NSString Product page URL including tracking parameters (URL Encoded) NO
    imageUrl NSString Product image URL (URL Encoded) NO
    category ANRTProductCategory Product Category NO
    customer ANRTDatingCustomer Dating Customer NO
    ANRTDatingCustomer

    A dating customer object to be used in a dating product view tagging.

    Attribute Type Description Mandatory
    gender NSString The customer's gender NO
    ageRange NSString The customer's age range NO
    zipCode NSString The customer's zip/postal code NO
    wasLoggedIn BOOL Flag showing whether the customer was logged in NO
    ANRTProductCategory

    Class that represents a product category that can be used for Profiling requests

    Attribute Type Description Mandatory
    name (read only) NSString category name the page belongs to YES
    categoryId NSString category ID the page belongs to not mandatory, but strongly recommended
    pathItems NSArray Category path components NO
    clickURL NSString Category page URL including tracking parameters (URL Encoded) NO
    imageURL NSString Category image URL (URL Encoded) NO
    ANRTOrderItem

    Represents an Order Item that can be used in Profiling requests

    Attribute Type Description Mandatory
    product ANRTProduct The order's product YES
    quantity NSInteger The order's product quantity YES
    ANRTOrder
    Attribute Type Description
    orderId NSString The order id
    items NSArray<ANRTOrderItem> The order items
    total double The order total amount including tax
    ANProductViewTagging

    An ANProductViewTagging is used for a Product View Tagging request

    Attribute Type Description Mandatory
    product ANRTProduct (ANRTTravelProduct, ANRTDatingProduct) The product (normal, travel or dating) YES (name, productid, category, price > 0)
    currency ANCurrency currency YES
    refererUrl NSString Referer url NO
    Method Returns Description
    initWithSession:(ANSession) ANProductViewTagging Initialization method
    ANAddToCartTagging

    An ANAddToCartTagging is used for a Add To Cart View Tagging request

    Attribute Type Description Mandatory
    item ANRTOrderItem Order item YES (name, productId, category, price > 0, quantity > 0)
    currency ANCurrency Currency YES
    refererURL NSString Referer url NO
    Method Returns Description
    initWithSession:(ANSession) ANAddToCartTagging Initialization method
    ANCartViewTagging

    An ANCartViewTagging is used for a Cart View Tagging request

    Attribute Type Description Mandatory
    items NSArray Order items YES (product.name, product.productId, product.category, product.price > 0, order.quantity > 0)
    currency ANCurrency Currency YES
    tax double tax NO
    total double total price NO
    refererURL NSString URL of the page that refered the user NO
    voucherCode NSString voucher code that was used with the order NO
    voucherDiscount NSInteger voucher discount NO
    Method Returns Description
    initWithSession:(ANSession) ANCartViewTagging Initialization method
    ANRemoveFromCartTagging

    An ANRemoveFromCartTagging is used for a Remove From Cart Tagging request.

    Attribute Type Description Mandatory
    item ANRTOrderItem Order item YES (name, productId, category, price > 0, quantity > 0)
    currency ANCurrency Currency YES
    refererURL NSString URL of the page that refered the user NO
    Method Returns Description
    initWithSession:(ANSession) ANRemoveFromCartTagging Initialization method
    ANCheckoutTagging

    An ANCheckoutTagging is used for a Checkout View Tagging request.

    Attribute Type Description Mandatory
    order ANRTOrder An order YES (orderId, order.total > 0, product.price > 0, product.quantity > 0, product.id)
    currency ANCurrency Currency YES
    publisherId NSInteger publisher id mandatory only if server-sided attribution is used
    customerAge NSInteger customer age NO
    customerAgeRange NSString customer age range NO
    customerCountry NSString cusomer country NO
    customerGender NSString customer gender NO
    customerStatus NSString customer status NO
    customerZip NSString customer zip code NO
    paymentType NSString payment type NO
    shippingGrossPrice double shipping gross price NO
    shippingTax NSInteger shipping tax NO
    shippingType NSString shipping type NO
    voucherCode NSString voucher code that was used with the order NO
    voucherCodeDiscount NSInteger voucher code discount NO
    tax NSInteger tax NO
    refererUrl NSString Referer url NO
    Method Returns Description
    initWithSession:(ANSession) ANCheckoutTagging Initialization method
    ANCategoryViewTagging

    An ANCategoryViewTagging is used for a Category View Tagging request

    Attribute Type Description Mandatory
    category ANRTProductCategory A product category YES (categoryId, categoryName)
    refererUrl NSString Referer url NO
    Method Returns Description
    initWithSession:(ANSession) ANCategoryViewTagging Initialization method
    ANPageViewTagging

    An ANPageViewTagging is used for a Page View Tagging request

    Attribute Type Description Mandatory
    pageURL NSString Page Url NO
    pageType NSString Page Type NO
    pageName NSString Page Name not mandatory, but strongly recommended
    pageCategory NSString Page Category NO
    refererURL NSString Referer url NO
    Method Returns Description
    initWithSession:(ANSession) ANPageViewTagging Initialization method
    ANSearchPageTagging
    Attribute Type Description Mandatory
    keywords NSArray Search terms YES
    products NSArray ANRTProduct The search result products YES
    refererUrl NSString Referer url NO
    Method Returns Description
    initWithSession:(ANSession) ANSearchPageTagging Initialization method

    Use Cases Order Tracking

    Basket Order Tracking

    To perform basket order tracking, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANBasketTracking can now be created (with ANOTBasketItem items) and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create one or more Basket Items
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    ANOTBasketItem *basketItem = [[ANOTBasketItem alloc] init];
    // mandatory parameters
    basketItem.articleNumber = @"ArticleNb1";
    basketItem.quantity = 1;
    basketItem.singlePrice = 20.45;
    // optional parameters 
    basketItem.productName = @"Amazing Product";
    basketItem.category = @"jeans";
    basketItem.brand = @"Versace";
    basketItem.properties = [[NSMutableArray alloc] initWithArray:@[@"example1", @"example2"]];
    basketItem.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1
    andRateMode:OTOrderRateModeSale];
    
    ANOTBasketItem *basketItem2 = [[ANOTBasketItem alloc] init];
    
    // mandatory parameters
    basketItem2.articleNumber = @"ArticleNb2";
    basketItem2.quantity = 3;
    basketItem2.singlePrice = 60.45;
    
    // optional parameters
    basketItem2.productName = @"Amazing Product 2";
    basketItem2.category = @"jeans 2";
    basketItem2.brand = @"Versace 2";
    basketItem2.properties = [[NSMutableArray alloc] initWithArray:@[@"example1", @"example2"]];
    basketItem2.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1
    andRateMode:OTOrderRateModeSale];
    
    Create at least one Basket Order Tracking object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    ANBasketTracking *basketTracking = [[ANBasketTracking alloc] initWithSession:self.session];
    
    // mandatory parameters
    basketTracking.orderId = (NSString *) CFBridgingRelease(CFUUIDCreateString(NULL,
    CFUUIDCreate(NULL)));
    basketTracking.orderItems = @[basketItem, basketItem2];
    basketTracking.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1 
    andRateMode:OTOrderRateModeSale];
    
    // optional parameters
    basketTracking.voucherCode = @"TEST";
    basketTracking.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    basketTracking.programSubID = @[@"custom-program-subid1", @"custom-program-subid2"];
    basketTracking.orderDescription = @"custom-order-description";
    
    // parameters for server sided tracking only
    basketTracking.publisherID = 784108;
    basketTracking.publisherSubID = @"custom-publisher-subid";
    basketTracking.adType = [[ANOTOrderAdType alloc] initWithAdNumber:1
    andAdType:kANAdTypeGraphicBanner];
    basketTracking.clickDate = [NSDate date];
    basketTracking.orderDate = [NSDate date];
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
    };
    
    Execute request
    1
    [session executeRequests:@[basketTracking]];
    

    Sale Order Tracking

    To perform sale tracking, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANSaleTracking can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create at least one Sale Tracking object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    ANSaleTracking *saleTracking = [[ANSaleTracking alloc] initWithSession:session];
    
    // mandatory parameters 
    saleTracking.order = [[ANRTOrder alloc] init];
    saleTracking.order.orderId = (NSString *) CFBridgingRelease(CFUUIDCreateString(NULL, 
    CFUUIDCreate(NULL)));
    saleTracking.order.total = 400;
    
    // optional parameters
    saleTracking.programSubID = [@[@"custom-program-subid1", @"custom-program-subid2"];
    saleTracking.voucherCode = @"TEST";
    saleTracking.currency = [[ANCurrency alloc] initWithCurrencyCode:ANCurrencyCodeEUR];
    saleTracking.orderDescription = @"custom-order-description";
    
    // parameters for server sided tracking only
    saleTracking.adType = [[ANOTOrderAdType alloc] initWithAdNumber:1 andAdType:kANAdTypeGraphicBanner];
    saleTracking.publisherID = 784108;
    saleTracking.publisherSubID = @"custom-publisher-subid";
    saleTracking.clickDate = [NSDate date];
    saleTracking.orderDate = [NSDate date];
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
    };
    
    Execute request
    1
    [session executeRequests:@[saleTracking]];
    

    Lead Order Tracking

    To perform lead tracking, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANLeadTracking can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create one Lead Tracking
    1
    2
    ANLeadTracking *leadTracking = [[ANLeadTracking alloc] initWithSession:self.session];
    leadTracking.rateNumber = 1;
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
    };
    
    Execute request
    1
    [session executeRequests:@[leadTracking]];
    

    App Download Tracking

    To perform app download tracking, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANLeadTracking can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    To track unique downloads with ANLeadTracking the request should only be executed once for each installation of the application, we advise the use of a flag stored in NSUserDefaults to achieve this. This should be implemented in the application:​ did​Finish​Launching​With​Options: method of the app delegate.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Check if this installation has been tracked
    1
    2
    3
    4
    const NSString *kNamespacedKey = @"com.namespaced.key";
    if (![[NSUserDefaults standardUserDefaults] boolForKey:kNamespacedKey]) {
    	//following code will be written within these braces to ensure it's only executed once
    }
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountID = {PROGRAM-ID};
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create one App Download Tracking
    1
    2
    ANLeadTracking *leadTracking = [[ANLeadTracking alloc] initWithSession:self.session];
    leadTracking.rateNumber = 1;
    
    Set session completion blocks - recommended location to set flag for download tracking
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
       	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
        	[userDefaults setBool:YES forKey:kNamespacedKey];
        	[userDefaults synchronize];
        	NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
    };
    
    Execute request
    1
    [session executeRequests:@[leadTracking]];
    

    Use Cases Profiling

    Product View Profiling

    To perform Product View profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANProductViewTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create one Product
    Simple Product
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip Flops"];
    category.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    category.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    product.category = category;
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.brand = @"Amazing Brand";
    product.rating = 7;
    product.inStock = YES;
    product.onSale = YES;
    product.accessory = NO;
    product.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    
    Travel Product
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    
    ANRTTravelProduct *product= [[ANRTTravelProduct alloc] init];
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing Travel Product";
    product.departureDate = [NSDate dateWithTimeIntervalSinceNow:0];
    product.endDate = [NSDate dateWithTimeIntervalSinceNow:10];
    product.productType = @"with hotel";
    product.kids = NO;
    product.numberOfAdults = 2;
    product.hotelCategory = @"middle";
    product.pointOfDeparture = @"Lisbon";
    product.pointOfDestination = @"Frankfurt";
    product.category = category;
    
    Dating Product
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    
    ANRTDatingProduct *datingProduct = [[ANRTDatingProduct alloc] init];
    datingProduct.productId = @"replace-with-your-productid";
    datingProduct.category = category;
    
    ANRTDatingCustomer *customer = [[ANRTDatingCustomer alloc] init];
    customer.gender = @"male";
    customer.ageRange = @"18-25";
    customer.zipCode = @"60329";
    datingProduct.customer = customer;     
    
    Create a product view tagging request
    1
    2
    3
    4
    5
    ANProductViewTagging *productTagging = [[ANProductViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    productTagging.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    productTagging.product = product;
    productTagging.refererURL = @"http%3A%2F%2Fadvertiser.com";
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
    };
    
    Execute request
    1
    [session executeRequests:@[productTagging]];
    

    Category View Profiling

    To perform Category View profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANCategoryViewTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create a category
    1
    2
    3
    4
    5
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    productCategory.categoryId = @"c1";
    productCategory.categoryName = @"category name";
    productCategory.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    productCategory.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    Create a Category Tagging request
    1
    2
    3
    4
    ANCategoryViewTagging *categoryTagging = [[ANCategoryViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    categoryTagging.category = productCategory;
    categoryTagging.refererURL = @"http%3A%2F%2Fadvertiser.com";
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
       };
    
    Execute request
    1
    [session executeRequests:@[categoryTagging]];
    

    Add To Cart Profiling

    To perform Add To Cart profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANAddToCartTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create an Order Item
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip Flops"];
    category.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    category.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    product.category = category;
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.brand = @"Amazing Brand";
    product.rating = 7;
    product.inStock = YES;
    product.onSale = YES;
    product.accessory = NO;
    product.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    
    ANRTOrderItem *item = [[ANRTOrderItem alloc] init];
    item.product = product;
    item.quantity = 1;
    
    Create one Add to Cart Tagging request
    1
    2
    3
    4
    ANAddToCartTagging  *addToCart = [[ANAddToCartTagging alloc] initWithSession:
    [ANSession sharedInstance]];
    addToCart.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    addToCart.item = item;
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
       };
    
    Execute request
    1
    [session executeRequests:@[addToCart]];
    

    Remove From Cart Profiling

    To perform Remove From Cart profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANRemoveFromCartTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create an Order Item
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip Flops"];
    category.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    category.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    product.category = category;
    product.productId = (NSString *) CFBridgingRelease(CFUUIDCreateString(NULL, CFUUIDCreate(NULL)));
    product.name = @"Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.brand = @"Amazing Brand";
    product.rating = 7;
    product.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    
    ANRTOrderItem *item = [[ANRTOrderItem alloc] init];
    item.product = product;
    item.quantity = 1;
    
    Create one Remove From Cart Tagging request
    1
    2
    3
    4
    ANRemoveFromCartTagging  *removeFromCart = [[ANRemoveFromCartTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    removeFromCart.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    removeFromCart.item = item;
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
       };
    
    Execute request
    1
    [session executeRequests:@[removeFromCart]];
    

    Cart View Profiling

    To perform Cart View profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANCartViewTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create an Order Item
    Simple Product
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip Flops"];
    category.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    category.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    product.category = category;
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.brand = @"Amazing Brand";
    product.rating = 7;
    product.inStock = YES;
    product.onSale = YES;
    product.accessory = NO;
    product.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    ANRTOrderItem *item1 = [[ANRTOrderItem alloc] init];
    item1.quantity = 2;
    item1.product = product;
    
    ANRTTravelProduct *travelProduct = [[ANRTTravelProduct alloc] init];
    travelProduct.productId = @"replace-with-your-productid";
    travelProduct.name = @"Amazing Travel Product";
    travelProduct.departureDate = [NSDate dateWithTimeIntervalSinceNow:0];
    travelProduct.endDate = [NSDate dateWithTimeIntervalSinceNow:10];
    travelProduct.productType = @"with hotel";
    travelProduct.kids = NO;
    travelProduct.numberOfAdults = 2;
    travelProduct.hotelCategory = @"middle";
    travelProduct.pointOfDeparture = @"Lisbon";
    travelProduct.pointOfDestination = @"Frankfurt";
    travelProduct.category = category;
    ANRTOrderItem *item2 = [[ANRTOrderItem alloc] init];
    item2.quantity = 1;
    item2.product = travelProduct;
    
    Create one Cart View Tagging request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    ANCartViewTagging  *cartView = [[ANCartViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    cartView.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    cartView.items = @[item1, item2];
    cartView.total = 100.00;
    cartView.tax = 20;
    cartView.voucherCode = @"3iidd-12d3";
    cartView.voucherDiscount = 10;
    cartView.refererUrl = @"http%3A%2F%2Fadvertiser.com";
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
       };
    
    Execute request
    1
    [session executeRequests:@[addToCart]];
    

    Checkout Profiling

    To perform Checkout profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANCheckoutTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create one order item
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    ANRTOrder *order = [[ANRTOrder alloc] init];
    order.orderId = @"replace-with-your-orderid";
    order.total = 324.45;
    
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip Flops"];
    category.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    category.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    product.category = category;
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.brand = @"Amazing Brand";
    product.rating = 7;
    product.inStock = YES;
    product.onSale = YES;
    product.accessory = NO;
    product.clickURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = @"http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    ANRTOrderItem *item1 = [[ANRTOrderItem alloc] init];
    item1.quantity = 2;
    item1.product = product;
    
    ANRTTravelProduct *travelProduct = [[ANRTTravelProduct alloc] init];
    travelProduct.productId = @"replace-with-your-productid";
    travelProduct.name = @"Amazing Travel Product";
    travelProduct.departureDate = [NSDate dateWithTimeIntervalSinceNow:0];
    travelProduct.endDate = [NSDate dateWithTimeIntervalSinceNow:10];
    travelProduct.productType = @"with hotel";
    travelProduct.kids = NO;
    travelProduct.numberOfAdults = 2;
    travelProduct.hotelCategory = @"middle";
    travelProduct.pointOfDeparture = @"Lisbon";
    travelProduct.pointOfDestination = @"Frankfurt";
    travelProduct.category = category;
    ANRTOrderItem *item2 = [[ANRTOrderItem alloc] init];
    item2.quantity = 1;
    item2.product = travelProduct;
    
    order.items = @[item1, item2];
    
    Create one Checkout Tagging object
    1
    2
    3
    4
    5
    ANCheckoutTagging *checkoutTagging = [[ANCheckoutTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    checkoutTagging.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    checkoutTagging.refererURL = @"http%3A%2F%2Fadvertiser.com";
    checkoutTagging.order = order;
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
       };
    
    Execute request
    1
    [session executeRequests:@[checkoutTagging]];
    

    Page View Profiling

    To perform Page View profiling, one must first create an instance of an ANAdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the ANSession singleton.

    ANPageViewTagging can now be created and passed to the Session to be executed through the executeRequests: method. Please note that one must implement the success/failure blocks of the Session to implement further logic on requests completion.

    Import header files
    1
    #import <AffilinetAdvertiser/AffilinetAdvertiser.h>
    
    Create Advertiser Account
    1
    2
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[{PROGRAM-ID}];
    
    Open Session with Account and CountryCode
    1
    2
    self.session = [ANSession sharedInstance];
    [self.session openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    Create at least one Page View Tagging object
    1
    2
    3
    4
    5
    6
    7
    ANPageViewTagging  *pageViewTagging = [[ANPageViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    pageViewTagging.pageName = @"pageName";
    pageViewTagging.pageCategory = @"pageCategory";
    pageViewTagging.pageType = @"pageType";
    pageViewTagging.pageURL = @"pageUrl";
    pageViewTagging.refererURL = @"http%3A%2F%2Fadvertiser.com";
    
    Set session completion blocks
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");
       }
    };
    
    session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
    };
    
    session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
       };
    
    Execute request
    1
    [session executeRequests:@[pageViewTagging]];
    

    Android Advertiser SDK

    Requirements

    • Android 2.3.3 (Gingerbread) or later
    • A valid affilinet advertiser account
    • Jsoup library (v. 1.7.2+)
    • INTERNET permission must be set in AndroidManifest.xml file of the app

    How to use

    On Android Studio:
    1. Copy the affilinetsdk.aar library file into the libs folder
    2. Add the following line to the gradle.build
      1
      2
      3
      4
      5
      6
      7
      8
      9
              repositories {
                  jcenter()
                  flatDir {
                      dirs 'libs'
                  }
              }
              dependencies {
                  compile 'com.rm.affilinet:affilinetsdk@aar'
              }
      

    Class Overview

    Session

    The advertiser must always open a session before doing any type of requests with affilinet backend. The Session object should be used as a singleton throught the whole application and is responsible to do all the requests to affilinet.

    Attribute Type Description
    account Account The session’s account
    profile Platform The session’s platform
    Method Returns Description
    getInstance() Session Returns an instance of a Session
    open(Context, Account, Platform) void Opens a session with the specified account and Platform
    executeHtmlRequests(List , SessionCallback) void Executes the requests in the input List
    AdvertiserAccount

    The AdvertiserAccount class specifies the account to be used by the SDK on all requests to affilinet.

    Attribute Type Description Mandatory
    accountIDs List The advertiser’s account ids YES
    Method Returns Description
    AdvertiserAccount(List accountIds) AdvertiserAccount Class Constructor
    Country

    The Country specifies a country (with a platform) that can be later used to open a session with affilinet.

    Method Returns Description
    Country(Platform platform) Country The contructor method of the class
    getCountryCode string Gets the country code as a string value
    getDomain string Gets the country affilinet domain
    Platform

    The Platform is an enumeration that makes it easier to specify a Country Code.

    DE
    AT
    CH
    GB
    FR
    ES
    NL
    BE
    LU
    Request

    All requests to affilinet (javascript) are specified by Request objects. The Request class is an abstract class and cannot be instantiated directly.

    Attribute Type Description
    session Session The session
    protocol Protocol The request web protocol
    Method Returns Description
    Request(Session) Request Creates a new instance of a request
    Protocol

    The Protocol is an enumeration that makes it easier to specify a protocol.

    HTTP
    HTTPS
    ACTSaleTracking

    An ACTSaleTracking represents an order tracking request to the affilinet backend.

    Attribute Type Description Mandatory
    order RTOrder order YES (orderId, total > 0)
    orderRate OTOrderRate order rate YES
    currencyCode string currency code NO
    programSubids List program subids, max of 4 NO
    voucherCode string voucher code NO
    adNumber integer ad number mandatory only if server-sided attribution is used
    adType AdType ad type mandatory only if server-sided attribution is used
    uid string uid mandatory only if server-sided attribution is used
    publisherId integer publisher id mandatory only if server-sided attribution is used
    clickTime string click time mandatory only if server-sided attribution is used
    publisherSubId string publisher subId mandatory only if server-sided attribution is used
    ACTLeadTracking

    An ACTLeadTracking represents an order tracking request to the affilinet backend.

    Attribute Type Description Mandatory
    order RTOrder order YES (orderId)
    orderRate OTOrderRate order rate YES
    currencyCode string currency code NO
    lmulti integer lmulti NO
    programSubids List program subids, max of 4 NO
    voucherCode string voucher code NO
    adNumber integer ad number mandatory only if server-sided attribution is used
    adType AdType ad type mandatory only if server-sided attribution is used
    uid string uid mandatory only if server-sided attribution is used
    publisherId integer publisher id mandatory only if server-sided attribution is used
    clickTime string click time mandatory only if server-sided attribution is used
    publisherSubId string publisher subId mandatory only if server-sided attribution is used
    ACTBasketTracking

    An ACTBasketTracking represents a basket tracking request to the affilinet backend.

    Attribute Type Description Mandatory
    order RTOrder order YES (orderId). orderRate is mandatory only if server-sided attribution is used
    orderRate OTOrderRate order rate Is mandatory, only if rate mapping is not used
    currencyCode string currency code NO
    basketItems List basket items for any item present mandatory fields are(articleNumber, productName, category, quantity > 0, singlePrice > 0)
    programSubids List program subids, max of 4 NO
    voucherCode string voucher code NO
    adNumber integer ad number mandatory only if server-sided attribution is used
    adType AdType ad type mandatory only if server-sided attribution is used
    uid string uid mandatory only if server-sided attribution is used
    publisherId integer publisher id mandatory only if server-sided attribution is used
    clickTime string click time mandatory only if server-sided attribution is used
    publisherSubId string publisher subId mandatory only if server-sided attribution is used
    OTBasketItem

    An OTBasketItem represents one item in the basket order tracking.

    Attribute Type Description Mandatory
    articleNumber string The article number YES
    productName string The product name NO
    category string The product category NO
    quantity integer The item quantity YES
    singlePrice double The item unit price YES
    brand string The product brand NO
    properties List An array of additional properties NO
    orderRate OTOrderRate The order rate NO
    AdType

    Ad type enumeration that represents a graphic banner, an html creative or a text link.

    GraphicBanner
    TextLink
    HtmlCreative
    OTOrderRate

    An OTOrderRate represents an order rate.

    Attribute Type Description Mandatory
    rateNumber integer The rate number YES
    rateMode OTRateMode The rate mode YES
    OTRateMode

    Enumeration that represents a pay per lead or pay per sale rating mode

    LEAD
    SALE
    RTProduct

    Represents a product that can be used for Profiling requests.

    Attribute Type Description Mandatory
    productId string The product id YES
    name string The product name NO
    price double The product price YES
    oldPrice double Original product price if the price has been reduced NO
    brand string The product's brand NO
    rating integer Product rating. 0 (not rated) to 10 (highest rating) NO
    inStock boolean Flag showing whether a product is in stock or not NO
    onSale boolean Flag showing whether a product is reduced or not NO
    accessory boolean Flag indicating a main product or an accessory NO
    clickUrl string Product page URL including tracking parameters (URL Encoded) NO
    imageUrl string Product image URL (URL Encoded) NO
    category RTProductCategory Product Category NO
    RTTravelProduct

    Represents a travel product that can be used for Profiling requests. Extends RTProduct.

    Attribute Type Description Mandatory
    productId string The product id YES
    name string The product name YES
    price double The product price YES
    oldPrice double Original product price if the price has been reduced NO
    brand string The product's brand NO
    rating integer Product rating. 0 (not rated) to 10 (highest rating) NO
    inStock boolean Flag showing whether a product is in stock or not NO
    onSale boolean Flag showing whether a product is reduced or not NO
    accessory boolean Flag indicating a main product or an accessory NO
    clickUrl string Product page URL including tracking parameters (URL Encoded) NO
    imageUrl string Product image URL (URL Encoded) NO
    category RTProductCategory Product Category not mandatory, but strongly recommended
    departureDate date The departure (start) date of the travel NO
    endDate date The end date of the travel NO
    productType string Trip type (flight-only, package holiday etc.) NO
    kids boolean Flag showing whether children are travelling as well NO
    numberOfAdults integer Number of adults travelling NO
    hotelCategory string Hotel category (middle, luxury, etc.) NO
    pointOfDeparture string Point of departure NO
    pointOfDestination string Point of destination NO
    RTDatingProduct

    Represents a dating product that can be used for Profiling requests. Extends RTProduct.

    Attribute Type Description Mandatory
    productId string The product id YES
    name string The product name YES
    price double The product price YES
    oldPrice double Original product price if the price has been reduced NO
    brand string The product's brand NO
    rating integer Product rating. 0 (not rated) to 10 (highest rating) NO
    inStock boolean Flag showing whether a product is in stock or not NO
    onSale boolean Flag showing whether a product is reduced or not NO
    accessory boolean Flag indicating a main product or an accessory NO
    clickUrl string Product page URL including tracking parameters (URL Encoded) NO
    imageUrl string Product image URL (URL Encoded) NO
    category RTProductCategory Product Category not mandatory, but strongly recommended
    customer RTDatingCustomer Dating Customer NO
    RTDatingCustomer

    Represents a dating customer.

    Attribute Type Description Mandatory
    gender string The customer's gender NO
    ageRange string The customer's age range NO
    zipCode string The customer's zip/postal code NO
    wasLoggedIn boolean Flag showing whether the customer was logged in NO
    RTProductCategory

    Represents a product Category

    Attribute Type Description Mandatory
    categoryID string category ID the page belongs to YES
    categoryName string category name the page belongs to YES
    clickURL string Category page URL including tracking parameters (URL Encoded) NO
    imageURL string Category image URL (URL Encoded) NO
    pathItems List Category path components NO
    Method Returns Description
    getName() string The category path separated by pipes
    RTOrderItem
    Attribute Type Description Mandatory
    product RTProduct The order's product YES
    quantity integer The order's product quantity YES
    RTOrder
    Attribute Type Description Mandatory
    orderId string The order id YES
    total double The order total amount including tax YES
    items RTOrderItem The order items YES
    orderDescription string description that overwrites the rate name shown to publishers NO
    orderDate date date of the order mandatory only if server-sided attribution is used
    ACTProductViewProfiling

    ACTProductViewProfiling is used for a Product View Profiling request.

    Attribute Type Description Mandatory
    product RTProduct (RTTravelProduct, RTDatingProduct) The product (normal, travel or dating) YES (name, productid, category, price > 0)
    currencyCode string currency code YES
    refererUrl string Referer url
    Method Returns Description
    ACTProductViewProfiling(Session, RTProduct, CurrencyCode ACTProductViewProfiling Constructor method
    setRefererUrl(string) void setter method
    ACTAddToCartProfiling

    An AddToCartProfiling is used for a Add To Cart View Profiling request.

    Attribute Type Description Mandatory
    orderItem RTOrderItem Order item YES (name, productId, category, price > 0, quantity > 0)
    currencyCode string currency code YES
    refererUrl string Referer url NO
    Method Returns Description
    ACTAddToCartProfiling(Session, RTOrderItem, CurrencyCode) ACTAddToCartProfiling Constructor method
    setRefererUrl(string) void setter method
    ACTRemoveFromCartProfiling

    An ACTRemoveFromCartProfiling is used for a Remove From Cart View Profiling request.

    Attribute Type Description Mandatory
    orderItem RTOrderItem Order item YES (name, productId, category, price > 0, quantity > 0)
    currencyCode string currency code YES
    refererUrl string Referer url
    Method Returns Description
    ACTRemoveFromCartProfiling(Session, RTOrderItem, CurrencyCode) ACTRemoveFromCartProfiling Constructor method
    setRefererUrl(string) void setter method
    ACTCartViewProfiling

    An ACTCartViewProfiling is used for a Cart View Profiling request.

    Attribute Type Description Mandatory
    orderItems List<RTOrderItem> Order items YES (product.name, product.productId, product.category, product.price > 0, order.quantity > 0)
    currencyCode string currency code YES
    totalPrice double total price NO
    tax double tax NO
    voucherCode string voucher code NO
    voucherCodeDiscount double voucher code discount NO
    refererUrl string Referer url NO
    Method Returns Description
    ACTCartViewProfiling(Session, List, CurrencyCode) ACTCartViewProfiling Constructor method
    setVoucherCode(string) void setter
    setVoucherCodeDiscount(Double) void setter
    setTax(Double) void setter
    setRefererUrl(string) void setter
    setTotalPrice(Double) void setter
    ACTCheckoutProfiling

    An ACTCheckoutProfiling is used for a Checkout View Profiling request.

    Attribute Type Description Mandatory
    order RTOrder An order YES (orderId, order.total > 0, product.price > 0, product.quantity > 0, product.id)
    currencyCode string currency code YES
    customerAge integer customer age NO
    customerAgeRange string customer age range NO
    customerCountry string cusomer country NO
    customerGender string customer gender NO
    customerStatus string customer status NO
    customerZip string customer zip code NO
    paymentType string payment type NO
    shippingGrossPrice string shipping gross price NO
    shippingTax double shipping tax NO
    shippingType string shipping type NO
    voucherCode string voucher code NO
    voucherCodeDiscount double voucher code discount NO
    tax double tax NO
    refererUrl string Referer url NO
    Method Returns Description
    ACTCheckoutProfiling(Session, RTOrder, CurrencyCode) ACTCheckoutProfiling Constructor method
    setCustomerAge(Integer) void setter
    setCustomerAgeRange(string) void setter
    setCustomerCountry(string) void setter
    setCustomerGender(Gender) void setter
    setCustomerStatus(string) void setter
    setCustomerZip(string) void setter
    setPaymentType(string) void setter
    setShippingGrossPrice(string) void setter
    setShippingTax(Double) void setter
    setShippingType(string) void setter
    setVoucherCode(string) void setter
    setVoucherCodeDiscount(Double) void setter
    setTax(Double) void setter
    setrRefererUrl(string) void setter
    ACTCategoryViewProfiling

    An ACTCategoryViewProfiling is used for a Category View Profiling request.

    Attribute Type Description Mandatory
    category RTProductCategory A product category YES (categoryId, categoryName)
    refererUrl string Referer url NO
    Method Returns Description
    ACTCategoryViewProfiling(Session, RTProductCategory) ACTCategoryViewProfiling Constructor method
    setRefererUrl(string) void setter method
    ACTPageViewProfiling

    An ACTPageViewProfiling is used for a Page View Profiling request.

    Attribute Type Description Mandatory
    pageUrl string Page Url NO
    pageType string Page Type NO
    pageName string Page Name YES
    pageCategory string Page Category NO
    refererUrl string Referer url NO
    Method Returns Description
    ACTPageViewProfiling(Session) ACTPageViewProfiling Constructor method
    setPageUrl(string) void setter method
    setPageType(string) void setter method
    setPageName(string) void setter method
    setPageCategory(string) void setter method
    setRefererUrl(string) void setter method
    ACTSearchViewProfiling
    Attribute Type Description Mandatory
    keywords List Search terms YES (at least one non null item within list)
    products List<RTProduct> The search result products YES (at least one non null item within list)
    refererUrl string Referer url
    Method Returns Description
    ACTSearchViewProfiling(Session) ACTSearchViewProfiling Constructor method
    setKeywords(List) void setter method
    setProducts(List<RTProduct>) void setter method
    setRefererUrl(string) void setter method

    Use Cases Order Tracking

    Basket Order Tracking

    To perform basket order tracking, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    ACTBasketOrderTracking can now be created (with OTBasketItem items) and passed to the Session to be executed through the executeRequests method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.tracking.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and CountryCode
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create basket items
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    OTBasketItem basketItem = new OTBasketItem();
    // mandatory parameters
    basketItem.articleNumber = "ANNNS";
    basketItem.singlePrice = 20.45;
    basketItem.quantity = 1;
    // optional parameters
    basketItem.productName = "amazing product";
    basketItem.category = "jeans";
    basketItem.brand = "Versace";
    basketItem.orderRate = new OTOrderRate(1, OTRateMode.SALE);
    List<String> properties = new ArrayList<>();
    properties.add("Size%3A%20XXL");
    properties.add("Color%3A%20green");
    basketItem.properties = properties;
    
    OTBasketItem basketItem2 = new OTBasketItem();
    // mandatory parameters
    basketItem2.articleNumber = "ANNNS2";
    basketItem2.singlePrice = 40.45;
    basketItem2.quantity = 1;
    // optional parameters
    basketItem2.productName = "amazing product 2";
    basketItem2.category = "jeans 2";
    basketItem2.brand = "Versace 2";
    basketItem2.orderRate = new OTOrderRate(1, OTRateMode.SALE);
    List<String> properties2 = new ArrayList<>();
    properties2.add("Size%3A%20XXL");
    properties2.add("Color%3A%20green");
    basketItem.properties = properties2;
    
    OTBasketItem basketItem3 = new OTBasketItem();
    // mandatory parameters
    basketItem3.articleNumber = "ANNNS3";
    basketItem3.singlePrice = 40.45;
    basketItem3.quantity = 3;
    // optional parameters
    basketItem3.productName = "amazing product 3";
    basketItem3.category = "jeans 3";
    basketItem3.brand = "Versace 3";
    basketItem3.orderRate = new OTOrderRate(6, OTRateMode.SALE);
    
    List<OTBasketItem> basketItems = new ArrayList<>();
    basketItems.add(basketItem);
    basketItems.add(basketItem2);
    basketItems.add(basketItem3);
    
    Create order
    1
    2
    3
    4
    5
    6
    7
    RTOrder order = new RTOrder();
    // mandatory parameters
    order.orderId = UUID.randomUUID().toString();
    // optional parameter, only if basketItems are not transferred
    order.total = 182.25;
    // parameters for server sided tracking only
    order.orderDate = new Date();
    
    Create at least one Basket Order Tracking object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    ACTBasketTracking actBasketTracking = new ACTBasketTracking(Session.getInstance(), order);
    
    // mandatory parameters
    actBasketTracking.setOrderRate(new OTOrderRate(1, OTRateMode.SALE));
    actBasketTracking.setBasketItems(basketItems);
    
    // optional parameters
    actBasketTracking.addProgramSubId("custom-program-subid1");
    actBasketTracking.addProgramSubId("custom-program-subid2");
    actBasketTracking.setCurrency("EUR");
    actBasketTracking.setVoucherCode("voucher-code");
    
    // parameters for server sided tracking only
    actBasketTracking.setPublisherId(784108);
    actBasketTracking.setPublisherSubId("custom-publisher-subid");
    actBasketTracking.setAdType(AdType.GraphicBanner);
    actBasketTracking.setAdNumber(1);
    actBasketTracking.setClickTime(new Date());
    actBasketTracking.setUid(UUID.randomUUID().toString());
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actBasketTracking);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Sale Order Tracking

    To perform sale tracking, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    ACTSaleTracking can now be created and passed to the Session to be executed through the executeRequests method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.tracking.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and CountryCode
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create the sale tracking
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    RTOrder order = new RTOrder();
    // mandatory parameters
    order.orderId = UUID.randomUUID().toString();
    order.total = 324.45;
    // parameters for server sided tracking only
    order.orderDate = new Date();
    
    ACTSaleTracking actSaleTracking = new ACTSaleTracking(Session.getInstance(), order);
    
    // mandatory parameters
    actSaleTracking.setOrderRate(new OTOrderRate(1, OTRateMode.SALE));
    
    // optional parameters
    actSaleTracking.addProgramSubId("custom-program-subid1");
    actSaleTracking.addProgramSubId("custom-program-subid2");
    actSaleTracking.setCurrency("EUR");
    actSaleTracking.setVoucherCode("voucher-code");
    
    // parameters for server sided tracking only
    actSaleTracking.setPublisherId(784108);
    actSaleTracking.setAdType(AdType.GraphicBanner)
    actSaleTracking.setAdNumber(1);
    actSaleTracking.setPublisherSubId("custom-publisher-subid");
    actSaleTracking.setClickTime(new Date());
    actSaleTracking.setUid(UUID.randomUUID().toString());
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
       requests.add(actSaleTracking);
    
       session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
    
       @Override
       public void onRequestsError(Error error) {
       }
    
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
       });
    

    Lead Order Tracking

    To perform lead tracking, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    ACTLeadTracking can now be created and passed to the Session to be executed through the executeRequests method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.tracking.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and CountryCode
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create the lead tracking
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    RTOrder order = new RTOrder();
    // mandatory parameter
    order.orderId = UUID.randomUUID().toString();
    // optional parameter
    order.total = 24.45;
    // parameters for server sided tracking only
    order.orderDate = new Date();
    
    ACTLeadTracking actLeadTracking = new ACTLeadTracking(Session.getInstance(), order);
    
    // mandatory parameters
    actLeadTracking.setOrderRate(new OTOrderRate(1, OTRateMode.LEAD));
    
    // optional parameters
    actLeadTracking.addProgramSubId("custom-program-subid1");
    actLeadTracking.addProgramSubId("custom-program-subid2");
    actLeadTracking.setCurrency("EUR");
    actLeadTracking.setVoucherCode("voucher-code");
    actLeadTracking.setLmulti(1);
    
    // parameters for server sided tracking only
    actLeadTracking.setPublisherId(784108);
    actLeadTracking.setAdType(AdType.GraphicBanner);
    actLeadTracking.setAdNumber(1);
    actLeadTracking.setPublisherSubId("custom-publisher-subid");
    actLeadTracking.setClickTime(new Date());
    actLeadTracking.setUid(UUID.randomUUID().toString());
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
       requests.add(actLeadTracking);
    
       session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
    
       @Override
       public void onRequestsError(Error error) {
       }
    
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
       });
    

    App Download Tracking

    To perform app download tracking, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    ACTLeadTracking can be now be created and passed to the Session to be executed through the executeRequests method.

    SessionCallback can be used to track the request success and store it to the shared preferences

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.tracking.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and CountryCode
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create the app download tracking
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    ACTLeadTracking actLeadTracking = new ACTLeadTracking(Session.getInstance(), order);
    
    // mandatory parameter
    actLeadTracking.setOrderRate(new OTOrderRate(1, OTRateMode.LEAD));
    
    // optional parameters
    actLeadTracking.addProgramSubId("custom-program-subid1");
    actLeadTracking.addProgramSubId("custom-program-subid2");
    actLeadTracking.setVoucherCode("voucher-code");
    actLeadTracking.setCurrency(CurrencyCode.EUR);
    
    // parameters for server sided tracking only
    actLeadTracking.setPublisherId(784108);
    actLeadTracking.setAdType(AdType.GraphicBanner);
    actLeadTracking.setAdNumber(1);
    actLeadTracking.setUid(UUID.randomUUID().toString());
    actLeadTracking.setClickTime(new Date());
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    List<Request> requests = new ArrayList<Request>();
       requests.add(actLeadTracking);
    
       session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
    
       @Override
       public void onRequestsError(Error error) {
       }
    
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
          if (response.error != null) {
             saveToPrefs(MainActivity.this, "PREF_DOWNLOAD_TRACKING", "true");
          }
       });
    
    Override Activity's onCreate method and add the logic
    1
    2
    3
    4
    5
    6
    7
    8
          @Override
          protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
    
             if (getFromPrefs(this, "PREF_DOWNLOAD_TRACKING", null) == null) {
                //CALL THE LEAD TRACKING REQUEST HERE
             }
          }
    
    Shared preferences helper
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    public static void saveToPrefs(Context context, String key, String value) {
       SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
       final SharedPreferences.Editor editor = prefs.edit();
       editor.putString(key,value);
       editor.commit();
    }
    
    public static String getFromPrefs(Context context, String key, String defaultValue) {
       SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
       try {
          return sharedPrefs.getString(key, defaultValue);
       } catch (Exception e) {
          e.printStackTrace();
          return defaultValue;
       }
    }
    

    Use Cases Profiling

    Product View Profiling

    To perform Product View profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    ProductViewProfiling can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.profiling.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and Platform
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create at least one Product Profiling object
    Simple Product View Profiling
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    RTProduct product = new RTProduct();
    product.productId = UUID.randomUUID().toString();
    product.name = "Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.category = new RTProductCategory();
    product.category.pathItems = new ArrayList<String>();
    product.category.pathItems.add("Clothes");
    product.category.pathItems.add("Shoes");
    product.category.pathItems.add("Flip Flops");
    product.category.clickURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    product.category.imageURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    product.brand = "Amazing Brand";
    product.inStock = true;
    product.rating = 7;
    product.onSale = true;
    product.accessory = false;
    product.clickURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    
    ACTProductViewProfiling actProductViewProfiling = new ACTProductViewProfiling(Session.getInstance(),
    product, "EUR");
    actProductViewProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com");
    
    Travel Product View Profiling
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    RTTravelProduct travelProduct = new RTTravelProduct();
    travelProduct.productId = UUID.randomUUID().toString();
    travelProduct.name = "Amazing Travel Product";
    travelProduct.departureDate = new Date(113, 11, 5, 11, 25);
    travelProduct.endDate = new Date(113, 11, 5, 14, 25);
    travelProduct.productType = "with hotel";
    travelProduct.kids = "false";
    travelProduct.adults = "2";
    travelProduct.hotelCategory = "middle";
    travelProduct.pointOfDeparture = "Lisbon";
    travelProduct.pointOfDestination = "Frankfurt";
    
    ACTProductViewProfiling actProductViewProfiling = new ACTProductViewProfiling(Session.getInstance(),
    product, "EUR");
    actProductViewProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com");
    
    Dating Product View Profiling
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    RTDatingProduct datingProduct = new RTDatingProduct();
    datingProduct.productId = UUID.randomUUID().toString();
    datingProduct.category = new RTProductCategory();
    datingProduct.customer = new RTDatingCustomer();
    datingProduct.customer.gender = Gender.Male;
    datingProduct.customer.ageRange = "18-25";
    datingProduct.customer.zipCode = "60329";
    
    ACTProductViewProfiling actProductViewProfiling = new ACTProductViewProfiling(Session.getInstance(),
    product, "EUR");
    actProductViewProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actProductViewProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Category View Profiling

    To perform Category View profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a platform, should then be used to open a session in the Session singleton.

    CategoryViewProfiling can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.profiling.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and Platform
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create one Product Category object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    RTProductCategory productCategory = new RTProductCategory();
    productCategory.categoryId = "c1";
    productCategory.categoryName = "category name";
    productCategory.clickURL = "http://category-clickurl.com";
    productCategory.imageURL = "http://category-imageurl.com";
    productCategory.pathItems = new ArrayList<>();
    productCategory.pathItems.add("Clothes");
    productCategory.pathItems.add("Shirts");
    productCategory.pathItems.add("T-Shirt");
    
    Create one Category View Profiling Request
    1
    2
    3
    4
    ACTCategoryViewProfiling actCategoryViewProfiling = 
    new ACTCategoryViewProfiling(Session.getInstance(),
    productCategory);
    actCategoryViewProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com%2Fcategoryview.html");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actCategoryViewProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Add To Cart Profiling

    To perform Add To Cart profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    AddToCartProfiling can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.profiling.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and CountryCode
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create at least one Order Item object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    RTProduct product = new RTProduct();
    product.productId = UUID.randomUUID().toString();
    product.name = "Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.category = new RTProductCategory();
    product.category.pathItems = new ArrayList<String>();
    product.category.pathItems.add("Clothes");
    product.category.pathItems.add("Shoes");
    product.category.pathItems.add("Flip Flops");
    product.category.clickURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    product.category.imageURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    product.brand = "Amazing Brand";
    product.rating = 7;
    product.clickURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    
    RTOrderItem item = new RTOrderItem();
    item.quantity = 1;
    item.product = product;
    
    Create one Add To Cart Profiling request
    1
    2
    3
    ACTAddToCartProfiling actAddToCartProfiling = new ACTAddToCartProfiling(Session.getInstance(),
    item, "EUR");
    actAddToCartProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actAddToCartProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Remove From Cart Profiling

    To perform Remove From Cart profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    RemoveFromCartProfiling can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.profiling.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and Platform
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create at least one Order Item object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    RTProduct product = new RTProduct();
    product.productId = UUID.randomUUID().toString();
    product.name = "Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.category = new RTProductCategory();
    product.category.pathItems = new ArrayList<String>();
    product.category.pathItems.add("Clothes");
    product.category.pathItems.add("Shoes");
    product.category.pathItems.add("Flip Flops");
    product.category.clickURL = "http://category-click-url.com";
    product.category.imageURL = "http://category-image-url.com";
    product.brand = "Amazing Brand";
    product.rating = 7;
    product.clickURL = "http://product-click-url.com";
    product.imageURL = "http://product-image-url.com";
    
    RTOrderItem item = new RTOrderItem();
    item.quantity = 1;
    item.product = product;
    
    Create one Remove From Cart Profiling request
    1
    2
    3
    ACTRemoveFromCartProfiling actRemoveFromCartProfiling = 
    new ACTRemoveFromCartProfiling(Session.getInstance(),
    item, "EUR");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actRemoveFromCartProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Cart View Profiling

    To perform Cart View profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    CartViewProfiling can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.profiling.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and Platform
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create at least one Order Item object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    RTProduct product1 = new RTProduct();
    product1.productId = UUID.randomUUID().toString();
    product1.name = "Amazing Product 1";
    product1.price = 40.45;
    product1.oldPrice = 42.99;
    product1.category = new RTProductCategory();
    product1.category.pathItems = new ArrayList<String>();
    product1.category.pathItems.add("Clothes");
    product1.category.pathItems.add("Shoes");
    product1.category.pathItems.add("Flip Flops");
    product1.category.clickURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    product1.category.imageURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    product1.brand = "Amazing Brand";
    product1.inStock = true;
    product1.rating = 7;
    product1.onSale = true;
    product1.accessory = false;
    product1.clickURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product1.imageURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    
    RTOrderItem item1 = new RTOrderItem();
    item1.quantity = 1;
    item1.product = product;
    
    RTProduct product = new RTProduct();
    product2.productId = UUID.randomUUID().toString();
    product2.name = "Amazing Product 2";
    product2.price = 40.45;
    product2.oldPrice = 42.99;
    product2.category = new RTProductCategory();
    product2.category.pathItems = new ArrayList<String>();
    product2.category.pathItems.add("Clothes");
    product2.category.pathItems.add("Shoes");
    product2.category.pathItems.add("Flip Flops");
    product2.category.clickURL = "http%3A%2F%2Fadvertiser.com%2Fcategory2%2Fclick.html";
    product2.category.imageURL = "http%3A%2F%2Fadvertiser.com%2Fcategory2%2Fimage.png";
    product2.brand = "Amazing Brand";
    product2.inStock = true;
    product2.rating = 7;
    product2.onSale = true;
    product2.accessory = false;
    product2.clickURL = "http%3A%2F%2Fadvertiser.com%2Fproduct2%2Fclick.html";
    product2.imageURL = "http%3A%2F%2Fadvertiser.com%2Fproduct2%2Fimage.png";
    
    RTOrderItem item2 = new RTOrderItem();
    item2.quantity = 1;
    item2.product = product;
    
    List<RTOrderItem> items = new ArrayList<>();
    items.add(item1, item2);
    
    Create one Cart View Profiling request
    1
    2
    3
    4
    5
    6
    7
    ACTCartViewProfiling actCartViewProfiling = new ACTCartViewProfiling(Session.getInstance(),
    items, "EUR");
    actCartViewProfiling.setTax(20.0);
    actCartViewProfiling.setTotalPrice(100.0);
    actCartViewProfiling.setVoucherCode("3iidd-12d3");
    actCartViewProfiling.setVoucherCodeDiscount(5.0);
    actCartViewProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actCartViewProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Checkout Profiling

    To perform Checkout profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    Checkout profiling can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.tracking.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and CountryCode
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create an Order object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    RTOrder order = new RTOrder();
    order.orderId = UUID.randomUUID().toString();
    order.total = 324.4523;
    
    order.items = new ArrayList<>();
    
    RTProduct product = new RTProduct();
    product.productId = UUID.randomUUID().toString();
    product.name = "Amazing Product";
    product.price = 40.45;
    product.oldPrice = 42.99;
    product.category = new RTProductCategory();
    product.category.pathItems = new ArrayList<String>();
    product.category.pathItems.add("Clothes");
    product.category.pathItems.add("Shoes");
    product.category.pathItems.add("Flip Flops");
    product.category.clickURL = "http://category-click-url.com";
    product.category.imageURL = "http://category-image-url.com";
    product.brand = "Amazing Brand";
    product.inStock = true;
    product.rating = 7;
    product.onSale = true;
    product.accessory = false;
    product.clickURL = "http://product-click-url.com";
    product.imageURL = "http://product-image-url.com";
    RTOrderItem item1 = new RTOrderItem();
    item1.quantity = 2;
    item1.product = product;
    
    RTTravelProduct travelProduct = new RTTravelProduct();
    travelProduct.productId = UUID.randomUUID().toString();
    travelProduct.name = "Amazing Travel Product";
    travelProduct.departureDate = new Date(113, 11, 5, 11, 25);
    travelProduct.endDate = new Date(113, 11, 5, 14, 25);
    travelProduct.productType = "with hotel";
    travelProduct.kids = "0";
    travelProduct.adults = "2";
    travelProduct.hotelCategory = "middle";
    travelProduct.pointOfDeparture = "Lisbon";
    travelProduct.pointOfDestination = "Frankfurt";
    RTOrderItem item2 = new RTOrderItem();
    item2.quantity = 1;
    item2.product = travelProduct;
    
    RTDatingProduct datingProduct = new RTDatingProduct();
    datingProduct.productId = UUID.randomUUID().toString();
    datingProduct.name = "Amazing Dating Product";
    datingProduct.customer = new RTDatingCustomer();
    datingProduct.customer.gender = Gender.Male;
    datingProduct.customer.ageRange = "18-25";
    datingProduct.customer.zipCode = "60329";
    datingProduct.customer.wasLoggedIn = false;
    RTOrderItem item3 = new RTOrderItem();
    item3.quantity = 1;
    item3.product = datingProduct;
    
    order.items.add(item1);
    order.items.add(item2);
    order.items.add(item3);
    
    Create one Checkout Profiling request
    1
    2
    3
    4
    5
    ACTCheckoutProfiling actCheckoutProfiling = new ACTCheckoutProfiling(Session.getInstance(),
    order, "EUR");
    actCheckoutProfiling.setRefererUrl("referer_url");
    actCheckoutProfiling.setCustomerGender(Gender.Male);
    actCheckoutProfiling.setCustomerStatus("existing_customer");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actCheckoutProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });
    

    Page View Profiling

    To perform Page View profiling, one must first create an instance of an AdvertiserAccount with the appropriate advertiser account id. This account, in combination with a country code, should then be used to open a session in the Session singleton.

    PageView can now be created and passed to the Session to be executed through the executeRequests: method.

    Import namespaces
    1
    2
    3
    4
    5
    import com.rm.affilinet.*;
    import com.rm.affilinet.advertiser.*;
    import com.rm.affilinet.communication.*;
    import com.rm.affilinet.models.*;
    import com.rm.affilinet.act.profiling.*;
    
    Create Advertiser Account
    1
    2
    3
    List<Integer> ids = new ArrayList<>();
    ids.add(Integer.valueOf({PROGRAM-ID}));
    Account account = new AdvertiserAccount(ids);
    
    Open Session with Account and Platform
    1
    2
    Session session = Session.getInstance();
    session.open(getApplicationContext(), account, Platform.DE);
    
    Create at least one Page View object
    1
    2
    3
    4
    5
    6
    ACTPageViewProfiling actPageViewProfiling = new ACTPageViewProfiling(Session.getInstance());
    actPageViewProfiling.setPageUrl("pageUrl");
    actPageViewProfiling.setPageType("pageType");
    actPageViewProfiling.setPageName("pageName");
    actPageViewProfiling.setPageCategory("pageCategory");
    actPageViewProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com%2Fpageview.html");
    
    Execute request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    List<Request> requests = new ArrayList<Request>();
    requests.add(actPageViewProfiling);
    
    session.executeRequests(requests, new SessionCallback() {
    
       @Override
       public void onRequestsFinished() {
       }
       
       @Override
       public void onRequestsError(Error error) {
       }
       
       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
       }
    });