You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Segment recommends testing in a development environment before deploying Signals in production. For more information, see [Debug mode](#step-4-enable-debug-mode).
27
27
28
-
## Step 1: Install dependencies
28
+
## Prerequisites
29
29
30
-
To install Signals, add the following dependencies to your app-level Gradle build file.
30
+
Auto-Instrumentation (aka Signals) works on top of Analytics and Live Plugins. Make sure to add the following dependencies to your module's Gradle file if you don't have them already.
The core libraries are required to enable Signals and real-time analytics. Use the following optional plugins to track additional activity based on your app's architecture:
58
-
59
-
-**Compose**: Tracks user interface events in Jetpack Compose.
60
-
-**OkHttp3**: Captures requests sent through OkHttp3 or Retrofit.
61
-
-**Navigation**: Tracks route changes when using Jetpack Navigation.
62
-
-**JavaNet**: Tracks network activity sent through `HttpURLConnection`.
63
-
64
-
Only add the plugins you plan to use. You can add or remove them later without reinitializing your source.
65
-
66
-
## Step 2: Initialize the SDK
67
-
68
-
After you add dependencies, you need to initialize the Analytics client and configure the Signals plugin.
69
-
70
-
Start by creating the `Analytics` instance using your source's write key. Then add the Signals plugin and configure its settings separately.
71
-
72
-
```kotlin
73
-
// Create the Analytics instance with your configuration
74
-
val analytics =Analytics(Configuration(writeKey ="<WRITE_KEY>"))
75
-
76
-
// Add the live plugin for real-time event handling
77
-
analytics.add(LivePlugins())
39
+
## Step 1: Getting started
78
40
79
-
// Add the Signals plugin
80
-
analytics.add(Signals)
81
-
82
-
// Configure Signals settings
83
-
Signals.configuration =Configuration(
84
-
maximumBufferSize =1000, // Number of signals to keep in memory
85
-
broadcastInterval =60, // Send signals every 60 seconds
2. install the `JavaNetTrackingPlugin` on where you initialize analytics:
174
+
```kotlin
175
+
JavaNetTrackingPlugin.install()
176
+
```
166
177
167
-
## Step 4: Enable debug mode
178
+
179
+
## Step 3: Enable debug mode
168
180
169
181
By default, Signals stores captured data on the device and doesn't forward it to Segment. This process prevents unnecessary bandwidth use and helps support privacy compliance requirements.
170
182
171
-
To view captured signals in the Event Builder and create event generation rules, you need to enable `debugMode`. This setting temporarily lets the SDK send signal data to Segment while you're testing.
183
+
To view captured signals in the Event Builder and create event generation rules, you need to enable `sendDebugSignalsToSegment`. This setting temporarily lets the SDK send signal data to Segment while you're testing.
184
+
185
+
In addition, the SDK obfuscates signals sent to Segment by default. To view the completed data, you need to turn off `obfuscateDebugSignals`.
172
186
173
187
> warning ""
174
-
> Only enable `debugMode` in development environments. Avoid using `debugMode` in production apps.
188
+
> Only enable `sendDebugSignalsToSegment` in development environments. Avoid using `sendDebugSignalsToSegment` in production apps.
175
189
176
-
You can enable `debugMode` in one of two ways.
190
+
You can enable `sendDebugSignalsToSegment` and turn off `obfuscateDebugSignals` in one of two ways.
177
191
178
192
### Option 1: Use build flavors
179
193
180
-
Configure `debugMode` at build time using [Android product flavors](https://developer.android.com/build/build-variants#product-flavors){:target="_blank"}.
194
+
Configure `sendDebugSignalsToSegment` and `obfuscateDebugSignals` at build time using [Android product flavors](https://developer.android.com/build/build-variants#product-flavors){:target="_blank"}.
181
195
182
196
1. In your `build.gradle` file, define two flavors:
183
197
@@ -186,10 +200,12 @@ Configure `debugMode` at build time using [Android product flavors](https://deve
If your app uses [Firebase Remote Config](https://firebase.google.com/docs/remote-config){:target="_blank"} or a similar system, you can control `debugMode` remotely.
226
+
If your app uses [Firebase Remote Config](https://firebase.google.com/docs/remote-config){:target="_blank"} or a similar system, you can control `sendDebugSignalsToSegment` and `obfuscateDebugSignals` remotely.
@@ -226,26 +244,28 @@ After you build and run your app, use the [Event Builder](/docs/connections/auto
226
244
- Tap buttons and UI elements.
227
245
- Trigger network requests.
228
246
229
-
If `debugMode` is enabled, Signals appear in real time as you interact with the app.
247
+
If `sendDebugSignalsToSegment` is enabled, Signals appear in real time as you interact with the app.
230
248
231
249
4. In the Event Builder, select a signal and click **Configure event** to define a new event.
232
250
5. After you add any event mappings, click **Publish event rules** to save them.
233
251
234
252
> info "What if I don't see the Event Builder tab?"
235
-
> If you don't see the Event Builder tab, confirm that the SDK is installed correctly and make sure `debugMode` is enabled. Verify that Auto-Instrumentation is enabled in **Settings > Advanced**. If you still don't see it, reach out to your CSM.
253
+
> If you don't see the Event Builder tab, confirm that the SDK is installed correctly and make sure `sendDebugSignalsToSegment` is enabled. Verify that Auto-Instrumentation is enabled in **Settings > Advanced**. If you still don't see it, reach out to your CSM.
236
254
237
255
## Configuration options
238
256
239
257
Use the `Signals.configuration` object to control how captured signals are stored, relayed, and displayed.
|`maximumBufferSize`| No |`Int`|`1000`| The number of captured signals to keep in memory before relaying them. Signals get stored in a first-in, first-out buffer. |
246
-
|`broadcastInterval`| No |`Int` (seconds) |`60`| The interval, in seconds, at which buffered signals are sent to broadcasters. |
247
-
|`broadcasters`| No |`List<SignalBroadcaster>`| N/A | A list of broadcasters that forward signal data to external destinations. `SegmentBroadcaster` is included by default, and you can add others like `WebhookBroadcaster` or a custom implementation. |
248
-
|`debugMode`| No |`Boolean`|`false`| When `true`, relays signals to Segment so they appear in the Event Builder. Only enable this in development environments. |
|**maximumBufferSize**| No | Integer | The number of signals to be kept for JavaScript inspection. This buffer is first-in, first-out. Default is **1000**. |
264
+
|**relayCount**| No | Integer | Relays every X signals to Segment. Default is **20**. |
265
+
|**relayInterval**| No | Integer | Relays signals to Segment every X seconds. Default is **60**. |
266
+
|**broadcasters**| No | List<SignalBroadcaster> | An array of broadcasters. These objects forward signal data to their destinations, like **WebhookBroadcaster**, or you could write your own **DebugBroadcaster** that writes logs to the developer console. **SegmentBroadcaster** is always added by the SDK. |
267
+
|**sendDebugSignalsToSegment**| No | Boolean | Turns on debug mode and allows the SDK to relay Signals to Segment server. Default is **false**. It should only be set to true for development purposes. |
268
+
|**obfuscateDebugSignals**| No | Boolean | Obfuscates signals being relayed to Segment. Default is **true**. |
0 commit comments