@@ -535,7 +535,7 @@ analyticsContext.putValue(...).putReferrer(...).putCampaign(...);
535
535
536
536
{% codeexampletab Kotlin %}
537
537
``` kotlin
538
- val analyticsContext = Analytics .with (context).getAnalyticsContext ()
538
+ val analyticsContext = Analytics .with (context).analyticsContext ()
539
539
analyticsContext.putValue(.. .).putReferrer(.. .).putCampaign(.. .)
540
540
```
541
541
{% endcodeexampletab %}
@@ -555,7 +555,7 @@ analyticsContext.device().putValue("advertisingId", "1");
555
555
556
556
{% codeexampletab Kotlin %}
557
557
``` kotlin
558
- val analyticsContext = Analytics .with (context).getAnalyticsContext ()
558
+ val analyticsContext = Analytics .with (context).analyticsContext ()
559
559
analyticsContext.device().putValue(" advertisingId" , " 1" )
560
560
```
561
561
{% endcodeexampletab %}
@@ -567,15 +567,15 @@ To opt out of automatic data collection, clear the context after initializing th
567
567
{% codeexampletab Java %}
568
568
``` java
569
569
Analytics analytics = new Analytics .Builder (context, writeKey). defaultOptions(defaultOptions). build();
570
- AnalyticsContext context = analytics . getContext ();
570
+ AnalyticsContext context = getAnalyticsContext ();
571
571
context. clear();
572
572
```
573
573
{% endcodeexampletab %}
574
574
575
575
{% codeexampletab Kotlin %}
576
576
``` kotlin
577
577
val analytics = Analytics .Builder (context, writeKey).defaultOptions(defaultOptions).build()
578
- val context = analytics.getContext ()
578
+ val context = analytics.analyticsContext ()
579
579
context.clear()
580
580
```
581
581
{% endcodeexampletab %}
@@ -731,7 +731,7 @@ Analytics.with(context).getAnalyticsContext().traits().anonymousId();
731
731
732
732
{% codeexampletab Kotlin %}
733
733
``` kotlin
734
- Analytics .with (context).getAnalyticsContext ().traits().anonymousId()
734
+ Analytics .with (context).analyticsContext ().traits().anonymousId()
735
735
```
736
736
{% endcodeexampletab %}
737
737
{% endcodeexample %}
@@ -776,7 +776,7 @@ log(snapshot.flushCount);
776
776
777
777
{% codeexampletab Kotlin %}
778
778
``` kotlin
779
- val snapshot = Analytics .with (context).getSnapshot ()
779
+ val snapshot = Analytics .with (context).snapshot ()
780
780
log(snapshot.integrationOperationAverageDuration)
781
781
log(snapshot.flushCount)
782
782
```
@@ -818,17 +818,13 @@ Depending on the audience for your app (for example, children) or the countries
818
818
{% codeexample %}
819
819
{% codeexampletab Java %}
820
820
``` java
821
- public void optOut(boolean optOut) {
822
- this . optOut. set(optOut);
823
- }
821
+ Analytics . with(this ). optOut(true );
824
822
```
825
823
{% endcodeexampletab %}
826
824
827
825
{% codeexampletab Kotlin %}
828
826
``` kotlin
829
- fun optOut (optOut : Boolean ) {
830
- optOut to optOut
831
- }
827
+ Analytics .with (this ).optOut(true )
832
828
```
833
829
{% endcodeexampletab %}
834
830
{% endcodeexample %}
@@ -882,13 +878,6 @@ import com.segment.analytics.Analytics
882
878
import com.segment.analytics.Properties
883
879
import com.segment.analytics.Properties.Product
884
880
885
- // initialize product variables
886
- lateinit var id: String
887
- lateinit var orderId: String
888
- lateinit var sku: String
889
- var price = 0.0
890
- var revenue = 0.0
891
-
892
881
// initialize a new properties object
893
882
val properties = Properties ();
894
883
0 commit comments