Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable8.5] clean up PageviewPerformanceData tick a bit #9608

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docfiles/pxtweb/cookieCompliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ namespace pxt {
return false;
}

if (envelope.baseType == "PageviewPerformanceData") {
const pageName = envelope.baseData.name;
envelope.baseData.name = window.location.origin;
if (!envelope.baseData.properties) {
envelope.baseData.properties = {};
}
envelope.baseData.properties.pageName = pageName;
// no url scrubbing for webapp (no share url, etc)
}

if (typeof pxtConfig === "undefined" || !pxtConfig) return true;

const telemetryItem = envelope.baseData;
Expand Down
17 changes: 16 additions & 1 deletion docfiles/tracking.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,25 @@
sdk.addTelemetryInitializer(function (envelope) {
// App Insights automatically sends a page view event on setup, but we send our own later with additional properties.
// This stops the automatic event from firing, so we don't end up with duplicate page view events.
if(envelope.baseType == "PageviewData" && !envelope.baseData.properties) {
if (envelope.baseType == "PageviewData" && !envelope.baseData.properties) {
return false;
}

if (envelope.baseType == "PageviewPerformanceData") {
var pageName = envelope.baseData.name;
envelope.baseData.name = window.location.origin;
if (!envelope.baseData.properties) {
envelope.baseData.properties = {};
}
envelope.baseData.properties.pageName = pageName;
var scrubbedUrl = scrubUrl(envelope.baseData.uri);
envelope.baseData.uri = scrubbedUrl;
if (envelope.ext && envelope.ext.trace) {
var toUrl = new URL(scrubbedUrl);
envelope.ext.trace.name = toUrl ? toUrl.pathname : "";
}
}

var telemetryItem = envelope.baseData;
telemetryItem.properties = telemetryItem.properties || {};
telemetryItem.properties["cookie"] = isProduction;
Expand Down
Loading