diff --git a/lib/core/SessionBuilder.js b/lib/core/SessionBuilder.js index 0f2103a2..e6ec0890 100644 --- a/lib/core/SessionBuilder.js +++ b/lib/core/SessionBuilder.js @@ -44,7 +44,7 @@ class SessionBuilder { const user_agent = new UserAgent({ deviceCategory: 'desktop' }); const id = Utils.generateRandomString(11); - const timestamp = new Date().getTime(); + const timestamp = Math.floor(Date.now() / 1000); const visitor_data = Proto.encodeVisitorData(id, timestamp); diff --git a/lib/proto/index.js b/lib/proto/index.js index 9fe87e82..cf96d8b8 100644 --- a/lib/proto/index.js +++ b/lib/proto/index.js @@ -13,7 +13,7 @@ class Proto { */ static encodeVisitorData(id, timestamp) { const buf = messages.VisitorData.encode({ id, timestamp }); - return encodeURIComponent(Buffer.from(buf).toString('base64')); + return encodeURIComponent(Buffer.from(buf).toString('base64').replace(/\//g, '_')); } /**