On-site ads

 

Foreword

AT Internet’s SDK offers the measurement of your in-app ads so that you can evaluate their performance.

The goal is to measure “clicks” and impressions of self-promotion ad campaigns, as well as third-party campaigns displayed on your app, and then analyse this information.

To be sure to measure properly the Auto-Promotion campaign, please check if your campaign is declared in Settings > Marketing campaigns.

 

Get off to a good start

Once your tag is initialised, you can start tagging your in-app ads.

If you want to use variables, be sure to import ATInternet, Tracker, SelfPromotion and Publisher classes in your Activity.

 

Tagging

To tag your ads, the tracker exposes two objects, publishers and selfPromotions, according to the type of ad to be measured.

These two objects themselves expose two methods:

  • add
  • sendImpressions

The add method allows you to add an ad tag and put it in standby for send. This method returns an object with type Publisher or SelfPromotion according to the case in question.

To send the defined information, you must call the sendTouch or sendImpression method of your object, based on the type of action taken by the user, or call the Tracker‘s dispatch method.

Please note, calling the methods sendTouch and sendImpression modifies the object’s action property.

The sendImpressions method is used to send all ad data which action is defined as Impression.

The sendTouch and sendImpression methods are available only through the objects Publisher or SelfPromotion returned by the Add method.
They lead to an instantaneous and independent sending (click or impression) of the newly added ad tag.
Example

@Override
protected void onResume() {
    super.onResume();
    tracker.SelfPromotions().add(1).sendImpression();
}

The sendImpressions method is available through Publishers and SelfPromotions objects.
It allows a global sending of all impression-type ad tags that have been previously added.
Example

@Override
protected void onResume() {
    super.onResume();
    tracker.SelfPromotions().add(1);
    tracker.SelfPromotions().add(2);
    tracker.SelfPromotions().sendImpressions();
}
 

Tagging examples

  1. Tagging an ad impression for a third-party
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            tracker.Publishers().add("[ad1]").sendImpression();
        }
    }
  2. Tagging an ad “click” for a third-party
    @Override
    public void onClick(View v) {
            ATInternet.getInstance().getDefaultTracker().Publishers().add("[ad1]").sendTouch();
    }
  3. Tagging a self-promotion campaign impression
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Debugger;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity  {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            tracker.SelfPromotions().add(1).sendImpression();
        }
    }
  4. Tagging an self-promotion campaign “click”
    @Override
    public void onClick(View v) {
            ATInternet.getInstance().getDefaultTracker().SelfPromotions().add(3).sendTouch();
    }
  5. Tagging several ads and sending impressions

    50 impressions per page maximum

    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            tracker.Publishers().add("[ad1]")
                    .setCreation("[creation]")
                    .setVariant("[variant]")
                    .setFormat("[120x40]")
                    .setGeneralPlacement("[generalPlacement]")
                    .setDetailedPlacement("[detailedPlacement]")
                    .setAdvertiserId("1[advertiserId]")
                    .setUrl("[http://advertiser-url.com]");
    
            tracker.Publishers().add("[ad2]");
            tracker.Publishers().add("[ad3]")
                    .setCreation("[creation]")
                    .setVariant("[variant]");
    
            tracker.Publishers().sendImpressions();
        }
    }
  6. Tagging several self-promotion campaigns and sending impressions
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Debugger;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            tracker.SelfPromotions().add(1)
                    .setFormat("[120x40]")
                    .setProductId("p1");
    
            tracker.SelfPromotions().add(2);
    
            tracker.SelfPromotions().add(3)
                    .setProductId("p3");
    
            tracker.SelfPromotions().sendImpressions();
        }
    }
  7. Tagging self-promotion ads and campaigns and using dispatcher
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Debugger;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            tracker.Publishers().add("[ad1]");
            tracker.Publishers().add("[ad2]");
            tracker.SelfPromotions().add(1);
    
            // This will send one hit with publishers and selfpromotion impressions
            tracker.dispatch();
        }
    }
  8. Tagging self-promotion ads and campaigns and adding screen information
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Debugger;
    import com.atinternet.tracker.Tracker;
    
    
    public class MainActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            Screen s = tracker.Screens().add(this);
            s.Publishers().add("[ad1]");
            s.Publishers().add("[ad2]");
            s.SelfPromotions().add(1);
            s.sendView();
        }
    }
 

Publisher class

 

Properties

NameTypeDefault valueDescription
campaignIdStringEmpty stringGets or sets the campaign name (ex: [label] or id[label])
creationStringnullGets or sets the creative name (ex: [label] or id[label])
variantStringnullGets or sets the variant name (ex: [label] or id[label])
formatStringnullGets or sets the format name (predefined or custom ID. ex: [120×40])
generalPlacementStringnullGets or sets the general placement (textual ID predefined by us, to be formatted as [label])
detailedPlacementStringnullGets or sets the detailed placement (ex: [label] or id[label])
advertiserIdStringnullGets or sets the advertiser ID (ex: id[label])
urlStringnullGets or sets the URL linked (ex: [url]
actionEnumOnAppAd.Action.ViewGets or sets the action type (View or Touch)
CustomObjectsCustomObjectsnullClass enabling the addition of custom objects on your hits
 

Methods

NameReturn typeDescription
sendTouchvoidSends a hit indicating that an ad was touched
sendImpressionvoidSends a hit indicating that an ad was seen
 

SelfPromotion class

 

Properties

NomTypeDefault valueDescription

adId

Int-1Gets or sets the ad ID
formatStringnullGets or sets the format name (predefined or custom ID. ex: [120×40])
productIdStringnullGets or sets the self-promoted product in question, that can be found in the order (Subject to the SalesTracker option)
actionEnumOnAppAd.Action.ViewGets or sets the action type (View or Touch)
CustomObjectsCustomObjectsnullClass enabling the addition of custom objects on your hits
 

Methods

NameReturn typeDescription
sendTouchvoidSends a hit indicating that a self-promotion campaign was touched
sendImpressionvoidSends a hit indicating that a self-promotion campaign was seen
Last update: 27/08/2020