From 69e0bb967430d9656cf8aa786982ac5e1ffacd58 Mon Sep 17 00:00:00 2001 From: Niall Brennan Date: Thu, 4 Mar 2021 15:05:05 +0000 Subject: [PATCH 1/3] add docs for setting anonymous id --- .../catalog/libraries/mobile/android/index.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/connections/sources/catalog/libraries/mobile/android/index.md b/src/connections/sources/catalog/libraries/mobile/android/index.md index 38bd082cc5..298d67e502 100644 --- a/src/connections/sources/catalog/libraries/mobile/android/index.md +++ b/src/connections/sources/catalog/libraries/mobile/android/index.md @@ -236,6 +236,22 @@ Analytics.with(context).identify("a user's id", Traits().putName("John Doe"), nu {% endcodeexampletab %} {% endcodeexample %} +Example call to set the anonymousId to a custom value: + +{% codeexample %} +{% codeexampletab Java %} +```java +Analytics.with(context).identify(new Traits().putValue("anonymousId","test_anonymousId")); +``` +{% endcodeexampletab %} + +{% codeexampletab Kotlin %} +```kotlin +Analytics.with(context).identify(Traits().putValue("anonymousId","test_anonymousId")) +``` +{% endcodeexampletab %} +{% endcodeexample %} + 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. {% codeexample %} @@ -736,6 +752,7 @@ Analytics.with(context).analyticsContext().traits().anonymousId() {% endcodeexampletab %} {% endcodeexample %} + ### Reset The `reset` method clears the SDK's internal stores for the current user and group. This is useful for apps where users log in and out with different identities on the same device over time. From 36771557a1d0369ce5b94ceb3e2c0c6df224f6ad Mon Sep 17 00:00:00 2001 From: Niall Brennan Date: Thu, 4 Mar 2021 15:06:33 +0000 Subject: [PATCH 2/3] add docs for setting anonymous id --- .../sources/catalog/libraries/mobile/android/index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/connections/sources/catalog/libraries/mobile/android/index.md b/src/connections/sources/catalog/libraries/mobile/android/index.md index 298d67e502..a2ac269c52 100644 --- a/src/connections/sources/catalog/libraries/mobile/android/index.md +++ b/src/connections/sources/catalog/libraries/mobile/android/index.md @@ -752,7 +752,6 @@ Analytics.with(context).analyticsContext().traits().anonymousId() {% endcodeexampletab %} {% endcodeexample %} - ### Reset The `reset` method clears the SDK's internal stores for the current user and group. This is useful for apps where users log in and out with different identities on the same device over time. From 96f0355399df8076ad81cecac5f82d9b86a57094 Mon Sep 17 00:00:00 2001 From: LRubin Date: Fri, 5 Mar 2021 10:55:01 -0800 Subject: [PATCH 3/3] Update src/connections/sources/catalog/libraries/mobile/android/index.md --- .../sources/catalog/libraries/mobile/android/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/sources/catalog/libraries/mobile/android/index.md b/src/connections/sources/catalog/libraries/mobile/android/index.md index a2ac269c52..9f1da81a5d 100644 --- a/src/connections/sources/catalog/libraries/mobile/android/index.md +++ b/src/connections/sources/catalog/libraries/mobile/android/index.md @@ -236,7 +236,7 @@ Analytics.with(context).identify("a user's id", Traits().putName("John Doe"), nu {% endcodeexampletab %} {% endcodeexample %} -Example call to set the anonymousId to a custom value: +The example call below sets the `anonymousId` to a custom value of `test_anonymousId`. {% codeexample %} {% codeexampletab Java %}