Skip to content

Commit

Permalink
Merge pull request #158 from duckduckgo/shane/alt-flow-telemetry
Browse files Browse the repository at this point in the history
send telemetry when 'skip' is clicked in alternative flow
  • Loading branch information
shakyShane authored Jun 18, 2024
2 parents ff482d6 + 2964e54 commit 924a80e
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 15 deletions.
19 changes: 16 additions & 3 deletions build/app/public/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4577,7 +4577,7 @@
});

// schema/__generated__/schema.parsers.mjs
var protectionsDisabledReasonSchema, ownedByFirstPartyReasonSchema, ruleExceptionReasonSchema, adClickAttributionReasonSchema, otherThirdPartyRequestReasonSchema, screenKindSchema, wvVersionTitleSchema, requestsTitleSchema, featuresTitleSchema, appVersionTitleSchema, atbTitleSchema, errorDescriptionsTitleSchema, extensionVersionTitleSchema, httpErrorCodesTitleSchema, lastSentDayTitleSchema, deviceTitleSchema, osTitleSchema, listVersionsTitleSchema, reportFlowTitleSchema, siteUrlTitleSchema, didOpenReportInfoTitleSchema, toggleReportCounterTitleSchema, openerContextTitleSchema, userRefreshCountTitleSchema, jsPerformanceTitleSchema, stateBlockedSchema, stateAllowedSchema, extensionMessageGetPrivacyDashboardDataSchema, emailProtectionUserDataSchema, protectionsStatusSchema, localeSettingsSchema, parentEntitySchema, fireButtonSchema, searchSchema, breakageReportRequestSchema, setListOptionsSchema, windowsIncomingVisibilitySchema, cookiePromptManagementStatusSchema, refreshAliasResponseSchema, extensionMessageSetListOptionsSchema, fireOptionSchema, primaryScreenSchema, eventOriginSchema, siteUrlAdditionalDataSchema, closeMessageParamsSchema, categoryTypeSelectedSchema, categorySelectedSchema, dataItemIdSchema, detectedRequestSchema, tabSchema, breakageReportSchema, fireButtonDataSchema, remoteFeatureSettingsSchema, setProtectionParamsSchema, toggleReportScreenDataItemSchema, telemetrySpanSchema, requestDataSchema, getPrivacyDashboardDataSchema, windowsViewModelSchema, toggleReportScreenSchema, windowsIncomingViewModelSchema, windowsIncomingMessageSchema, apiSchema;
var protectionsDisabledReasonSchema, ownedByFirstPartyReasonSchema, ruleExceptionReasonSchema, adClickAttributionReasonSchema, otherThirdPartyRequestReasonSchema, screenKindSchema, wvVersionTitleSchema, requestsTitleSchema, featuresTitleSchema, appVersionTitleSchema, atbTitleSchema, errorDescriptionsTitleSchema, extensionVersionTitleSchema, httpErrorCodesTitleSchema, lastSentDayTitleSchema, deviceTitleSchema, osTitleSchema, listVersionsTitleSchema, reportFlowTitleSchema, siteUrlTitleSchema, didOpenReportInfoTitleSchema, toggleReportCounterTitleSchema, openerContextTitleSchema, userRefreshCountTitleSchema, jsPerformanceTitleSchema, stateBlockedSchema, stateAllowedSchema, extensionMessageGetPrivacyDashboardDataSchema, emailProtectionUserDataSchema, protectionsStatusSchema, localeSettingsSchema, parentEntitySchema, fireButtonSchema, searchSchema, breakageReportRequestSchema, setListOptionsSchema, windowsIncomingVisibilitySchema, cookiePromptManagementStatusSchema, refreshAliasResponseSchema, extensionMessageSetListOptionsSchema, fireOptionSchema, primaryScreenSchema, eventOriginSchema, siteUrlAdditionalDataSchema, closeMessageParamsSchema, categoryTypeSelectedSchema, categorySelectedSchema, toggleSkippedSchema, dataItemIdSchema, detectedRequestSchema, tabSchema, breakageReportSchema, fireButtonDataSchema, remoteFeatureSettingsSchema, setProtectionParamsSchema, toggleReportScreenDataItemSchema, telemetrySpanSchema, requestDataSchema, getPrivacyDashboardDataSchema, windowsViewModelSchema, toggleReportScreenSchema, windowsIncomingViewModelSchema, windowsIncomingMessageSchema, apiSchema;
var init_schema_parsers = __esm({
"schema/__generated__/schema.parsers.mjs"() {
"use strict";
Expand Down Expand Up @@ -4712,6 +4712,9 @@
name: z3.literal("categorySelected"),
value: z3.union([z3.literal("blocked"), z3.literal("layout"), z3.literal("empty-spaces"), z3.literal("paywall"), z3.literal("videos"), z3.literal("comments"), z3.literal("login"), z3.literal("shopping"), z3.literal("other")])
});
toggleSkippedSchema = z3.object({
name: z3.literal("toggleSkipped")
});
dataItemIdSchema = z3.union([wvVersionTitleSchema, requestsTitleSchema, featuresTitleSchema, appVersionTitleSchema, atbTitleSchema, errorDescriptionsTitleSchema, extensionVersionTitleSchema, httpErrorCodesTitleSchema, lastSentDayTitleSchema, deviceTitleSchema, osTitleSchema, listVersionsTitleSchema, reportFlowTitleSchema, siteUrlTitleSchema, didOpenReportInfoTitleSchema, toggleReportCounterTitleSchema, openerContextTitleSchema, userRefreshCountTitleSchema, jsPerformanceTitleSchema]);
detectedRequestSchema = z3.object({
url: z3.string(),
Expand Down Expand Up @@ -4751,7 +4754,7 @@
additional: siteUrlAdditionalDataSchema.optional()
});
telemetrySpanSchema = z3.object({
attributes: z3.union([categoryTypeSelectedSchema, categorySelectedSchema]),
attributes: z3.union([categoryTypeSelectedSchema, categorySelectedSchema, toggleSkippedSchema]),
eventOrigin: eventOriginSchema
});
requestDataSchema = z3.object({
Expand Down Expand Up @@ -17130,7 +17133,17 @@
const data = useData();
const text = data.tab.domain;
const onToggle = useToggle();
return /* @__PURE__ */ y("div", { className: "site-info page-inner card", "data-page": "choice-category" }, /* @__PURE__ */ y(NavWrapper, null), /* @__PURE__ */ y("div", { className: "padding-x-double" }, /* @__PURE__ */ y(KeyInsightsMain, { title: text, icon: "switch-shield" }, description)), /* @__PURE__ */ y("div", { className: "padding-x" }, /* @__PURE__ */ y("div", { class: "card-list--bordered" }, /* @__PURE__ */ y("div", { className: "protection-toggle" }, /* @__PURE__ */ y("div", { className: "protection-toggle__row" }, /* @__PURE__ */ y(ProtectionToggle, { model: data, toggle: onToggle })))), /* @__PURE__ */ y("div", { class: "text--center" }, /* @__PURE__ */ y(TextLink, { onClick: () => push("choiceBreakageForm") }, ns.report("skipThisStep.title")))));
const send = useTelemetry();
return /* @__PURE__ */ y("div", { className: "site-info page-inner card", "data-page": "choice-category" }, /* @__PURE__ */ y(NavWrapper, null), /* @__PURE__ */ y("div", { className: "padding-x-double" }, /* @__PURE__ */ y(KeyInsightsMain, { title: text, icon: "switch-shield" }, description)), /* @__PURE__ */ y("div", { className: "padding-x" }, /* @__PURE__ */ y("div", { class: "card-list--bordered" }, /* @__PURE__ */ y("div", { className: "protection-toggle" }, /* @__PURE__ */ y("div", { className: "protection-toggle__row" }, /* @__PURE__ */ y(ProtectionToggle, { model: data, toggle: onToggle })))), /* @__PURE__ */ y("div", { class: "text--center" }, /* @__PURE__ */ y(
TextLink,
{
onClick: () => {
push("choiceBreakageForm");
send({ name: "toggleSkipped" });
}
},
ns.report("skipThisStep.title")
))));
}
var validCategories = () => {
return {
Expand Down
6 changes: 6 additions & 0 deletions integration-tests/AltBreakageFlows.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export class AltBreakageFlows {
await page.getByLabel('Site layout broken').click()
await this.dash.screenshot('category-inline-toggle.png')
await page.getByRole('link', { name: 'Skip this step' }).click()
await this.dash.mocks.didSendTelemetry({
screen: 'choiceToggle',
attributes: {
name: 'toggleSkipped',
},
})
await page.getByRole('button', { name: 'Send Report' }).click()
await this.dash.mocks.calledForSubmitBreakageForm({ category: 'layout' })
}
Expand Down
17 changes: 8 additions & 9 deletions integration-tests/Mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,15 @@ export class Mocks {
const calls = await this.outgoing({
names: ['privacyDashboardTelemetrySpan'],
})
expect(calls).toMatchObject([
[
'privacyDashboardTelemetrySpan',
{
eventOrigin: {
screen,
},
attributes,
const filtered = calls.find(([_name, payload]) => payload.attributes?.name === attributes.name)
expect(filtered).toMatchObject([
'privacyDashboardTelemetrySpan',
{
eventOrigin: {
screen,
},
],
attributes,
},
])
}

Expand Down
6 changes: 5 additions & 1 deletion schema/__generated__/schema.parsers.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion schema/__generated__/schema.types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions schema/telemetry-span.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"enum": ["blocked", "layout", "empty-spaces", "paywall", "videos", "comments", "login", "shopping", "other"]
}
}
},
{
"type": "object",
"title": "ToggleSkipped",
"required": ["name"],
"properties": {
"name": {
"const": "toggleSkipped"
}
}
}
]
},
Expand Down
10 changes: 9 additions & 1 deletion v2/screens/choice-problem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function ChoiceToggleScreen() {
const data = useData()
const text = data.tab.domain
const onToggle = useToggle()
const send = useTelemetry()
return (
<div className="site-info page-inner card" data-page="choice-category">
<NavWrapper />
Expand All @@ -126,7 +127,14 @@ export function ChoiceToggleScreen() {
</div>
</div>
<div class="text--center">
<TextLink onClick={() => push('choiceBreakageForm')}>{ns.report('skipThisStep.title')}</TextLink>
<TextLink
onClick={() => {
push('choiceBreakageForm')
send({ name: 'toggleSkipped' })
}}
>
{ns.report('skipThisStep.title')}
</TextLink>
</div>
</div>
</div>
Expand Down

0 comments on commit 924a80e

Please sign in to comment.