Marketing campaigns

 

Foreword

AT Internet’s SDK allows you to tag different types of campaigns (ad, affiliation, sponsored links, email marketing).

 

Get off to a good start

Once your tag is initialised, you may add campaign information to your screen hit.

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

 

Referrer

AT Internet’s SDK enables the retrieval of the Android application’s referrer in order to track the campaign that generated the application installation.

To do this, you must follow certain implementations so that the campaign is taken into account.

In the link redirecting toward the PlayStore, the variable “&referrer=” must contain “&xtor=”

Please note, the referrer variable contained in the redirect link toward the PlayStore must be encoded in order to retrieve the source!

Link example: “https://play.google.com/store/apps/details?id=com.atinternet.android&hl=fr&referrer=test%26xtor%3dAD-123?

Then, in your application, you must define the class ReferrerReceiver of the SDK as the referrer retriever:

<application
        android:name="com.atinternet.tracker.ATInternet"
        android:allowBackup="true"
        android:icon="@drawable/at_logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <!--Add this block-->
        <receiver
            android:name="com.atinternet.tracker.ReferrerReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>

If you implement your own BroadcastReceiver to retrieve the referrer, it must inherit from the one in the SDK:

package com.atinternet.atinternetdemo;

import android.content.Context;
import android.content.Intent;

import com.atinternet.tracker.ReferrerReceiver;

public class DemoReceiver extends ReferrerReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        super.onReceive(context, intent);
    }
}
 

Tagging

The Screen object makes a Campaign methode available. This method takes one parameter :

  • campaignId of type String indicates campaign identifier

This method sends back a Campaign-type object.

The SDK allows you to manage two modes of campaign “prior attribution”. You can choose to conserve the first or last detected campaign during a definitive period of time via your setup (by default, the first campaign will be conserved). This information will be found in your hit’s xtor variable. To modify the “prior attribution” mode, please proceed as follows:

  1. The first detected campaign will be conserved during the time period defined in the setup (30 days by default)
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.SetConfigCallback;
    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();
            tracker.setConfig("campaignLastPersistence", false, new SetConfigCallback() {
                @Override
                public void setConfigEnd() {
                    Log.d(null, "Campaign configuration is now set");
                }
            });
        }
    }
  2. The last detected campaign will be conserved during the time period defined in the setup (30 days by default)
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.SetConfigCallback;
    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();
            tracker.setConfig("campaignLastPersistence", true, new SetConfigCallback() {
                @Override
                public void setConfigEnd() {
                    Log.d(null, "Campaign configuration is now set");
                }
            });
        }
    }
 

Tagging examples

If you wish to simplify the tagging of your links without having to know the significance of each field, try the interface available in our marketplace. Please note that this interface has been created by our community and can be improved, so feel free to send us your feedback!

  1. Tagging an ad campaign

    In the case of an ad, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix AD
    – B: campaign ID value (given by AT Internet)

    Optional:

    – C: creative (in the format [label] or id[label]).
    – D: variant (in the format [label] or id[label]).
    – E: format (according to IDs given by AT Internet and placed between []. You may also specify any other format of your choice by using the following nomenclature: “[name]”. Example: You can either give a label: [button], or a size: [120×40]).
    – F: site (specifying the URL in the format [url]).
    – G: general placement within the entire site (according to IDs given by AT Internet and placed between []).
    – H: details on the placement within the web page.

    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();
            Screen s = tracker.Screens().add("Ad");
            s.Campaign("AD-3030-[ad_Version_7]-[without_text]-[468]-[www.site.com]-[GT]-[top_page]");
            s.sendView();
        }
    }
  2. Tagging an affiliation campaign

    In the case of affiliation, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix AL
    – B: campaign ID value (in the format [label] or id[label])

    Optional:

    – C: affiliate type (in the format [label] or id[label])
    – D: affiliate ID (in the format [label] or id[label])
    – E: affiliate ad format (based on predefined IDs. You may also specify any other format of your choice by using the following nomenclature: “[name]”. Example: You can either give a label: [button], or a size: [120×40]).
    – F: creative ID (in the format [label] or id[label])
    – G: variant (in the format [label] or id[label])
    – C1*: custom variable to be declared in the interface (in the id[label])
    – C2*: custom variable to be declared in the interface (in the id[label])
    – C3*: custom variable to be declared in the interface (in the id[label])

    *not available in the Analytics Suite, should you need to study these please get back to the support
    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();
            Screen s = tracker.Screens().add("Affiliation");
            s.Campaign("AL-3030-1[comparison_shopper]-34253-[468]-4[cars_advertisement]-6[blue_version]|233[customer_name]-3425[id_contract]");
            s.sendView();
        }
    }
  3. Tagging a sponsored links campaign

    In the case of sponsored links, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix SEC
    – B: campaign ID value (given by AT Internet)

    Optional:

    – C: platform ID (only if your campaign is distinct on each platform)
    – D: ad group (in the format [label] or id[label]). This variable is mandatory if importing Google AdWords data.
    – E: ad variation (in the format [label] or id[label]). By entering exactly [{creative}] in Google, Google will place a unique variation ID enabling linking to results during data imports from Google.
    – F: “S” or “C” according to whether it comes from search results (“S” for Search) or ads on content/display networks (“C” for Content).
    – G: the exact keyword bought. By entering exactly [{keyword}] for a campaign in Google, Google will automatically place the exact keyword bought (which may slightly differ from the keyword entered). The principle is similar for Yahoo ([{YSMKEY}]).

    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();
            Screen s = tracker.Screens().add("Sponsored Link");
            s.Campaign("SEC-300-GOO-[group_1]-[Var_1]-{ifContent:C}{ifSearch:S}-[{keyword}]&xts=1111111");
            s.sendView();
        }
    }
  4. Tagging an email marketing campaign

    In the case of email marketing, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix EREC, EPR or ES
    – B: campaign ID value
    – C: email blast ID in the format [label] or id[label] (without this label, it will be impossible to get the email overlay analysis).

    Optional:

    – D: Email date in short format: YYYYMMDD
    – E: link ID in the format “[label]” (added by you, based on the link). Please only add if you would like the precise detail of user clicks (and notably email overlay analyses).
    Click specification depends on the customer’s preference: each link, or only the main areas.
    – F: List of contacts with contact ID in the format id@list (for example, 1435@1 for contact 1435 on list 1).
    – G: Precise date and time in long format: YYYYMMDDHHMMSS

    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();
            Screen s = tracker.Screens().add("eMailing");
            s.Campaign("EPR-300-[Presentation_service]-20070304-[link2]-1435@1-20070304130405");
            s.sendView();
        }
    }
 

Campaign class

 

Properties

NameTypeDefault valueDescription
campaignIdStringEmpty stringGets or sets the campaign ID
 

Force visit marketing source

This guide is only available for Analytics Suite Delta analysis.

The forced source is taken into account from the next day. The real-time functionalities (Data Query granular exports, or Data Flow) are still based on the classic source detection.

It is possible to force the marketing source of a visit even if we’ve already retrieved another one on past events.
For this, you have to set the src_force property (boolean) to true:

tracker.setProp("b:src_force", "true", false);

If several sources are forced during a visit, the last one filled in will be the one kept.

Last update: 04/04/2022