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
Copy file name to clipboardExpand all lines: README.md
+41-20Lines changed: 41 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -67,14 +67,16 @@ _Note: when sending an empty value (`""`) as value for a property, the property
67
67
68
68
```ts
69
69
awaitclient.upsertUser({
70
-
//required
70
+
//Must provide either an email or userId or both
71
71
userId: "userId", // Unique identifier for the user in your database
72
-
email: "name@domain.tld",
72
+
email: "john@doe.tld",
73
73
74
74
// optional
75
75
properties: {
76
+
full_name: "John Doe",
77
+
first_name: "John",
78
+
last_name: "Doe",
76
79
age: 26,
77
-
name: "John Doe",
78
80
is_developer: true,
79
81
registered_at: newDate(/* ... */),
80
82
this_property_will_be_deleted: "",
@@ -88,33 +90,39 @@ _Note: when sending an empty value (`""`) as value for a property, the property
88
90
89
91
```ts
90
92
awaitclient.upsertAccount({
91
-
//required
93
+
//Must provide either an domain or accountId or both
92
94
accountId: "accountId", // Unique identifier for the account in your database
93
-
name: "journy.io",
95
+
domain: "acme-inc.com",
94
96
95
97
// optional
96
98
properties: {
97
-
age: 26,
98
-
name: "John Doe",
99
-
is_developer: true,
99
+
name: "ACME, Inc",
100
+
total_amount_of_users: 53,
101
+
is_paying_account: true,
100
102
registered_at: newDate(/* ... */),
101
103
this_property_will_be_deleted: "",
102
104
},
103
105
104
106
// optional
105
-
members: ["userId", "userId"], // Unique identifier for the user in your database
107
+
members: [
108
+
{ userId: "userId" }, // userID: Unique identifier for the user in your database
109
+
{ userId: "userId" }
110
+
]
106
111
});
107
112
```
108
113
109
-
#### Link web visitor to an app user
114
+
#### Link web activity to a user
110
115
111
-
You can link a web visitor to a user in your application when you have our snippet installed on your website. The snippet sets a cookie named `__journey`. If the cookie exists, you can link the web visitor to the user that is currently logged in:
116
+
You can link web activity to a user in your application when you have our snippet installed on your website. The snippet sets a cookie named `__journey`. If the cookie exists, you can link the web activity to the user that is currently logged in:
112
117
113
118
```ts
114
119
if (request.cookies["__journey"]) {
115
120
const result =awaitclient.link({
116
121
deviceId: request.cookies["__journey"],
122
+
117
123
userId: request.user.id, // Unique identifier for the user in your database
124
+
// or
125
+
email: request.user.email,
118
126
});
119
127
}
120
128
```
@@ -124,16 +132,29 @@ if (request.cookies["__journey"]) {
0 commit comments