Getting Started

Requirements

  • Min API 9+ (Gingerbread)
  • Permissions
    • android.permission.INTERNET
    • android.permission.ACCESS_NETWORK_STATE

Download

TODO: link

Available in 2 options:

  • Source (As an Android Studio project)
  • tealium-AS_1.0.jar

Update AndroidManifest.xml

Add the Tealium Collect library required permissions to the AndroidManifest.xml:

  • android.permission.INTERNET
  • android.permission.ACCESS_NETWORK_STATE

Enable

From an Application or Activity subclass, initialize the AudienceStream library with the enable command:

import com.tealium.collect.TealiumCollect;

/* ... */

TealiumCollect.enable(new TealiumCollect.Config(this, 
    "tealiummobile", 
    "demo", 
    "dev"));

This method only needs to be called a single time while the application is running, so an Application subclass' onCreate method is the ideal location to make this method call.

Send Events

After determining what visitor behaviors should be tracked, utilize the sendEvent and sendView methods to send that data to AudienceStream:

Map<String, String> data = new HashMap<String, String>(1);
data.put("action", "logout");

TealiumCollect.sendEvent(data);
Map<String, String> data = new HashMap<String, String>(1);
data.put("screen_title", "checkout");

TealiumCollect.sendView(data);

For some ideas on what actions to track, please see the Trackable Actions guide.

Leveraging the Visitor Profile

The Tealium Collect library offers a variety of means to identifiy visitor behavior and offer a personalized app experience to them.

Add event listeners to TealiumCollect through the getEventListeners property to listen for visitor updates:

AudienceStream.getEventListeners().add(new AudienceStream.OnBadgeUpdateListener() {
    @Override
    public void onBadgeUpdate(BadgeAttribute oldBadge, BadgeAttribute newBadge) {
        if(newBadge != null && "30".equals(newBadge.getId())) {
            // Visitor has earned a "Fan" Badge!
        }
    }   
});

Visitor Attributes are defined in AudienceStream through TealiumIQ. The available attributes are:

  • Audience
    • Groups of Visitor Attributes.
  • Badge
    • Badges are ways of identifying segments of new users.
  • Date
    • Stores a date value.
  • Flag
    • Stores boolean values.
  • Metric
    • Stores numerical data.
  • Trait
    • Stores string.

To look up what attributes are currently defined for your AudienceStream account-profile:

GET http(s)://visitor-service.tealiumiq.com/datacloudprofiledefinitions/{account}/{profile}/{visitor_id}

A visitor id is created per-install by the Tealium Collect library, and can be found through LogCat logs or the getVisitorId method.

Updated by chadhartman