From 2756307051c88a54158f6ba3a21522be6d9a57c7 Mon Sep 17 00:00:00 2001 From: alaamegahed Date: Thu, 9 Jan 2025 15:51:34 +0200 Subject: [PATCH] send application platform in envelope --- lerna.json | 2 +- package.json | 2 +- packages/clarity-decode/package.json | 4 ++-- packages/clarity-decode/src/data.ts | 3 ++- packages/clarity-devtools/package.json | 8 ++++---- packages/clarity-devtools/static/manifest.json | 4 ++-- packages/clarity-js/package.json | 2 +- packages/clarity-js/src/data/envelope.ts | 5 ++++- packages/clarity-js/types/data.d.ts | 8 ++++++++ packages/clarity-visualize/package.json | 2 +- 10 files changed, 26 insertions(+), 14 deletions(-) diff --git a/lerna.json b/lerna.json index 3fcb3256..c1f0f50f 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "0.7.60", + "version": "0.7.61", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 5f284edc..3d31f4e7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "clarity", "private": true, - "version": "0.7.60", + "version": "0.7.61", "repository": "https://github.com/microsoft/clarity.git", "author": "Sarvesh Nagpal ", "license": "MIT", diff --git a/packages/clarity-decode/package.json b/packages/clarity-decode/package.json index 33878d4e..c5c4bd4a 100644 --- a/packages/clarity-decode/package.json +++ b/packages/clarity-decode/package.json @@ -1,6 +1,6 @@ { "name": "clarity-decode", - "version": "0.7.60", + "version": "0.7.61", "description": "An analytics library that uses web page interactions to generate aggregated insights", "author": "Microsoft Corp.", "license": "MIT", @@ -26,7 +26,7 @@ "url": "https://github.com/Microsoft/clarity/issues" }, "dependencies": { - "clarity-js": "^0.7.60" + "clarity-js": "^0.7.61" }, "devDependencies": { "@rollup/plugin-commonjs": "^24.0.0", diff --git a/packages/clarity-decode/src/data.ts b/packages/clarity-decode/src/data.ts index 5042d48c..edec4d7a 100644 --- a/packages/clarity-decode/src/data.ts +++ b/packages/clarity-decode/src/data.ts @@ -103,6 +103,7 @@ export function envelope(tokens: Data.Token[]): Data.Envelope { pageNum: tokens[7] as number, upload: tokens[8] as Data.Upload, end: tokens[9] as Data.BooleanFlag, - url: tokens[10] as string + applicationPlatform: tokens[10] as Data.ApplicationPlatform, + url: tokens[11] as string }; } diff --git a/packages/clarity-devtools/package.json b/packages/clarity-devtools/package.json index a16d84f6..e22884c6 100644 --- a/packages/clarity-devtools/package.json +++ b/packages/clarity-devtools/package.json @@ -1,6 +1,6 @@ { "name": "clarity-devtools", - "version": "0.7.60", + "version": "0.7.61", "private": true, "description": "Adds Clarity debugging support to browser devtools", "author": "Microsoft Corp.", @@ -24,9 +24,9 @@ "url": "https://github.com/Microsoft/clarity/issues" }, "dependencies": { - "clarity-decode": "^0.7.60", - "clarity-js": "^0.7.60", - "clarity-visualize": "^0.7.60" + "clarity-decode": "^0.7.61", + "clarity-js": "^0.7.61", + "clarity-visualize": "^0.7.61" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.0", diff --git a/packages/clarity-devtools/static/manifest.json b/packages/clarity-devtools/static/manifest.json index f2238dad..566ca934 100644 --- a/packages/clarity-devtools/static/manifest.json +++ b/packages/clarity-devtools/static/manifest.json @@ -2,8 +2,8 @@ "manifest_version": 2, "name": "Microsoft Clarity Developer Tools", "description": "Clarity helps you understand how users are interacting with your website.", - "version": "0.7.60", - "version_name": "0.7.60", + "version": "0.7.61", + "version_name": "0.7.61", "minimum_chrome_version": "50", "devtools_page": "devtools.html", "icons": { diff --git a/packages/clarity-js/package.json b/packages/clarity-js/package.json index 7428778c..62320f71 100644 --- a/packages/clarity-js/package.json +++ b/packages/clarity-js/package.json @@ -1,6 +1,6 @@ { "name": "clarity-js", - "version": "0.7.60", + "version": "0.7.61", "description": "An analytics library that uses web page interactions to generate aggregated insights", "author": "Microsoft Corp.", "license": "MIT", diff --git a/packages/clarity-js/src/data/envelope.ts b/packages/clarity-js/src/data/envelope.ts index e26ee38d..e8e7d411 100644 --- a/packages/clarity-js/src/data/envelope.ts +++ b/packages/clarity-js/src/data/envelope.ts @@ -1,4 +1,4 @@ -import { BooleanFlag, Token, Upload, Envelope } from "@clarity-types/data"; +import { BooleanFlag, Token, Upload, Envelope, ApplicationPlatform } from "@clarity-types/data"; import { time } from "@src/core/time"; import version from "@src/core/version"; import * as metadata from "@src/data/metadata"; @@ -19,6 +19,7 @@ export function start(): void { pageNum: m.pageNum, upload: Upload.Async, end: BooleanFlag.False, + applicationPlatform: ApplicationPlatform.WebApp, url: '' }; } @@ -33,6 +34,7 @@ export function envelope(last: boolean): Token[] { data.sequence++; data.upload = last && "sendBeacon" in navigator ? Upload.Beacon : Upload.Async; data.end = last ? BooleanFlag.True : BooleanFlag.False; + data.applicationPlatform = ApplicationPlatform.WebApp; data.url = scrub.url(location.href, false, true); return [ data.version, @@ -45,6 +47,7 @@ export function envelope(last: boolean): Token[] { data.pageNum, data.upload, data.end, + data.applicationPlatform, data.url ]; } diff --git a/packages/clarity-js/types/data.d.ts b/packages/clarity-js/types/data.d.ts index 2c7e89d8..0fedaed1 100644 --- a/packages/clarity-js/types/data.d.ts +++ b/packages/clarity-js/types/data.d.ts @@ -211,6 +211,12 @@ export const enum Upload { Beacon = 1 } +export const enum ApplicationPlatform { + WebApp = 0, + AndroidApp = 1, + IOSApp = 2 +} + export const enum BooleanFlag { False = 0, True = 1 @@ -346,6 +352,7 @@ export const enum XMLReadyState { Done = 4 } + /* Helper Interfaces */ export interface Payload { @@ -390,6 +397,7 @@ export interface Envelope extends Metadata { version: string; upload: Upload; end: BooleanFlag; + applicationPlatform: ApplicationPlatform; url: string; } diff --git a/packages/clarity-visualize/package.json b/packages/clarity-visualize/package.json index abeb0a38..0909a995 100644 --- a/packages/clarity-visualize/package.json +++ b/packages/clarity-visualize/package.json @@ -1,6 +1,6 @@ { "name": "clarity-visualize", - "version": "0.7.60", + "version": "0.7.61", "description": "An analytics library that uses web page interactions to generate aggregated insights", "author": "Microsoft Corp.", "license": "MIT",