From 5fafed9adb4b6ae7fdac22a8b6d9267848ae3af3 Mon Sep 17 00:00:00 2001 From: Zach Teutsch <88554871+zateutsch@users.noreply.github.com> Date: Tue, 21 Nov 2023 00:01:37 -0800 Subject: [PATCH 1/2] add referrer field to APIV2 analytics --- Report/index.ts | 3 +++ utils/analytics.ts | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Report/index.ts b/Report/index.ts index 6e83dcb..03cbaa3 100644 --- a/Report/index.ts +++ b/Report/index.ts @@ -51,6 +51,9 @@ const httpTrigger: AzureFunction = async function ( analyticsInfo.platformIdVersion = req.headers['platform-identifier-version']; analyticsInfo.correlationId = req.headers['correlation-id']; + analyticsInfo.properties = { + referrer: req.query.ref + }; await uploadToAppInsights(webAppReport, analyticsInfo); context.res = { diff --git a/utils/analytics.ts b/utils/analytics.ts index 1ecc514..b660fe0 100644 --- a/utils/analytics.ts +++ b/utils/analytics.ts @@ -79,7 +79,6 @@ export async function uploadToAppInsights( analyticsInfo: AnalyticsInfo ) { try { - analyticsInfo.properties = {}; if (webAppReport.artifacts.webAppManifest?.json) { const _manifest = webAppReport.artifacts.webAppManifest?.json; console.log(_manifest); From c39ac5f9f7c980c7c7a95b82a0e4c7c9ac01737f Mon Sep 17 00:00:00 2001 From: Zach Teutsch <88554871+zateutsch@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:08:38 -0800 Subject: [PATCH 2/2] Update Report/index.ts --- Report/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Report/index.ts b/Report/index.ts index 03cbaa3..30151d6 100644 --- a/Report/index.ts +++ b/Report/index.ts @@ -51,9 +51,7 @@ const httpTrigger: AzureFunction = async function ( analyticsInfo.platformIdVersion = req.headers['platform-identifier-version']; analyticsInfo.correlationId = req.headers['correlation-id']; - analyticsInfo.properties = { - referrer: req.query.ref - }; + analyticsInfo.properties = req.query.ref ? { referrer: req.query.ref } : { }; await uploadToAppInsights(webAppReport, analyticsInfo); context.res = {