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
@@ -8,10 +8,9 @@ If you’re using a different library, follow the steps below to migrate to the
8
8
> info ""
9
9
> This library is currently in beta and is governed by Segment’s [First Access and Beta terms](https://www.twilio.com/legal/tos){:target="_blank"}.
10
10
11
-
1. Create a source in Segment. If you want to reuse your current source, skip to step 2.
12
-
1. Go to Connections > Sources > Add Source.
13
-
2. Search for *Xamarin, Unity* or *.NET* and click **Add source**. **Note:** There is no CSharp source. To use Analytics-CSharp, use either Xamarin, Unity, or .NET as your source.
14
-
2. Add the Analytics CSharp dependency to your project.
11
+
## Start the Migration
12
+
13
+
1. Add the Analytics-CSharp dependency to your project.
15
14
16
15
<br> Before:
17
16
```js
@@ -28,116 +27,25 @@ If you’re using a different library, follow the steps below to migrate to the
Analytics.Client.Identify("019mr8mf4r", new Traits() {
37
-
{ "name", "#{ user.name }" },
38
-
{ "email", "#{ user.email }" },
39
-
{ "friends", 29 }
40
-
});
34
+
using Segment;
35
+
using Segment.Flush;
36
+
using Segment.Model;
37
+
using Segment.Request;
41
38
```
42
39
43
40
<br> After:
44
41
```c#
45
-
// compatible with the old way
46
-
analytics.Identify("019mr8mf4r", new JsonObject()
47
-
{
48
-
{ "name", "#{ user.name }" },
49
-
{ "email", "#{ user.email }" },
50
-
{ "friends", 29 }
51
-
});
42
+
using Segment.Analytics;
43
+
using Segment.Analytics.Compat;
52
44
```
53
45
54
-
- Track
55
-
<br> Before:
56
-
```c#
57
-
Analytics.Client.Track("019mr8mf4r", "Item Purchased", new Properties() {
58
-
{ "revenue", 39.95 },
59
-
{ "shipping", "2-day" }
60
-
});
61
-
```
62
-
63
-
<br> After:
64
-
```c#
65
-
// compatible with the old way
66
-
analytics.Track("Item Purchased", new JsonObject()
67
-
{
68
-
{ "revenue", 39.95 },
69
-
{ "shipping", "2-day" }
70
-
});
71
-
```
72
-
**Note:** The Analytics-CSharp SDK remembers the identity info from the last identify call, so you don’t have to pass an identity every time. If you still want to identify on every track call, you can achieve it with Segment's plugin system.
73
-
74
-
- Page
75
-
<br> Before:
76
-
```c#
77
-
Analytics.Client.Page("019mr8mf4r", "Login", new Properties() {
78
-
{ "path", "/login" },
79
-
{ "title", "Initech Login" }
80
-
});
81
-
```
82
-
83
-
<br> After:
84
-
```c#
85
-
// compatible with the old way
86
-
analytics.Page("Login", new JsonObject()
87
-
{
88
-
{ "path", "/login" },
89
-
{ "title", "Initech Login" }
90
-
});
91
-
```
92
-
93
-
- Screen
94
-
<br> Before:
95
-
```c#
96
-
Analytics.Client.Screen("019mr8mf4r", "Register", new Properties() {
97
-
{ "type", "facebook" }
98
-
});
99
-
```
100
-
101
-
<br> After:
102
-
```c#
103
-
// compatible with the old way
104
-
analytics.Screen("Register", new JsonObject()
105
-
{
106
-
{ "type", "facebook" }
107
-
});
108
-
```
109
-
110
-
- Group
111
-
<br> Before:
112
-
```c#
113
-
Analytics.Client.Group("userId", "groupId", new Traits() {
114
-
{ "name", "Initech, Inc." },
115
-
{ "website", "http://www.example.com" }
116
-
});
117
-
```
118
-
119
-
<br> After:
120
-
```c#
121
-
// compatible with the old way
122
-
analytics.Group("groupId", new JsonObject()
123
-
{
124
-
{ "name", "Initech, Inc." },
125
-
{ "website", "http://www.example.com" }
126
-
});
127
-
```
128
-
129
-
- Alias
130
-
<br> Before:
131
-
```c#
132
-
Analytics.Client.Alias("previousId", "userId")
133
-
```
134
-
135
-
<br> After:
136
-
```c#
137
-
analytics.Alias("newId");
138
-
```
46
+
## Optional Changes
139
47
140
-
4. Change your development settings if you would like to make analytics run synchronously for testing purposes.
48
+
1. Change your development settings if you would like to make analytics run synchronously for testing purposes.
141
49
142
50
<br> Before:
143
51
```c#
@@ -147,11 +55,11 @@ If you’re using a different library, follow the steps below to migrate to the
147
55
<br> After:
148
56
```c#
149
57
var configuration = new Configuration("YOUR WRITE KEY",
150
-
userSynchronizeDispatcher: true);
58
+
useSynchronizeDispatcher: true);
151
59
var analytics = new Analytics(configuration);
152
60
```
153
61
154
-
5. Review your anonymous ID settings.
62
+
2. Review your anonymous ID settings.
155
63
156
64
<br> Before:
157
65
```c#
@@ -165,7 +73,7 @@ If you’re using a different library, follow the steps below to migrate to the
165
73
analytics.Reset();
166
74
```
167
75
168
-
6. Change your nested properties settings.
76
+
3. Change your nested properties settings.
169
77
170
78
<br> Before:
171
79
```c#
@@ -218,7 +126,7 @@ If you’re using a different library, follow the steps below to migrate to the
0 commit comments