Skip to content

Commit b699abc

Browse files
niallzatoNiall Brennansanscontext
authored
Add docs for setting anonymous id (#1447)
* add docs for setting anonymous id * add docs for setting anonymous id * Update src/connections/sources/catalog/libraries/mobile/android/index.md Co-authored-by: Niall Brennan <[email protected]> Co-authored-by: LRubin <[email protected]>
1 parent a962b4a commit b699abc

File tree

1 file changed

+16
-0
lines changed
  • src/connections/sources/catalog/libraries/mobile/android

1 file changed

+16
-0
lines changed

src/connections/sources/catalog/libraries/mobile/android/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,22 @@ Analytics.with(context).identify("a user's id", Traits().putName("John Doe"), nu
236236
{% endcodeexampletab %}
237237
{% endcodeexample %}
238238

239+
The example call below sets the `anonymousId` to a custom value of `test_anonymousId`.
240+
241+
{% codeexample %}
242+
{% codeexampletab Java %}
243+
```java
244+
Analytics.with(context).identify(new Traits().putValue("anonymousId","test_anonymousId"));
245+
```
246+
{% endcodeexampletab %}
247+
248+
{% codeexampletab Kotlin %}
249+
```kotlin
250+
Analytics.with(context).identify(Traits().putValue("anonymousId","test_anonymousId"))
251+
```
252+
{% endcodeexampletab %}
253+
{% endcodeexample %}
254+
239255
Segment recommends that you make an Identify call once when the user's first creates an account, and only using the Identify call later when their traits change. Segment remembers the previous userIDs and merges the new traits with the old ones.
240256

241257
{% codeexample %}

0 commit comments

Comments
 (0)