Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
khmyznikov committed Nov 30, 2023
2 parents a3e059d + 2b4b3d6 commit 00fc3c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const httpTrigger: AzureFunction = async function (
analyticsInfo.platformIdVersion =
req.headers['platform-identifier-version'];
analyticsInfo.correlationId = req.headers['correlation-id'];
analyticsInfo.properties = req.query.ref ? { referrer: req.query.ref } : { };
await uploadToAppInsights(webAppReport, analyticsInfo);

context.res = {
Expand Down
5 changes: 4 additions & 1 deletion utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export async function uploadToAppInsights(
analyticsInfo: AnalyticsInfo
) {
try {
analyticsInfo.properties = {};
if (webAppReport.artifacts.webAppManifest?.json) {
const _manifest = webAppReport.artifacts.webAppManifest?.json;
console.log(_manifest);
analyticsInfo.properties.hasManifest = true;
analyticsInfo.properties.name =
(_manifest['name'] != undefined &&
(await validateSingleField('name', _manifest['name'])).valid) ||
Expand Down Expand Up @@ -189,6 +189,9 @@ export async function uploadToAppInsights(
(await validateSingleField('icons', _manifest['icons'])).valid) ||
false;
}
else {
analyticsInfo.properties.hasManifest = false;
}
if (webAppReport.audits.serviceWorker) {
analyticsInfo.properties.hasServiceWorker =
webAppReport.audits.serviceWorker.score;
Expand Down

0 comments on commit 00fc3c9

Please sign in to comment.