diff --git a/CHANGELOG.md b/CHANGELOG.md index cba704e..8fe8fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,12 @@ # Changelog +## 6.12.1 +### Fixes +- [browser] Fix cookies expiration date being expanded when using consent without specifying storageMode +- [browser] Cookie `_pcus` being created by mistake + +### Changes +- [browser] `cookie_creation_date` is now anonymized (time set to 0) + ## 6.12.0 ### New diff --git a/package.json b/package.json index 1767781..6a9ca9e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "piano-analytics-js", "description": "JavaScript library for Piano Analytics", - "version": "6.12.0", + "version": "6.12.1", "main": "dist/browserless/piano-analytics.cjs.js", "module": "dist/browserless/piano-analytics.esm.js", "browser": "dist/browser/piano-analytics.umd.js", diff --git a/src/config.js b/src/config.js index bba3695..5347d37 100644 --- a/src/config.js +++ b/src/config.js @@ -23,7 +23,7 @@ export default { ], 'storageVisitor': 'pa_vid', 'storageUser': 'pa_user', - 'version': '6.12.0', + 'version': '6.12.1', 'minHeartbeat': 5, 'minBufferingHeartbeat': 1, 'queueVarName': '_paq', diff --git a/src/core/PianoAnalytics.js b/src/core/PianoAnalytics.js index 1d3e011..c699d69 100644 --- a/src/core/PianoAnalytics.js +++ b/src/core/PianoAnalytics.js @@ -58,8 +58,17 @@ function _initPrivacy(pa) { storageMode: 'fixed' } }; - } else if (window.pdl && window.pdl.requireConsent) { - pa.setConfiguration('isLegacyPrivacy', false); + } else { + if (window.pdl.requireConsent) { + pa.setConfiguration('isLegacyPrivacy', false); + } + if (typeof window.pdl.cookies === 'undefined') { + window.pdl.cookies = { + storageMode: 'fixed' + }; + } else if (window.pdl.cookies && typeof window.pdl.cookies.storageMode === 'undefined') { + window.pdl.cookies.storageMode = 'fixed'; + } } dataLayer.init({ cookieDefault: { diff --git a/src/core/steps/metadata.step.js b/src/core/steps/metadata.step.js index c815256..753ab7d 100644 --- a/src/core/steps/metadata.step.js +++ b/src/core/steps/metadata.step.js @@ -51,7 +51,7 @@ function metadataStep(pa, model, nextSteps) { } try { - const cookieCreationDate = new Date(dataLayer.cookies._pcid.fixedAt[0]).toISOString(); + const cookieCreationDate = new Date((new Date(dataLayer.cookies._pcid.fixedAt[0])).setUTCHours(0, 0, 0, 0)).toISOString(); for (const event of model.events) { if (_isPropertiesAbsentForEvent('cookie_creation_date', model, event)) { model.setProperty('cookie_creation_date', cookieCreationDate);