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
- Introduce Companion.eidFromURI() and tryIdentifyFromURI() which are
helpers looking for "oeid" in the query parameters of incoming intent
data URIs and, when found, calling identify() with them automatically
- Update README docs
@@ -51,7 +55,7 @@ Remember to replace `VERSION_TAG` with the latest or desired [SDK release](https
51
55
52
56
To configure an instance of the SDK integrating with an [Optable](https://optable.co/) sandbox running at hostname `sandbox.customer.com`, from a configured application origin identified by slug `my-app`, you can instantiate the SDK from an Activity or Application `Context`, such as for example the following application `MainActivity`:
53
57
54
-
Kotlin:
58
+
#### Kotlin
55
59
56
60
```kotlin
57
61
importco.optable.android_sdk.OptableSDK
@@ -72,7 +76,7 @@ class MainActivity : AppCompatActivity() {
72
76
}
73
77
```
74
78
75
-
Java:
79
+
#### Java
76
80
77
81
```java
78
82
importco.optable.android_sdk.OptableSDK;
@@ -107,7 +111,7 @@ However, since production sandboxes only listen to TLS traffic, the above is rea
107
111
108
112
To associate a user device with an authenticated identifier such as an Email address, or with other known IDs such as the Google Advertising ID, or even your own vendor or app level `PPID`, you can call the `identify` API as follows:
109
113
110
-
Kotlin:
114
+
#### Kotlin
111
115
112
116
```kotlin
113
117
importco.optable.android_sdk.OptableSDK
@@ -133,7 +137,7 @@ MainActivity.OPTABLE!!
133
137
})
134
138
```
135
139
136
-
Java:
140
+
#### Java
137
141
138
142
```java
139
143
importco.optable.android_sdk.OptableSDK;
@@ -170,7 +174,7 @@ The frequency of invocation of `identify` is up to you, however for optimal iden
170
174
171
175
To get the targeting key values associated by the configured sandbox with the device in real-time, you can call the `targeting` API as follows:
172
176
173
-
Kotlin:
177
+
#### Kotlin
174
178
175
179
```kotlin
176
180
importco.optable.android_sdk.OptableSDK
@@ -195,7 +199,7 @@ MainActivity.OPTABLE!!
195
199
})
196
200
```
197
201
198
-
Java:
202
+
#### Java
199
203
200
204
```java
201
205
importco.optable.android_sdk.OptableSDK;
@@ -225,7 +229,7 @@ On success, the resulting key values are typically sent as part of a subsequent
225
229
226
230
To send real-time event data from the user's device to the sandbox for eventual audience assembly, you can call the witness API as follows:
227
231
228
-
Kotlin:
232
+
#### Kotlin
229
233
230
234
```kotlin
231
235
importco.optable.android_sdk.OptableSDK
@@ -245,7 +249,7 @@ MainActivity.OPTABLE!!
245
249
})
246
250
```
247
251
248
-
Java:
252
+
#### Java
249
253
250
254
```java
251
255
importco.optable.android_sdk.OptableSDK;
@@ -275,7 +279,7 @@ The specified event type and properties are associated with the logged event and
275
279
276
280
We can further extend the above `targeting` example to show an integration with a [Google Ad Manager 360](https://admanager.google.com/home/) ad server account:
277
281
278
-
Kotlin:
282
+
#### Kotlin
279
283
280
284
```kotlin
281
285
importco.optable.android_sdk.OptableSDK
@@ -311,7 +315,7 @@ MainActivity.OPTABLE!!
311
315
})
312
316
```
313
317
314
-
Java:
318
+
#### Java
315
319
316
320
```java
317
321
importco.optable.android_sdk.OptableSDK;
@@ -347,6 +351,62 @@ MainActivity.OPTABLE.targeting().observe(getViewLifecycleOwner(), result -> {
347
351
348
352
Working examples are available in the Kotlin and Java SDK demo applications.
349
353
354
+
## Identifying visitors arriving from Email newsletters
355
+
356
+
If you send Email newsletters that contain links to your application (e.g., deep links), then you may want to automatically _identify_ visitors that have clicked on any such links via their Email address. Incoming application traffic which is originating from a subscriber click on a link in a newsletter is considered to be implicitly authenticated by the recipient of the Email, therefore serving as an excellent source of linking of online user identities.
357
+
358
+
### Insert oeid into your Email newsletter template
359
+
360
+
To enable automatic identification of visitors originating from your Email newsletter, you first need to include an **oeid** parameter in the query string of all links to your website in your Email newsletter template. The value of the **oeid** parameter should be set to the SHA256 hash of the lowercased Email address of the recipient. For example, if you are using [Braze](https://www.braze.com/) to send your newsletters, you can easily encode the SHA256 hash value of the recipient's Email address by setting the **oeid** parameter in the query string of any links to your application as follows:
361
+
362
+
```
363
+
oeid={{${email_address} | downcase | sha2}}
364
+
```
365
+
366
+
The above example uses various personalization tags as documented in [Braze's user guide](https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/) to dynamically insert the required data into an **oeid** parameter, all of which should make up a _part_ of the destination URL in your template.
367
+
368
+
### Capture clicks on deep links in your application
369
+
370
+
In order for your application to open on devices where it is installed when a link to your domain is clicked, you need to [configure and prepare your application to handle deep links](https://developer.android.com/training/app-links/deep-linking) first.
371
+
372
+
### Call tryIdentifyFromURI SDK API
373
+
374
+
When Android launches your app after a user clicks on a link, it will start your app activity with your configured _intent filters_. You can then obtain the `Uri` of the link by calling `getData()`, and pass it to the SDK's `tryIdentifyFromURI()` API which will automatically look for `oeid` in the query parameters of the `Uri` and call `identify` with its value if found.
375
+
376
+
For example, you can call `getData()` on the incoming `Intent` from your `onCreate()` activity lifecycle callback as follows:
377
+
378
+
#### Kotlin
379
+
380
+
```kotlin
381
+
overridefunonCreate(savedInstanceState:Bundle?) {
382
+
super.onCreate(savedInstanceState)
383
+
setContentView(R.layout.main)
384
+
...
385
+
val data:Uri?= intent?.data
386
+
if (data !=null) {
387
+
MainActivity.OPTABLE!!.tryIdentifyFromURI(data)
388
+
}
389
+
...
390
+
}
391
+
```
392
+
393
+
#### Java
394
+
395
+
```java
396
+
@Override
397
+
publicvoid onCreate(Bundle savedInstanceState) {
398
+
super.onCreate(savedInstanceState);
399
+
setContentView(R.layout.main);
400
+
...
401
+
Intent intent = getIntent();
402
+
Uri data = intent.getData();
403
+
if (data !=null) {
404
+
MainActivity.OPTABLE.tryIdentifyFromURI(data);
405
+
}
406
+
...
407
+
}
408
+
```
409
+
350
410
## Demo Applications
351
411
352
412
The Kotlin and Java demo applications show a working example of `identify`, `targeting`, and `witness` APIs, as well as an integration with the [Google Ad Manager 360](https://admanager.google.com/home/) ad server, enabling the targeting of ads served by GAM360 to audiences activated in the [Optable](https://optable.co/) sandbox.
val url ="http://some.domain.com/some/path?some=query&something=else&oeid=a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3&foo=bar&baz"
69
+
val expected ="e:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"
val url ="http://some.domain.com/some/path?some=query&something=else&oeid=AAAAAAAa665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3&foo=bar&baz"
val url ="http://some.domain.com/some/path?some=query&something=else&oEId=A665A45920422F9D417E4867EFDC4FB8A04A1F3FFF1FA07E998E86f7f7A27AE3&foo=bar&baz"
93
+
val expected ="e:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"
0 commit comments