Send disabled events to Segment
MODIFY
analytics/src/main/java/com/segment/analytics/IntegrationOperation.java
analytics/src/main/java/com/segment/analytics/IntegrationOperation.java
@@ -191,8 +191,10 @@ abstract class IntegrationOperation {
// We have a tracking plan for the event.
boolean isEnabled = eventPlan.getBoolean("enabled", true);
if (!isEnabled) {
- // If event is disabled in the tracking plan, don't send it to any
- // integrations (Segment included), regardless of options in code.
+ // If event is disabled in the tracking plan, send it only Segment.
+ if (SegmentIntegration.SEGMENT_KEY.equals(key)) {
+ integration.track(trackPayload);
+ }
return;
}

MODIFY
analytics/src/test/java/com/segment/analytics/IntegrationOperationTest.java
analytics/src/test/java/com/segment/analytics/IntegrationOperationTest.java
@@ -129,6 +129,28 @@ public class IntegrationOperationTest {
verify(integration, never()).track(payload);
}
+ @Test
+ public void trackPlanDisabledEventSendsToSegment() throws IOException {
+ TrackPayload payload = new TrackPayload.Builder()
+ .event("Install Attributed")
+ .userId("userId")
+ .build();
+ track(
+ payload,
+ "Segment.io",
+ Cartographer.INSTANCE.fromJson(
+ "{\n"
+ + " \"plan\": {\n"
+ + " \"track\": {\n"
+ + " \"Install Attributed\": {\n"
+ + " \"enabled\": false\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + "}"));
+ verify(integration).track(payload);
+ }
+
@Test
public void trackPlanDisabledIntegration() throws IOException {
TrackPayload payload = new TrackPayload.Builder()

Send disabled events to Segment