Skip to content

Commit a108078

Browse files
authored
Merge pull request #1 from BatchLabs/feature/sdk_1.17
Added support for Batch WebView In-App format.
2 parents 011b94a + 92803ef commit a108078

File tree

5 files changed

+125
-50
lines changed

5 files changed

+125
-50
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
UPCOMING
2+
-----
3+
4+
* Added support for Batch WebView In-App format. The dispatcher now requires Batch 1.17 or higher.
5+
16
1.1.1
27
-----
38

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Batch.com Android Mixpanel Dispatcher
55
==================
66

7-
![Logo](http://batch-doc.s3.amazonaws.com/logo_batch_192.gif)
7+
![Logo](https://static.batch.com/documentation/Readmes/logo_batch_full_178.png)
88

99
# About
1010

@@ -13,14 +13,14 @@ A "ready-to-go" dispatcher that reflect event from the Batch SDK to Mixpanel usi
1313
# Requirements
1414
- Android Studio 3.0+
1515
- Android 15+
16-
- Batch Android SDK 1.15.0+
16+
- Batch Android SDK 1.17.0+
1717
- Mixpanel 5+
1818

1919
# Installation
2020
Gradle (recommended)
2121

2222
```
23-
implementation 'com.batch.android:mixpanel-dispatcher:1.0.0'
23+
implementation 'com.batch.android:mixpanel-dispatcher:2.0.0'
2424
```
2525

2626
Read our [setup documentation](https://doc.batch.com/) to follow a step by step tutorial for integrating Batch features into your app.

mixpanel-dispatcher/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ android {
3737
}
3838

3939
dependencies {
40-
api 'com.batch.android:batch-sdk:1.16.1'
40+
api 'com.batch.android:batch-sdk:1.17.0'
4141
api 'com.mixpanel.android:mixpanel-android:5.8.0'
4242

4343
testImplementation 'junit:junit:4.12'

mixpanel-dispatcher/src/main/java/com/batch/android/dispatcher/mixpanel/MixpanelDispatcher.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public class MixpanelDispatcher implements BatchEventDispatcher
4242
*/
4343
private static final String BATCH_TRACKING_ID = "batch_tracking_id";
4444

45+
/**
46+
* Key used to dispatch the webview click analytics ID
47+
*/
48+
private static final String BATCH_WEBVIEW_ANALYTICS_ID = "batch_webview_analytics_id";
49+
4550
/**
4651
* Event name used when logging on Mixpanel
4752
*/
@@ -51,7 +56,9 @@ public class MixpanelDispatcher implements BatchEventDispatcher
5156
private static final String MESSAGING_SHOW_NAME = "batch_in_app_show";
5257
private static final String MESSAGING_CLOSE_NAME = "batch_in_app_close";
5358
private static final String MESSAGING_AUTO_CLOSE_NAME = "batch_in_app_auto_close";
59+
private static final String MESSAGING_CLOSE_ERROR_NAME = "batch_in_app_close_error";
5460
private static final String MESSAGING_CLICK_NAME = "batch_in_app_click";
61+
private static final String MESSAGING_WEBVIEW_CLICK_NAME = "batch_in_app_webview_click";
5562
private static final String UNKNOWN_EVENT_NAME = "batch_unknown";
5663

5764
MixpanelAPI mixpanelInstance = null;
@@ -112,6 +119,11 @@ private static Map<String, Object> getInAppParams(Batch.EventDispatcher.Payload
112119
mixpanelParams.put(MEDIUM, "in-app");
113120
mixpanelParams.put(BATCH_TRACKING_ID, payload.getTrackingId());
114121

122+
String webViewAnalyticsId = payload.getWebViewAnalyticsID();
123+
if (webViewAnalyticsId != null) {
124+
mixpanelParams.put(BATCH_WEBVIEW_ANALYTICS_ID, webViewAnalyticsId);
125+
}
126+
115127
String deeplink = payload.getDeeplink();
116128
if (deeplink != null) {
117129
deeplink = deeplink.trim();
@@ -229,8 +241,12 @@ private static String getMixpanelEventName(Batch.EventDispatcher.Type type) {
229241
return MESSAGING_CLOSE_NAME;
230242
case MESSAGING_AUTO_CLOSE:
231243
return MESSAGING_AUTO_CLOSE_NAME;
244+
case MESSAGING_CLOSE_ERROR:
245+
return MESSAGING_CLOSE_ERROR_NAME;
232246
case MESSAGING_CLICK:
233247
return MESSAGING_CLICK_NAME;
248+
case MESSAGING_WEBVIEW_CLICK:
249+
return MESSAGING_WEBVIEW_CLICK_NAME;
234250
}
235251
return UNKNOWN_EVENT_NAME;
236252
}

0 commit comments

Comments
 (0)