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 define your own program ID(s) as well as the aligned platform (country code).

    in iOS
    ANStartViewController.m
    1
    2
    3
    ANAdvertiserAccount *account = [[ANAdvertiserAccount alloc] init];
    account.accountIDs = @[@{PROGRAM-ID}];
    [[ANSession sharedInstance] openWithAccount:account andCountryCode:ANCountryCodeDE];
    
    in Android
    MainActivity.java
    1
    2
    3
    4
    5
    6
    7
    8
    9
    List<Integer> ids = new ArrayList<>();
    ids.add({PROGRAM-ID});
    Account account = new AdvertiserAccount(ids);
    Session session = Session.getInstance();
    try {
        session.open(getApplicationContext(), account, Platform.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 Mandatory
    account ANAdvertiserAccount The session’s account YES
    platform ANPlatform The session’s platform YES
    (^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 program ID(s) to be used by the SDK on all requests to affilinet.

    Attribute Type Description Mandatory
    accountIDs NSArray* The advertiser’s program ID(s) 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 Mandatory
    session ANSession The session YES
    protocol ANRequestProtocol The request web protocol YES
    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 Mandatory
    adType ANAdType The ad type YES
    adNumber NSInteger The ad number YES
    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
    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
    orderRate ANOTOrderRate order rate mandatory, only if rate mapping is not used
    orderDate NSDate date and time of attributed basket creation mandatory only if server-sided attribution is used
    orderDescription NSString, URL-encoded Description of the order to be attributed NO
    voucherCode NSString voucher code that was used with the order NO
    currency ANCurrency Use this parameter, if different from affilinet platform standard 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
    ANOTBasketItem

    An ANOTBasketItem represents one item in the basket order tracking.

    Attribute Type Description Mandatory
    productId NSString The article number of the product 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
    ANSaleTracking

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

    Attribute Type Description Mandatory
    order ANRTOrder The order YES (orderId, total > 0)
    orderRate ANOTOrderRate order rate YES
    voucherCode NSString voucher code that was used with the order NO
    currency ANCurrency Use this parameter, if different from affilinet platform standard 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
    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 YES
    currency ANCurrency Use this parameter, if different from affilinet platform standard currency NO
    programSubID NSArray program subids, max of 4 NO
    voucherCode NSString voucher code that was used with the order NO
    lmulti NSInteger The lead commission will be multiplied by the quantity transmitted in this parameter 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
    publisherId NSInteger publisher id mandatory only if server-sided attribution is used
    publisherSubID NSString publisher subId mandatory only if server-sided attribution is used
    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. Use this parameter, if different from the affilinet platform standard currency

    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 'kCurrencyCode', 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 YES
    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 not mandatory, but strongly recommended
    ANRTTravelProduct

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

    Attribute Type Description Mandatory
    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
    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
    age NSInteger The customer's age NO
    zipCode NSString The customer's zip/postal code NO
    country NSString The country of the customer’s home address NO
    status NSString The customer's status NO
    wasLoggedIn BOOL Indicates if user 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 Mandatory
    orderId NSString The order id YES
    items NSArray<ANRTOrderItem> The order items NO, only relevant for Profiling
    total double The order total amount including tax YES, for sale tracking
    orderDescription NSString Description of the order to be attributed NO
    orderDate NSDate The order date mandatory only if server-sided attribution is used
    ANProductViewTagging

    An ANProductViewTagging is used for a Product View Tagging request

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

    An ANAddToCartTagging is used for an 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 of the order 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 of the order 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
    voucherCodeDiscount NSInteger voucher code 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 of the order 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 of the order YES
    datingCustomer ANRTDatingCustomer customer data 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
    publisherId NSInteger publisher id mandatory only if server-sided attribution is used
    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
    ANOTBasketItem *basketItem = [[ANOTBasketItem alloc] init];
    // mandatory parameters
    basketItem.productId = @"replace-with-your-productid";
    basketItem.quantity = 1;
    basketItem.singlePrice = 20.45;
    // optional parameters 
    basketItem.productName = @"Amazing%20Product";
    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.productId = @"replace-with-your-productid2";
    basketItem2.quantity = 3;
    basketItem2.singlePrice = 60.45;
    // optional parameters
    basketItem2.productName = @"Amazing%20Product%202";
    basketItem2.category = @"jeans%202";
    basketItem2.brand = @"Versace%202";
    basketItem2.properties = [[NSMutableArray alloc] initWithArray:@[@"example1", @"example2"]];
    basketItem2.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1
    andRateMode:OTOrderRateModeSale];
    
    Create 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
    ANBasketTracking *basketTracking = [[ANBasketTracking alloc] initWithSession:self.session];
    
    // mandatory parameters
    basketTracking.orderId = @"custom-order-id";
    basketTracking.basketItems = @[basketItem, basketItem2];
    
    // optional parameters
    basketTracking.voucherCode = @"TEST";
    basketTracking.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    basketTracking.programSubID = @[@"custom-program-subid1", @"custom-program-subid2"];
    basketTracking.orderDescription = @"custom-order-description";
    basketTracking.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1 
    andRateMode:OTOrderRateModeSale];
    
    // 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 one Sale Tracking object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    ANSaleTracking *saleTracking = [[ANSaleTracking alloc] initWithSession:session];
    
    // mandatory parameters 
    saleTracking.order = [[ANRTOrder alloc] init];
    saleTracking.order.orderId = @"custom-order-id";
    saleTracking.order.total = 400;
    saleTracking.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1
    andRateMode:OTOrderRateModeSale]; 
    
    // optional parameters
    saleTracking.programSubID = @[@"custom-program-subid1", @"custom-program-subid2"];
    saleTracking.voucherCode = @"TEST";
    saleTracking.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    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.order.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
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    ANLeadTracking *leadTracking = [[ANLeadTracking alloc] initWithSession:self.session];
    // mandatory parameters
    leadTracking.order = [[ANRTOrder alloc] init];
    leadTracking.order.orderId = @"custom-order-id";
    leadTracking.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1
    andRateMode:OTOrderRateModeLead]; 
    
    // optional parameters
    leadTracking.order.total = 400;
    leadTracking.programSubID = @[@"custom-program-subid1", @"custom-program-subid2"];
    leadTracking.voucherCode = @"TEST";
    leadTracking.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    leadTracking.order.orderDescription = @"custom-order-description";
    leadTracking.lmulti = 1;
    
    // parameters for server sided tracking only
    leadTracking.adType = [[ANOTOrderAdType alloc] initWithAdNumber:1 andAdType:kANAdTypeGraphicBanner];
    leadTracking.publisherID = {PUBLISHER-ID}; // replace with attributed publisher id
    leadTracking.publisherSubID = @"custom-publisher-subid";
    leadTracking.clickDate = [NSDate date];
    leadTracking.order.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:@[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.accountIDs = @[@{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
    3
    4
    5
    6
    7
    8
    9
    10
    11
    ANLeadTracking *leadTracking = [[ANLeadTracking alloc] initWithSession:self.session];
    // mandatory parameters
    leadTracking.order = [[ANRTOrder alloc] init];
    leadTracking.order.orderId = @"custom-app-download-id";
    leadTracking.orderRate = [[ANOTOrderRate alloc] initWithRateNumber:1
    andRateMode:OTOrderRateModeLead]; 
    
    // optional parameters
    leadTracking.programSubID = @[@"custom-program-subid1", @"custom-program-subid2"];
    leadTracking.order.orderDescription = @"app-download-description";
    leadTracking.lmulti = 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
    19
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip%20Flops"];
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    //mandatory parameters 
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing%20Product";
    product.price = 40.45;
    
    // optional parameters
    product.category = category;
    product.oldPrice = 42.99;
    product.brand = @"Amazing%20Brand";
    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
    15
    16
    17
    18
    19
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Lastminute", @"Beach", @"Portugal"];
    
    ANRTTravelProduct *travelProduct= [[ANRTTravelProduct alloc] init];
    // mandatory parameters
    travelProduct.productId = @"replace-with-your-productid";
    travelProduct.name = @"Amazing%20Travel%20Product";
    travelProduct.price = 50.45;
    
    // optional parameters
    travelProduct.departureDate = [NSDate dateWithTimeIntervalSinceNow:0];
    travelProduct.endDate = [NSDate dateWithTimeIntervalSinceNow:10];
    travelProduct.productType = @"with%20hotel";
    travelProduct.kids = NO;
    travelProduct.numberOfAdults = 2;
    travelProduct.hotelCategory = @"middle";
    travelProduct.pointOfDeparture = @"Lisbon";
    travelProduct.pointOfDestination = @"Frankfurt";
    travelProduct.category = category;
    
    Dating Product
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Dating", @"Germany", @"25-50"];
    
    ANRTDatingProduct *datingProduct = [[ANRTDatingProduct alloc] init];
    // mandatory parameters
    datingProduct.productId = @"replace-with-your-productid";
    datingProduct.name = @"Amazing%20Dating%20Product";
    datingProduct.price = 60.45;
    
    // optional parameters
    ANRTDatingCustomer *customer = [[ANRTDatingCustomer alloc] init];
    customer.gender = @"male";
    customer.ageRange = @"25-50";
    customer.zipCode = @"80637";
    datingProduct.customer = customer; 
    datingProduct.category = category;    
    
    Create a product view tagging request
    1
    2
    3
    4
    5
    6
    7
    8
    ANProductViewTagging *productTagging = [[ANProductViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    // mandatory parameters
    productTagging.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    productTagging.product = product;
    
    // optional parameters
    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
    6
    7
    8
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    // mandatory parameters 
    productCategory.categoryId = @"c1";
    productCategory.categoryName = @"category%20name";
    
    // optional parameters 
    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
    5
    6
    7
    ANCategoryViewTagging *categoryTagging = [[ANCategoryViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    // mandatory parameters 
    categoryTagging.category = productCategory;
    
    // optional parameters 
    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
    23
    24
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip%20Flops"];
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    // mandatory parameters 
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing%20Product";
    product.price = 40.45;
    
    // optional parameters 
    product.category = category;
    product.oldPrice = 42.99;
    product.brand = @"Amazing%20Brand";
    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];
    // mandatory parameters 
    item.product = product;
    item.quantity = 1;
    
    Create one Add to Cart Tagging request
    1
    2
    3
    4
    5
    ANAddToCartTagging  *addToCart = [[ANAddToCartTagging alloc] initWithSession:
    [ANSession sharedInstance]];
    // mandatory parameters 
    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
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip%20Flops"];
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    // mandatory parameters 
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing%20Product";
    product.price = 40.45;
    
    // optional parameters 
    product.category = category;
    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];
    // mandatory parameters 
    item.product = product;
    item.quantity = 1;
    
    Create one Remove From Cart Tagging request
    1
    2
    3
    4
    5
    ANRemoveFromCartTagging  *removeFromCart = [[ANRemoveFromCartTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    // mandatory parameters 
    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip%20Flops"];
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    // mandatory parameters 
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing%20Product";
    product.price = 40.45;
    // optional parameters 
    product.category = category;
    product.oldPrice = 42.99;
    product.brand = @"Amazing%20Brand";
    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];
    //mandatory parameters 
    item1.quantity = 2;
    item1.product = product;
    
    ANRTTravelProduct *travelProduct = [[ANRTTravelProduct alloc] init];
    // mandatory parameters
    travelProduct.productId = @"replace-with-your-productid";
    travelProduct.name = @"Amazing%20Travel%20Product";
    travelProduct.price = 50.45;
    // optional parameters
    travelProduct.departureDate = [NSDate dateWithTimeIntervalSinceNow:0];
    travelProduct.endDate = [NSDate dateWithTimeIntervalSinceNow:10];
    travelProduct.productType = @"with%20hotel";
    travelProduct.kids = NO;
    travelProduct.numberOfAdults = 2;
    travelProduct.hotelCategory = @"middle";
    travelProduct.pointOfDeparture = @"Lisbon";
    travelProduct.pointOfDestination = @"Frankfurt";
    travelProduct.category = category;
    
    ANRTOrderItem *item2 = [[ANRTOrderItem alloc] init];
    // mandatory parameters 
    item2.quantity = 1;
    item2.product = travelProduct;
    
    ANRTDatingProduct *datingProduct = [[ANRTDatingProduct alloc] init];
    // mandatory parameters
    datingProduct.productId = @"replace-with-your-productid";
    datingProduct.name = @"Amazing%20Dating%20Product";
    datingProduct.price = 60.45;
    ANRTDatingCustomer *customer = [[ANRTDatingCustomer alloc] init];
    // optional parameters
    customer.gender = @"male";
    customer.ageRange = @"25-50";
    customer.zipCode = @"80637";
    datingProduct.customer = customer; 
    
    ANRTOrderItem *item3 = [[ANRTOrderItem alloc] init];
    // mandatory parameters 
    item3.quantity = 1;
    item3.product = datingProduct;
    
    Create one Cart View Tagging request
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    ANCartViewTagging  *cartView = [[ANCartViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    // mandatory parameters 
    cartView.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    cartView.items = @[item1, item2, item3];
    
    // optional parameters
    cartView.total = 191.80;
    cartView.tax = 20;
    cartView.voucherCode = @"3iidd-12d3";
    cartView.voucherCodeDiscount = 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 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
    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
    60
    61
    62
    ANRTOrder *order = [[ANRTOrder alloc] init];
    order.orderId = @"replace-with-your-orderid";
    order.total = 191.80;
    
    ANRTProductCategory *category = [[ANRTProductCategory alloc] init];
    category.pathItems = @[@"Clothes", @"Shoes", @"Flip%20Flops"];
    
    ANRTProduct  *product = [[ANRTProduct alloc] init];
    // mandatory parameters 
    product.productId = @"replace-with-your-productid";
    product.name = @"Amazing%20Product";
    product.price = 40.45;
    // optional parameters 
    product.category = category;
    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];
    //mandatory parameters 
    item1.quantity = 2;
    item1.product = product;
    
    ANRTTravelProduct *travelProduct = [[ANRTTravelProduct alloc] init];
    // mandatory parameters 
    travelProduct.productId = @"replace-with-your-productid";
    travelProduct.name = @"Amazing%20Travel%20Product";
    travelProduct.price = 50.45;
    // optional parameters
    travelProduct.departureDate = [NSDate dateWithTimeIntervalSinceNow:0];
    travelProduct.endDate = [NSDate dateWithTimeIntervalSinceNow:10];
    travelProduct.productType = @"with%20hotel";
    travelProduct.kids = NO;
    travelProduct.numberOfAdults = 2;
    travelProduct.hotelCategory = @"middle";
    travelProduct.pointOfDeparture = @"Lisbon";
    travelProduct.pointOfDestination = @"Frankfurt";
    travelProduct.category = category;
    ANRTOrderItem *item2 = [[ANRTOrderItem alloc] init];
    // mandatory parameters 
    item2.quantity = 1;
    item2.product = travelProduct;
    
    ANRTDatingProduct *datingProduct = [[ANRTDatingProduct alloc] init];
    // mandatory parameters 
    datingProduct.productId = @"replace-with-your-productid";
    datingProduct.name = @"Amazing%20Dating%20Product";
    datingProduct.price = 60.45;
    
    ANRTDatingCustomer *customer = [[ANRTDatingCustomer alloc] init];
    // optional parameters 
    customer.gender = @"male";
    customer.ageRange = @"25-50";
    customer.age = 39;
    customer.country = @"Germany"
    customer.zipCode = @"80637";
    customer.status = @"new"
    datingProduct.customer = customer; 
    ANRTOrderItem *item3 = [[ANRTOrderItem alloc] init];
    //mandatory parameters 
    item3.quantity = 1;
    item3.product = datingProduct;
    
    order.items = @[item1, item2, item3];
    
    Create one Checkout Tagging object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    ANCheckoutTagging *checkoutTagging = [[ANCheckoutTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    //mandatory parameters 
    checkoutTagging.currency = [[ANCurrency alloc] initWithStringCode:kCurrencyCodeEUR];
    checkoutTagging.order = order;
    
    // optional parameters
    checkoutTagging.refererURL = @"http%3A%2F%2Fadvertiser.com";
    checkoutTagging.datingCustomer = customer;
    
    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 one Page View Tagging object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    ANPageViewTagging  *pageViewTagging = [[ANPageViewTagging alloc] 
    initWithSession:[ANSession sharedInstance]];
    // mandatory parameters
    pageViewTagging.pageName = @"pageName";
    
    // optional parameters
    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 Mandatory
    account Account The session’s account YES
    profile Platform The session’s platform YES
    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 program ID(s) to be used by the SDK on all requests to affilinet.

    Attribute Type Description Mandatory
    accountIDs List The advertiser’s program ID(s) 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 Mandatory
    session Session The session YES
    protocol Protocol The request web protocol YES
    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
    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
    basketItems List <OTBasketItem> basket items array YES. For all basket items the following properties are mandatory: articleNumber, productName, category, quantity > 0, singlePrice > 0
    orderRate OTOrderRate order rate NO. Only mandatory if rate mapping is not used
    currencyCode string Use this parameter, if different from the standard currency of your platform NO
    programSubId 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
    Method Returns Description
    setBasketItems (OTBasketItem) void setter
    addProgramSubId(string) void setter
    setCurrency(string) void setter
    setVoucherCode(string) void setter
    setOrderRate (OTOrderRate) void setter
    setPublisherId(Integer) void setter
    setPublisherSubId(string) void setter
    setAdType(AdType) void setter
    setAdNumber(Integer) void setter
    setClickTime(Date) void setter
    setUid(string) void setter
    OTBasketItem

    An OTBasketItem represents one item in the basket order tracking.

    Attribute Type Description Mandatory
    articleNumber string The article number of the product 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
    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 Use this parameter, if different from the standard currency of your platform NO
    programSubId 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
    Method Returns Description
    setOrderRate (OTOrderRate) void setter
    addProgramSubId(string) void setter
    setCurrency(string) void setter
    setVoucherCode(string) void setter
    setPublisherId(Integer) void setter
    setAdType(AdType) void setter
    setAdNumber(Integer) void setter
    setClickTime(Date) void setter
    setPublisherSubId(string) void setter
    setUid(string) void setter
    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 Use this parameter, if different from the standard currency of your platform NO
    lmulti integer The lead commission will be multiplied by the quantity transmitted in this parameter NO
    programSubId 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
    Method Returns Description
    setOrderRate (OTOrderRate) void setter
    addProgramSubId(string) void setter
    setCurrency(string) void setter
    setVoucherCode(string) void setter
    setPublisherId(Integer) void setter
    setAdType(AdType) void setter
    setAdNumber(Integer) void setter
    setClickTime(Date) void setter
    setPublisherSubId(string) void setter
    setUid(string) void setter
    setLmulti(Integer) void setter
    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 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
    RTTravelProduct

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

    Attribute Type Description Mandatory
    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
    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
    age integer The customer's age NO
    zipCode string The customer's zip/postal code NO
    country string The country of the customer’s home address NO
    status boolean The status of the customer, e.g. new or existing NO
    wasLoggedIn Boolean Indicates if user 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, URL-encoded 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 (standard retail, travel or dating) YES (name, productid, category, price > 0)
    currencyCode string currency of the order (3-letter ISO code) YES
    refererUrl string Referer url NO
    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 of the order (3-letter ISO 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 of the order (3-letter ISO code) YES
    refererUrl string Referer url NO
    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 of the order (3-letter ISO 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 of the order (3-letter ISO code) YES
    customer RTDatingCustomer customer data 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
    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
    setRefererUrl(string) void setter
    setCustomer(RTDatingCustomer) 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 not mandatory, but strongly recommended
    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 NO
    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 = "replace-with-your-productid";
    basketItem.singlePrice = 20.45;
    basketItem.quantity = 1;
    // optional parameters
    basketItem.productName = "amazing%20product";
    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 = "replace-with-your-productid2";
    basketItem2.singlePrice = 40.45;
    basketItem2.quantity = 1;
    // optional parameters
    basketItem2.productName = "amazing%20product%202";
    basketItem2.category = "jeans%202";
    basketItem2.brand = "Versace%202";
    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 = "replace-with-your-productid3";
    basketItem3.singlePrice = 40.45;
    basketItem3.quantity = 3;
    // optional parameters
    basketItem3.productName = "amazing%20product%203";
    basketItem3.category = "jeans%203";
    basketItem3.brand = "Versace%203";
    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
    8
    9
    RTOrder order = new RTOrder();
    // mandatory parameters
    order.orderId = UUID.randomUUID().toString();
    //optional parameters
    order.orderDescription = "new-custom-order-description";
    // optional parameter, only if basketItems are not transferred
    order.total = 182.25;
    // parameters for server sided tracking only
    order.orderDate = new Date();
    
    Create 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.setBasketItems(basketItems);
    
    // optional parameters
    actBasketTracking.addProgramSubId("custom-program-subid1");
    actBasketTracking.addProgramSubId("custom-program-subid2");
    actBasketTracking.setCurrency("EUR");
    actBasketTracking.setVoucherCode("voucher-code");
    actBasketTracking.setOrderRate(new OTOrderRate(1, OTRateMode.SALE));
    
    // 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
    26
    27
    RTOrder order = new RTOrder();
    // mandatory parameters
    order.orderId = UUID.randomUUID().toString();
    order.total = 324.45;
    //optional parameter
    order.orderDescription = "new-custom-order-description";
    // parameter 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
    28
    RTOrder order = new RTOrder();
    // mandatory parameter
    order.orderId = UUID.randomUUID().toString();
    // optional parameters
    order.total = 24.45;
    order.orderDescription = "new-custom-order-description";
    // 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
    18
    19
    20
    21
    RTOrder order = new RTOrder();
    // mandatory parameter
    order.orderId = UUID.randomUUID().toString();
    
    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 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
    24
    RTProduct product = new RTProduct();
    // mandatory parameters
    product.productId = "replace-with-your-productid";
    product.name = "Amazing%20Product";
    product.price = 40.45;
    
    // optional parameters 
    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%20Flops");
    product.brand = "Amazing%20Brand";
    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
    16
    17
    18
    19
    RTTravelProduct travelProduct = new RTTravelProduct();
    // mandatory parameters
    travelProduct.productId = "replace-with-your-productid";
    travelProduct.name = "Amazing%20Travel%20Product";
    travelProduct.price = 50.45;
    
    // optional parameters 
    travelProduct.departureDate = new (113, 11, 5, 11, 25);
    travelProduct.endDate = new (113, 11, 5, 14, 25);
    travelProduct.productType = "with%20hotel";
    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
    12
    13
    14
    15
    16
    17
    RTDatingProduct datingProduct = new RTDatingProduct();
    // mandatory parameters
    datingProduct.productId = "replace-with-your-productid";
    datingProduct.name = "Amazing%20Dating%20Product";
    datingProduct.price = 60.45;
    
    // optional parameters
    datingProduct.category = new RTProductCategory();
    datingProduct.customer = new RTDatingCustomer();
    datingProduct.customer.gender = Gender.Male;
    datingProduct.customer.ageRange = "25-50";
    datingProduct.customer.zipCode = "80637";
    
    
    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
    RTProductCategory productCategory = new RTProductCategory();
    // mandatory parameters 
    productCategory.categoryId = "c1";
    productCategory.categoryName = "category%20name";
    
    // optional parameters
    productCategory.clickURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fclick.html";
    productCategory.imageURL = "http%3A%2F%2Fadvertiser.com%2Fcategory%2Fimage.png";
    
    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 an 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
    RTProduct product = new RTProduct();
    // mandatory parameters 
    product.productId = "replace-with-your-productid";
    product.name = "Amazing%20Product";
    product.price = 40.45;
    
    // optional parameters 
    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%20Flops");
    product.brand = "Amazing%20Brand";
    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();
    // mandatory parameters
    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 one Order Item object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    RTProduct product = new RTProduct();
    // mandatory parameters 
    product.productId = "replace-with-your-productid";
    product.name = "Amazing%20Product";
    product.price = 40.45;
    
    // optional parameters 
    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%20Flops");
    
    RTOrderItem item = new RTOrderItem();
    // mandatory parameters 
    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 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
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    RTProduct product1 = new RTProduct();
    // mandatory parameters 
    product1.productId = "replace-with-your-productid";
    product1.name = "Amazing%20Product%201";
    product1.price = 40.45;
    // optional parameters 
    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%20Flops");
    product1.brand = "Amazing%20Brand";
    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();
    // mandatory parameters 
    item1.quantity = 1;
    item1.product = product;
    
    
    RTTravelProduct travelProduct = new RTTravelProduct();
    // mandatory parameters 
    travelProduct.productId = "replace-with-your-productid";
    travelProduct.name = "Amazing%20Travel%20Product";
    travelProduct.price = 50.45;
    // optional parameters
    travelProduct.departureDate = new (113, 11, 5, 11, 25);
    travelProduct.endDate = new (113, 11, 5, 14, 25);
    travelProduct.productType = "with%20hotel";
    travelProduct.kids = "0";
    travelProduct.adults = "2";
    travelProduct.hotelCategory = "middle";
    travelProduct.pointOfDeparture = "Lisbon";
    travelProduct.pointOfDestination = "Frankfurt";
    RTOrderItem item2 = new RTOrderItem();
    // mandatory parameters
    item2.quantity = 1;
    item2.product = travelProduct;
    
    RTDatingProduct datingProduct = new RTDatingProduct();
    // mandatory parameters 
    datingProduct.productId = "replace-with-your-productid";
    datingProduct.name = "Amazing%20Dating%20Product";
    datingProduct.price = 60.45;
    // optional parameters 
    datingProduct.customer = new RTDatingCustomer();
    datingProduct.customer.gender = Gender.Male;
    datingProduct.customer.ageRange = "25-50";
    datingProduct.customer.zipCode = "80637";
    RTOrderItem item3 = new RTOrderItem();
    // mandatory parameters 
    item3.quantity = 1;
    item3.product = datingProduct;
    
    List<RTOrderItem> items = new ArrayList<>();
    items.add(item1, item2, item3);
    
    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
    60
    61
    62
    63
    64
    65
    66
    RTOrder order = new RTOrder();
    // mandatory parameters
    order.orderId = UUID.randomUUID().toString();
    order.total = 324.4523;
    
    order.items = new ArrayList<>();
    
    RTProduct product = new RTProduct();
    // mandatory parameters 
    product.productId = "replace-with-your-productid";
    product.name = "Amazing%20Product";
    product.price = 40.45;
    // optional parameters 
    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%20Flops");
    product.clickURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fclick.html";
    product.imageURL = "http%3A%2F%2Fadvertiser.com%2Fproduct%2Fimage.png";
    RTOrderItem item1 = new RTOrderItem();
    //mandatory parameters
    item1.quantity = 2;
    item1.product = product;
    
    RTTravelProduct travelProduct = new RTTravelProduct();
    // mandatory parameters 
    travelProduct.productId = "replace-with-your-productid";
    travelProduct.name = "Amazing%20Travel%20Product";
    travelProduct.price = 50.45;
    // optional parameters
    travelProduct.departureDate = new (113, 11, 5, 11, 25);
    travelProduct.endDate = new (113, 11, 5, 14, 25);
    travelProduct.productType = "with%20hotel";
    travelProduct.kids = "0";
    travelProduct.adults = "2";
    travelProduct.hotelCategory = "middle";
    travelProduct.pointOfDeparture = "Lisbon";
    travelProduct.pointOfDestination = "Frankfurt";
    RTOrderItem item2 = new RTOrderItem();
    // mandatory parameters
    item2.quantity = 1;
    item2.product = travelProduct;
    
    RTDatingProduct datingProduct = new RTDatingProduct();
    // mandatory parameters 
    datingProduct.productId = "replace-with-your-productid";
    datingProduct.name = "Amazing%20Dating%20Product";
    datingProduct.price = 60.45;
    
    datingProduct.customer = new RTDatingCustomer();
    // optional parameters 
    datingProduct.customer.gender = Gender.Male;
    datingProduct.customer.ageRange = "25-50";
    datingProduct.customer.zipCode = "80637";
    datingProduct.customer.age = 23;
    datingProduct.customer.country = "Germany";
    datingProduct.customer.status = "New";
    RTOrderItem item3 = new RTOrderItem();
    // mandatory parameters 
    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
    6
    7
    8
    9
    10
    11
    ACTCheckoutProfiling actCheckoutProfiling = new ACTCheckoutProfiling(Session.getInstance(),
    order, "EUR");
    actCheckoutProfiling.setRefererUrl("http%3A%2F%2Fadvertiser.com%2Fcheckout.html");
    actCheckoutProfiling.setPaymentType("paypal");
    actCheckoutProfiling.setShippingGrossPrice("4.95");
    actCheckoutProfiling.setShippingTax(6.0);
    actCheckoutProfiling.setShippingType("standard");
    actCheckoutProfiling.setVoucherCode("v9917417431784");
    actCheckoutProfiling.setVoucherCodeDiscount(12.0);
    actCheckoutProfiling.setTax(20.0);
    actCheckoutProfiling.setCustomer(datingProduct.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 one Page View object
    1
    2
    3
    4
    5
    6
    7
    8
    9
    ACTPageViewProfiling actPageViewProfiling = new ACTPageViewProfiling(Session.getInstance());
    // mandatory parameters 
    actPageViewProfiling.setPageName("pageName");
    
    // optional parameters 
    actPageViewProfiling.setPageUrl("pageUrl");
    actPageViewProfiling.setPageType("pageType");
    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) {
       }
    });