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

Commite0339ac

Browse files
committed
Add AJS Storage Priority Config
1 parent9d45e35 commite0339ac

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

‎src/connections/sources/catalog/libraries/website/javascript/cookie-validity-update.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,38 @@ To access or assign a value to a cookie outside of the standard Segment methods
139139
|`user traits`|`ajs_user_traits`|`analytics.user().traits();`|`window.localStorage.ajs_user_traits`|`analytics.user().traits({firstName:'Jane'});`|`analytics.user().traits({});`|
140140
|`groupId`|`ajs_group_id`|`analytics.group().id();`|`window.localStorage.ajs_group_id`|`analytics.group().id('777-qwe-098');`|`analytics.group().id('');`|
141141
|`group traits`|`ajs_group_properties`|`analytics.group().traits()`|`window.localStorage.ajs_group_properties`|`analytics.group().traits({name:'Segment'})`|`analytics.group().traits({})`|
142+
143+
##Storage Priority
144+
145+
By default Analytics.js uses`localStorage` as its preferred storage location, with Cookies as a fallback when`localStorage` is not available or not populated. An in-memory storage is used as a last fallback if all the previous ones are disabled.
146+
147+
Default Storage Priority:
148+
149+
```md
150+
LocalStorage -> Cookie -> InMemory
151+
```
152+
153+
Some scenarios might require to switch the priority of the storage systems.
154+
155+
- Apps that move the user across different subdomains
156+
- Apps where the server needs control over the user data
157+
- User Consent
158+
- Availability
159+
160+
The storage priority can be configured in the Analytics.js client using the`storage` property either globally or only for user or group data.
161+
162+
The`storage` property accepts an array of supported storage names (`localStorage`,`cookie`,`memory`) to be used in the priority order of the array.
163+
164+
```js
165+
analytics.load('writeKey', {
166+
// Global Storage Priority: Both User and Group data
167+
storage: ['cookie','localStorage','memory']
168+
// Specific Storage Priority
169+
user: {
170+
storage: ['cookie','localStorage','memory']
171+
},
172+
group: {
173+
storage: ['cookie','localStorage','memory']
174+
},
175+
}
176+
```

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp