Skip to content

Commit 1fd48bb

Browse files
authored
Merge pull request #5478 from segmentio/wenxi/csharp-migration-guide-improvoments
update migration guide
2 parents 1ed195a + 6e92d6b commit 1fd48bb

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
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
@@ -27,7 +27,7 @@ These platforms support Analytics-CSharp:
2727
## Getting started
2828

2929
> info ""
30-
> If you'd like to migrate to Analytics-CSharp from a different library, follow the steps in the [Analytics-CSharp migration guide](/docs/connections/sources/catalog/libraries/server/csharp/migration-guide/).
30+
> If you'd like to migrate to Analytics-CSharp from Analytics.NET or Analytics.Xamarin, follow the steps in the [Analytics-CSharp migration guide](/docs/connections/sources/catalog/libraries/server/csharp/migration-guide/).
3131
3232
To get started with the Analytics-CSharp library:
3333

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ strat: csharp
55

66
If you’re currently using Analytics.NET or Analytics.Xamarin to send data to Segment, please follow the steps below to migrate to the [Analytics-CSharp library](/docs/connections/sources/catalog/libraries/server/csharp/).
77

8-
You can update to Analytics-CSharp in 3 easy steps
9-
1. Bundle Analytics-CSharp into your app (and remove your previous SDK)
10-
2. Change the namespaces
11-
3. Advanced: Run Analytics in Synchronous Mode
8+
You can update to Analytics-CSharp in 3 steps:
9+
1. Bundle Analytics-CSharp into your app and remove your previous SDK.
10+
2. Change the namespaces.
11+
3. *(Optional)* Use `Reset` to stay anonymous.
1212

1313

14-
## Start the Migration
14+
## Migration steps
1515

1616
1. Add the Analytics-CSharp dependency to your project.
1717

@@ -46,33 +46,33 @@ You can update to Analytics-CSharp in 3 easy steps
4646
using Segment.Analytics.Compat;
4747
```
4848

49-
## Optional Changes
49+
3. *(Optional)* Update calls that resets the anonymous ID.
50+
51+
The old SDK requires you to provide the anonymous ID. The new SDK generates an Anonymous ID for you if you never call `analytics.Identify`. If you call `Identify` and want to go back to anonymous, the new SDK provides a `Reset` function to achieve that.
5052

51-
1. Change your development settings if you would like to make analytics run synchronously for testing purposes.
52-
53-
<br> Before:
54-
```c#
55-
Analytics.Initialize("YOUR_WRITE_KEY", new Config().SetAsync(false));
56-
```
53+
<br> Before:
54+
```c#
55+
Analytics.Client.Page(null, "Login", new Properties(), new Options()
56+
.SetAnonymousId("some-id"));
57+
```
5758

58-
<br> After:
59-
```c#
60-
var configuration = new Configuration("YOUR WRITE KEY",
61-
useSynchronizeDispatcher: true);
62-
var analytics = new Analytics(configuration);
63-
```
59+
<br> After:
60+
```c#
61+
analytics.Reset();
62+
```
6463

65-
2. Review your anonymous ID settings.
64+
## Optional changes for unit tests
6665

67-
<br> Before:
68-
```c#
69-
Analytics.Client.Page(null, "Login", new Properties(), new Options()
70-
.SetAnonymousId("some-id"));
71-
```
66+
Change your development settings if you would like to make analytics run synchronously for testing purposes.
7267

73-
The new SDK by default, generates an Anonymous ID for you if you never call `analytics.Identify`. If you've called `Identify` and want to go back to anonymous, try:
68+
<br> Before:
69+
```c#
70+
Analytics.Initialize("YOUR_WRITE_KEY", new Config().SetAsync(false));
71+
```
7472

75-
<br> After:
76-
```c#
77-
analytics.Reset();
78-
```
73+
<br> After:
74+
```c#
75+
var configuration = new Configuration("YOUR WRITE KEY",
76+
useSynchronizeDispatcher: true);
77+
var analytics = new Analytics(configuration);
78+
```

0 commit comments

Comments
 (0)