@vllnt/analytics 0.1.1 → 0.2.0-canary.7824f2c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +99 -61
- package/dist/analytics-DdAxcZwX.d.cts +166 -0
- package/dist/analytics-DdAxcZwX.d.ts +166 -0
- package/dist/chunk-6RHY2BTB.js +256 -0
- package/dist/chunk-MVOBIOKZ.cjs +256 -0
- package/dist/index.cjs +62 -0
- package/dist/index.d.cts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +62 -0
- package/dist/react.cjs +166 -0
- package/dist/react.d.cts +33 -0
- package/dist/react.d.ts +33 -0
- package/dist/react.js +166 -0
- package/docs/API.md +384 -0
- package/llms.txt +56 -0
- package/package.json +56 -35
- package/src/analytics.ts +12 -35
- package/src/consent.ts +5 -1
package/src/consent.ts
CHANGED
|
@@ -169,7 +169,11 @@ export function isDoNotTrackEnabled(): boolean {
|
|
|
169
169
|
* Get consent from cookie (for SSR)
|
|
170
170
|
*/
|
|
171
171
|
export function getConsentFromCookie(cookieString: string): boolean | null {
|
|
172
|
-
|
|
172
|
+
// Anchor to the start of the string or a cookie separator so that
|
|
173
|
+
// look-alike names such as "evil-vllnt-consent" are not matched.
|
|
174
|
+
const match = new RegExp(`(?:^|;\\s*)${CONSENT_COOKIE_NAME}=([^;]+)`).exec(
|
|
175
|
+
cookieString,
|
|
176
|
+
);
|
|
173
177
|
if (!match) return null;
|
|
174
178
|
return match[1] === "1";
|
|
175
179
|
}
|