Skip to content

Commit aaeb72e

Browse files
committed
update migration guide
1 parent 8bf27ae commit aaeb72e

File tree

2 files changed

+18
-110
lines changed

2 files changed

+18
-110
lines changed

src/connections/sources/catalog/libraries/server/csharp/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Analytics for CSharp (C#)
2+
title: Analytics-CSharp (C#)
33
strat: csharp
44
id:
55
redirect_from:

src/connections/sources/catalog/libraries/server/csharp/migration-guide.md

Lines changed: 17 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Analytics for CSharp (C#) Migration Guide
2+
title: Analytics-CSharp (C#) Migration Guide
33
strat: csharp
44
---
55

@@ -8,10 +8,9 @@ If you’re using a different library, follow the steps below to migrate to the
88
> info ""
99
> 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"}.
1010
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.
1514

1615
<br> Before:
1716
```js
@@ -28,116 +27,25 @@ If you’re using a different library, follow the steps below to migrate to the
2827
dotnet add package Segment.Analytics.CSharp --version <VERSION>
2928
```
3029

31-
3. Modify your tracking methods.
32-
- Identify
30+
2. Replace namespaces.
3331

3432
<br> Before:
3533
```c#
36-
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;
4138
```
4239

4340
<br> After:
4441
```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;
5244
```
5345

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
13947

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.
14149

14250
<br> Before:
14351
```c#
@@ -147,11 +55,11 @@ If you’re using a different library, follow the steps below to migrate to the
14755
<br> After:
14856
```c#
14957
var configuration = new Configuration("YOUR WRITE KEY",
150-
userSynchronizeDispatcher: true);
58+
useSynchronizeDispatcher: true);
15159
var analytics = new Analytics(configuration);
15260
```
15361

154-
5. Review your anonymous ID settings.
62+
2. Review your anonymous ID settings.
15563

15664
<br> Before:
15765
```c#
@@ -165,7 +73,7 @@ If you’re using a different library, follow the steps below to migrate to the
16573
analytics.Reset();
16674
```
16775
168-
6. Change your nested properties settings.
76+
3. Change your nested properties settings.
16977
17078
<br> Before:
17179
```c#
@@ -218,7 +126,7 @@ If you’re using a different library, follow the steps below to migrate to the
218126
};
219127
```
220128
221-
7. Review your Flush settings.
129+
4. Review your Flush settings.
222130
223131
<br> Before:
224132
```c#

0 commit comments

Comments
 (0)