Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde5e954

Browse files
committed
update migration guide
1 parentce5c0c0 commitde5e954

File tree

1 file changed

+9
-69
lines changed

1 file changed

+9
-69
lines changed

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

Lines changed: 9 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ title: Analytics-CSharp (C#) Migration Guide
33
strat:csharp
44
---
55

6-
If you’re using a different library, follow the steps below to migrate to the[Analytics-CSharp library](/docs/connections/sources/catalog/libraries/server/csharp/).
6+
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/).
7+
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
712

813

914
##Start the Migration
@@ -61,78 +66,13 @@ If you’re using a different library, follow the steps below to migrate to the
6166

6267
<br> Before:
6368
```c#
64-
Analytics.Initialize("YOUR_WRITE_KEY", new Config().SetAsync(false));
69+
Analytics.Client.Page(null, "Login", new Properties(), new Options()
70+
.SetAnonymousId("some-id"));
6571
```
6672

6773
ThenewSDK by default, generates an AnonymousIDfor youif you never call`analytics.Identify`.If you've called `Identify` and want to go back to anonymous, try:
6874
6975
<br> After:
7076
```c#
7177
analytics.Reset();
72-
```
73-
74-
3. Change your nested properties settings.
75-
76-
<br> Before:
77-
```c#
78-
Analytics.Client.Identify("hj2kf92ds212", new Traits() {
79-
{ "email", "tom@example.com" },
80-
{ "name", "Tom Smykowski" },
81-
{ "address", new Dict() {
82-
{ "street", "123 Fake Street" },
83-
{ "city", "Boston" }
84-
}}
85-
});
86-
```
87-
88-
<br> After:
89-
```c#
90-
// compatbile with the old way
91-
analytics.Identify("hj2kf92ds212", new JsonObject()
92-
{
93-
{ "email", "tom@example.com" },
94-
{ "name", "Tom Smykowski" },
95-
{ "address", new JsonObject() {
96-
{ "street", "123 Fake Street" },
97-
{ "city", "Boston" }
98-
}}
99-
});
100-
```
101-
102-
The new SDK internally implements a flexible JSON builder (Serialization.NET), that allows you build a complex JSON payload:
103-
104-
```c#
105-
var jsonObject = new JsonObject
106-
{
107-
["int"] = 1,
108-
["float"] = 1f,
109-
["long"] = 1L,
110-
["double"] = 1.0,
111-
["string"] = "1",
112-
["bool"] = true,
113-
["object"] = new JsonObject
114-
{
115-
["another object"] = "obj"
116-
},
117-
["array"] = new JsonArray
118-
{
119-
1, 1f, 1L, 1.0, "1", true, new JsonObject
120-
{
121-
["object in array"] = "obj"
122-
}
123-
}
124-
};
125-
```
126-
127-
4. Review your Flush settings.
128-
129-
<br> Before:
130-
```c#
131-
Analytics.Client.Flush();
132-
```
133-
134-
<br> After:
135-
```c#
136-
analytics.Flush();
137-
```
138-
78+
```

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp