This preview of pull request 1639 is meant for internal use only.

Batch Destination

Batch quick info

Batch is in beta, and accepts Track, Identify, and Group calls. If you reference it in the Integrations object, call it “Batch”.

Batch accepts device-mode data only from a mobile source.

The Batch.com integration code is open sourced on GitHub. Feel free to check it out: iOS, Android.

Getting Started

  • Batch.com supports the screen, track, identify and group methods.

  • Make a Batch.com account.
  • Turn on Batch.com using Segment dashboard.
  • Enter your Batch LIVE API Key. You can find it in your dashboard, under ‘settings’.

Events tracked using Segment’s track/screen will automatically be tracked. Identify and group calls will also be mapped to Batch user data.

Android

Installation

Add the following dependency in your build.gradle:

compile "com.batch.android:sdk-segment-integration:+"

Import the integration:

import com.segment.analytics.android.integrations.batch.BatchIntegration;

Then, add the factory to your Analytics instance:

Analytics analytics = new Analytics.Builder(this, "write_key")
                .use(BatchIntegration.getFactory(this))
                .build();

iOS

Installation

Add the following Cocoapods dependency:

pod 'Segment-Batch'

If you integrate in a Swift project or have use_frameworks! in your Podfile, you need to use the following to work around due to a limitation with Cocoapods:

pod 'Batch'
pod 'Segment-Batch/StaticLibWorkaround'

Then, add the integration factory in your Analytics instance:

#import <Segment-Batch/SEGBatchIntegrationFactory.h>

SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"MySegmentWriteKey"];
[config use:[SEGBatchIntegrationFactory instance]];
[SEGAnalytics setupWithConfiguration:config];

Screen

When you call screen in your mobile app, we send a screen view to an event named SEGMENT_SCREEN. The screen name will be tracked as the event’s label.

Identify

When you identify a user, we’ll pass that user’s information to Batch as the custom user identifier. Batch supports tracking anonymous users, but not through Segment’s anonymousId.

Tracked events are attached to the installation ID, and the installation ID itself can be attached/detached to a user at a later date, with no data loss.

Track

When you track an event, we will send that event to Batch after converting the name to fit Batch’s event naming rules.

For example, an event named Ad Shown will become AD_SHOWN. Note that this means that event names longer than 30 characters will be truncated. The events title property will become the event’s label.

Group

When you call group, we will set the group ID in a user attribute named SEGMENT_GROUP.

Features

All of our supported Segment integration features will work automatically, with no action or specific properties required on your side.

Batch’s other features are available directly by using the native SDK, which comes bundled with this integration.

To use the Batch native SDK through Segment, follow the instructions for Android and instructions for iOS.

Supported Sources and Connection Modes

Before you start, make sure Batch supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️
☁️ Cloud-mode ⬜️ ⬜️ ⬜️

This destination requires that you use a Device-based Connection Mode for Mobile data. Make sure you package the Batch mobile SDK with the Segment mobile library.

Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

API Key

You can find your API Key in your app’s settings, in the Batch.com dashboard

Allow advertising ID collection.

Toggles whether Batch is allowed to collect advertising IDs

Allow collection of advanced device information.

Toggles whether Batch can use all of the device information it supports. All of this info is anonymous, but some might want to disable it under strict privacy rules. If disabled, some targeting options in your Batch.com dashboard will stop working correctly.

GCM Sender ID

Android only. You can find out how to get your GCM sender ID here. Note that you shouldn’t change this value once you’ve set it: doing so will end up in push delivery issues.

This page was last modified: 18 Sep 2020



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account