:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore: Add dismiss consent and cookie banners toggle to heatmaps (#65569)
Jordan Mryyan5e2766e5bce9
diff --git a/.env.example b/.env.exampleindex 66560bfef4ed..1b24175d6775 100644--- a/.env.example+++ b/.env.example@@ -37,17 +37,16 @@ ELEVENLABS_API_KEY=# Browserless renders heatmap screenshots and image exports — there is no in-container browser.# Local dev: start the optional service first, then set the values below.# docker compose -f docker-compose.dev.yml --profile browserless up -d browserless-# Heatmap screenshots (REST API). blockConsentModals/blockAds are browserless.io cloud-only API-# extensions — the self-hosted OSS image rejects them, so disable against the local container:+# Heatmap screenshots (REST API). blockAds is a browserless.io cloud-only API extension that the+# self-hosted OSS image rejects, so leave it off against the local container. (Consent-modal+# blocking is opted into per heatmap and stays off by default — no env var.)# HEATMAP_BROWSERLESS_URL=http://localhost:4445# HEATMAP_BROWSERLESS_TOKEN=dev-# HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS=falseHEATMAP_BROWSERLESS_URL=HEATMAP_BROWSERLESS_TOKEN=# HEATMAP_BROWSERLESS_TIMEOUT_MS=180000# HEATMAP_BROWSERLESS_CONNECT_TIMEOUT_MS=30000# HEATMAP_BROWSERLESS_BLOCK_ADS=false-# HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS=true# Image exports (CDP). The containerized browser must reach SITE_URL, and `localhost` inside the# container is not your machine — remap it via Chromium launch args (URL-encoded JSON below decodesdiff --git a/docker-compose.hobby.yml b/docker-compose.hobby.ymlindex 635b6233f04d..59a6563fc24d 100644--- a/docker-compose.hobby.yml+++ b/docker-compose.hobby.yml@@ -107,8 +107,6 @@ services:BROWSERLESS_TOKEN: ${BROWSERLESS_SECRET:-$POSTHOG_SECRET}HEATMAP_BROWSERLESS_URL: 'http://browserless:3000'HEATMAP_BROWSERLESS_TOKEN: ${BROWSERLESS_SECRET:-$POSTHOG_SECRET}- # blockConsentModals is a browserless.io cloud API extension; the OSS image 400s on it- HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS: 'false'# AI provider keys for PostHog's AI features. Blank unless set in .env.ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}OPENAI_API_KEY: ${OPENAI_API_KEY:-}@@ -415,8 +413,6 @@ services:BROWSERLESS_TOKEN: ${BROWSERLESS_SECRET:-$POSTHOG_SECRET}HEATMAP_BROWSERLESS_URL: 'http://browserless:3000'HEATMAP_BROWSERLESS_TOKEN: ${BROWSERLESS_SECRET:-$POSTHOG_SECRET}- # blockConsentModals is a browserless.io cloud API extension; the OSS image 400s on it- HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS: 'false'# AI provider keys for PostHog's AI features. Blank unless set in .env.ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}OPENAI_API_KEY: ${OPENAI_API_KEY:-}diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 13f8e23cef3b..44f9be057933 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5389,21 +5389,21 @@ snapshots:scenes-app-health-tables--web-analytics-empty--light:hash: v1.k794b7964.447d67b1c4a15985b16cea8d9378c26ca68fdb78bfe055a0d0c2923027c896d0.UV-3Ra8cmSnRMASFzEgbHvuZM1qBtJgBA6OYfJm-dl4scenes-app-heatmap--generating--dark:- hash: v1.k794b7964.4eb45bb00c9e9ae6a5d1fea5fc5e967bb68a8fe9098e63b94e718ba8e287cecc.wRZ8rI2UdHzRAdyfXV2SmPuXHfWsBSwtjTBQRIPaNV8+ hash: v1.k794b7964.64a23836125689158296583e8d8d0d20b317454a70218c444d2c8144f225d9fc.Sy5MkM0_z4wZM76i7Zv4vZ48-vZtwnWNJqXYe6im4oAscenes-app-heatmap--generating--light:- hash: v1.k794b7964.cf4e5564c4f9413a8ef0f5d6671e2d9520b9e51f01c117bdf8d0d56afcd0ea0a.24eFf5OCkH3IgTECXrosSOsyExl0WNxNAK89GdhyCOk+ hash: v1.k794b7964.f757a31dad078a172ae1343d30ad17eab680bad7f97a6f08601df38116882cd8.8RnDVQsi6EB3RP8HE5Xdm8YdGojbvJsksyYO-oDDdRIscenes-app-heatmap--iframe-example--dark:- hash: v1.k794b7964.04c6408085f9d5402f7b50c81958f2fc68e3298bb6ac3855aaa13c0f041b3362.youf1hLJqK3IkjO5wfnu7FWBiwZaBkJyqDp3FX3nG38+ hash: v1.k794b7964.f028ebec06fbb1ca3448aa2739934d01f05652ae6a71bcbacdc62344243c7782.U6_0G-SvFylNLDvUsLx416zl3-KP8fqKbgHv5xdCq6Escenes-app-heatmap--iframe-example--light:- hash: v1.k794b7964.82d72b4b351af7a90c3fa41ca60e5b90faf7b89c5a05f9e420fdf8a815161101.S0CiHD71oZXhhHC1XK4aSh505GVqf4n7aY_Hd1WeBPU+ hash: v1.k794b7964.f38e2045a16e2f9219bb43486dffb25150fa47186ae97e421fd456a479a9eb2b.T1CMQYHs7bAmwLCpEI_grBr7EjbXOMPHyyxWEFDiLK8scenes-app-heatmap--new--dark:- hash: v1.k794b7964.eebfffb6141fa152d17e856998a2ffd28a6c32594fdfd964bef560c55b6c093d.atMcJIWTo4O4JsB-88fdGTG8tGKqkEM_6aaz4hgHGDI+ hash: v1.k794b7964.fed505c676d21b88219d8fae829e7ef7d9436fc27168d9e215e2f6087e0c4f01.fn1l9gJE3AyDx9zFBwGvNOdV6-A_lFCvu1-HMAGufxAscenes-app-heatmap--new--light:- hash: v1.k794b7964.db738b49d015e243254ad61c075dc056b7f806cfc5c6d824f0c182db579a6b85.IVRJ88fouAhqtoZruYcl3_8wKpNtZeI6ui1H87BDp4w+ hash: v1.k794b7964.a848d57357e3d999674f9c5323262969bb61503129309f5153e0c7d21df64bc2.ehH8QOipczFjlCOd0HKhmBShyKbQxxV5gG_PI-z5lVYscenes-app-heatmap-new--new-form--dark:- hash: v1.k794b7964.eebfffb6141fa152d17e856998a2ffd28a6c32594fdfd964bef560c55b6c093d.zWqPSEmr4pX4SQ7fJEYL5iTHi4FFTIeyvk5VRhTMuOA+ hash: v1.k794b7964.fed505c676d21b88219d8fae829e7ef7d9436fc27168d9e215e2f6087e0c4f01.4KB6-46F2G1IALC01H_Bm0YJGSdVuvChFon4cDgUxxAscenes-app-heatmap-new--new-form--light:- hash: v1.k794b7964.db738b49d015e243254ad61c075dc056b7f806cfc5c6d824f0c182db579a6b85.snJbtyG1U2yFQds8t0Nsy-aFDAYzmrIctCghjFL97nA+ hash: v1.k794b7964.39664c087c6a24a9913f2d08cc864cfaaaa98fa6b0340ad7dca8eca69ba18969.smSjuHNdDHUPkqhRiSkcijbtTl2Hjgyc-VR5Z_TluQoscenes-app-heatmaps-saved--list--dark:hash: v1.k794b7964.e37b13fd164df2112c8df43293c07cee475e2db015d2b4c1a51cde1e539f05bf.T7elBTqZ9eKc1ktRNLQ9icxgGqt7D2v6Ybt2I0xUd-Qscenes-app-heatmaps-saved--list--light:diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex d138a9cfa487..656c9ef432fc 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -7364,6 +7364,7 @@ const api = {data_url?: string | nullwidth?: numbertype?: HeatmapType+ block_consent_modals?: boolean}): Promise<HeatmapScreenshotType> {return await new ApiRequest().heatmapScreenshotsSaved().create({ data })},@@ -7379,6 +7380,7 @@ const api = {data_url: string | nullwidth: numbertype: HeatmapType+ block_consent_modals: boolean}>): Promise<HeatmapScreenshotType> {return await new ApiRequest().heatmapScreenshotSaved(id).update({ data })diff --git a/frontend/src/scenes/heatmaps/components/HeatmapAdvancedSettings.tsx b/frontend/src/scenes/heatmaps/components/HeatmapAdvancedSettings.tsxnew file mode 100644index 000000000000..4695e9a9fc0f--- /dev/null+++ b/frontend/src/scenes/heatmaps/components/HeatmapAdvancedSettings.tsx@@ -0,0 +1,69 @@+import { useActions, useValues } from 'kea'++import { LemonCollapse, LemonInput, LemonLabel, LemonSwitch } from '@posthog/lemon-ui'++import { HeatmapsForbiddenURL } from 'scenes/heatmaps/components/HeatmapsForbiddenURL'+import { heatmapLogic } from 'scenes/heatmaps/scenes/heatmap/heatmapLogic'++export interface HeatmapAdvancedSettingsProps {+ dataUrlPlaceholderFallback: string+ dataUrlHelp: React.ReactNode+ consentHelp: React.ReactNode+ showForbiddenUrl?: boolean+}++export function HeatmapAdvancedSettings({+ dataUrlPlaceholderFallback,+ dataUrlHelp,+ consentHelp,+ showForbiddenUrl = false,+}: HeatmapAdvancedSettingsProps): JSX.Element {+ const { dataUrl, displayUrl, type, blockConsentModals, isBrowserUrlAuthorized } = useValues(heatmapLogic)+ const { setDataUrl, setDataUrlUserTouched, setBlockConsentModals } = useActions(heatmapLogic)++ return (+ <LemonCollapse+ panels={[+ {+ key: 'advanced',+ header: 'Advanced settings',+ content: (+ <div className="flex flex-col gap-4">+ <div>+ <LemonLabel>Heatmap data URL</LemonLabel>+ <LemonInput+ size="small"+ placeholder={+ displayUrl ? `Same as page URL: ${displayUrl}` : dataUrlPlaceholderFallback+ }+ value={dataUrl ?? ''}+ onChange={(value) => {+ setDataUrlUserTouched(true)+ setDataUrl(value || null)+ }}+ fullWidth={true}+ />+ <div className="text-xs text-muted mt-1">{dataUrlHelp}</div>+ {showForbiddenUrl && dataUrl && !isBrowserUrlAuthorized ? (+ <HeatmapsForbiddenURL />+ ) : null}+ </div>+ <div>+ <LemonSwitch+ checked={blockConsentModals}+ onChange={setBlockConsentModals}+ label="Dismiss cookie & consent banners"+ bordered+ disabledReason={+ type !== 'screenshot' ? 'Only available for screenshot heatmaps' : undefined+ }+ />+ <div className="text-xs text-muted mt-1">{consentHelp}</div>+ </div>+ </div>+ ),+ },+ ]}+ />+ )+}diff --git a/frontend/src/scenes/heatmaps/components/HeatmapHeader.tsx b/frontend/src/scenes/heatmaps/components/HeatmapHeader.tsxindex 2891dab472c4..3247eead306b 100644--- a/frontend/src/scenes/heatmaps/components/HeatmapHeader.tsx+++ b/frontend/src/scenes/heatmaps/components/HeatmapHeader.tsx@@ -2,14 +2,14 @@ import { useActions, useValues } from 'kea'import { LemonBanner, LemonButton, LemonInput, LemonLabel } from '@posthog/lemon-ui'+import { HeatmapAdvancedSettings } from 'scenes/heatmaps/components/HeatmapAdvancedSettings'import { HeatmapsInvalidURL } from 'scenes/heatmaps/components/HeatmapsInvalidURL'import { heatmapLogic } from 'scenes/heatmaps/scenes/heatmap/heatmapLogic'export function HeatmapHeader(): JSX.Element {- const { dataUrl, displayUrl, pageUrlDraft, isPageUrlDraftValid, pageUrlDraftIsPattern, loading, screenshotError } =+ const { pageUrlDraft, isPageUrlDraftValid, pageUrlDraftIsPattern, loading, screenshotError } =useValues(heatmapLogic)- const { setDataUrl, setPageUrlDraft, setDataUrlUserTouched, applyPageUrlDraft, regenerateScreenshot } =- useActions(heatmapLogic)+ const { setPageUrlDraft, applyPageUrlDraft, regenerateScreenshot } = useActions(heatmapLogic)const draftIsEmpty = pageUrlDraft.trim() === ''const disabledReason = !isPageUrlDraftValid ? 'Enter a valid URL' : draftIsEmpty ? 'Enter a URL' : null@@ -55,35 +55,24 @@ export function HeatmapHeader(): JSX.Element {)) : null}</div>- <div>- <LemonLabel>Heatmap data URL</LemonLabel>- <LemonInput- size="small"- placeholder={displayUrl ? `Same as page URL: ${displayUrl}` : 'Enter a URL'}- value={dataUrl ?? ''}- onChange={(value) => {- setDataUrlUserTouched(true)- setDataUrl(value || null)- }}- fullWidth={true}- />- <div className="text-xs text-muted mt-1">- Add * for wildcards to aggregate data from multiple pages+ {screenshotError && (+ <div>+ <LemonBanner+ type="error"+ action={{+ children: 'Retry',+ onClick: regenerateScreenshot,+ }}+ >+ {screenshotError}+ </LemonBanner></div>- {screenshotError && (- <div className="mt-2">- <LemonBanner- type="error"- action={{- children: 'Retry',- onClick: regenerateScreenshot,- }}- >- {screenshotError}- </LemonBanner>- </div>- )}- </div>+ )}+ <HeatmapAdvancedSettings+ dataUrlPlaceholderFallback="Enter a URL"+ dataUrlHelp="Defaults to the page URL. Add * for wildcards to aggregate data from multiple pages."+ consentHelp="Ask the browser to close cookie/consent popups before capturing the screenshot. This can slow down or fail the render on some sites, so it's off by default. Save to apply."+ /></div></div></>diff --git a/frontend/src/scenes/heatmaps/scenes/heatmap/HeatmapNewScene.tsx b/frontend/src/scenes/heatmaps/scenes/heatmap/HeatmapNewScene.tsxindex e94b6d6d5624..79a6558083c7 100644--- a/frontend/src/scenes/heatmaps/scenes/heatmap/HeatmapNewScene.tsx+++ b/frontend/src/scenes/heatmaps/scenes/heatmap/HeatmapNewScene.tsx@@ -5,12 +5,11 @@ import { Spinner } from '@posthog/lemon-ui'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { LemonButton } from 'lib/lemon-ui/LemonButton'-import { LemonInput } from 'lib/lemon-ui/LemonInput'import { LemonInputSelect } from 'lib/lemon-ui/LemonInputSelect/LemonInputSelect'import { LemonRadio } from 'lib/lemon-ui/LemonRadio'import { Link } from 'lib/lemon-ui/Link'+import { HeatmapAdvancedSettings } from 'scenes/heatmaps/components/HeatmapAdvancedSettings'import { heatmapsBrowserLogic } from 'scenes/heatmaps/components/heatmapsBrowserLogic'-import { HeatmapsForbiddenURL } from 'scenes/heatmaps/components/HeatmapsForbiddenURL'import { HeatmapsInvalidURL } from 'scenes/heatmaps/components/HeatmapsInvalidURL'import { urls } from 'scenes/urls'@@ -26,7 +25,7 @@ export function HeatmapNewScene(): JSX.Element {const logic = heatmapLogic({ id: 'new' })const { loading, displayUrl, isDisplayUrlValid, type, name, dataUrl, isBrowserUrlAuthorized, displayUrlIsPattern } =useValues(logic)- const { setDisplayUrl, setType, setName, createHeatmap, setDataUrl, setDataUrlUserTouched } = useActions(logic)+ const { setDisplayUrl, setType, setName, createHeatmap } = useActions(logic)const { topUrls, topUrlsLoading, noPageviews } = useValues(heatmapsBrowserLogic)const debouncedOnNameChange = useDebouncedCallback((name: string) => {@@ -95,24 +94,6 @@ export function HeatmapNewScene(): JSX.Element {) : null}</SceneSection><SceneDivider />- <SceneSection- title="Heatmap data URL"- description="An exact match or a pattern for heatmap data. For example, use a pattern if you have pages with dynamic IDs. E.g. https://www.example.com/users/* will aggregate data from all pages under /users/."- >- <LemonInput- size="small"- placeholder="https://www.example.com/*"- value={dataUrl ?? ''}- onChange={(value) => {- setDataUrlUserTouched(true)- setDataUrl(value || null)- }}- fullWidth={true}- />- <div className="text-xs text-muted mt-1">Add * for wildcards to aggregate data from multiple pages</div>- {dataUrl && !isBrowserUrlAuthorized ? <HeatmapsForbiddenURL /> : null}- </SceneSection>- <SceneDivider /><SceneSection title="Capture method" description="Choose how to display your page in the heatmap"><LemonRadiooptions={[@@ -140,6 +121,13 @@ export function HeatmapNewScene(): JSX.Element {</LemonBanner></SceneSection><SceneDivider />+ <HeatmapAdvancedSettings+ dataUrlPlaceholderFallback="https://www.example.com/*"+ dataUrlHelp="Defaults to the page URL. Add * for wildcards to aggregate data from multiple pages — e.g. https://www.example.com/users/* aggregates all pages under /users/."+ consentHelp="Ask the browser to close cookie/consent popups before capturing the screenshot. This can slow down or fail the render on some sites, so it's off by default."+ showForbiddenUrl+ />+ <SceneDivider /><div className="flex gap-2"><LemonButtonclassName="w-fit"@@ -148,13 +136,11 @@ export function HeatmapNewScene(): JSX.Element {onClick={createHeatmap}loading={false}disabledReason={- !isDisplayUrlValid || !isBrowserUrlAuthorized+ !isDisplayUrlValid || (!!dataUrl && !isBrowserUrlAuthorized)? 'Invalid URL or forbidden URL': !displayUrl? 'URL is required'- : !dataUrl- ? 'Heatmap data URL is required'- : null+ : null}>Savediff --git a/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts b/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.tsindex c463351b1916..b0ffd604a3f2 100644--- a/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts+++ b/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts@@ -93,6 +93,8 @@ export const heatmapLogic = kea<heatmapLogicType>([exportHeatmap: true,setContainerWidth: (containerWidth: number | null) => ({ containerWidth }),snapshotSavedDisplayUrl: (displayUrl: string | null) => ({ displayUrl }),+ setBlockConsentModals: (value: boolean) => ({ value }),+ snapshotSavedBlockConsentModals: (value: boolean) => ({ value }),setPageUrlDraft: (value: string) => ({ value }),applyPageUrlDraft: true,}),@@ -111,6 +113,8 @@ export const heatmapLogic = kea<heatmapLogicType>([screenshotLoaded: [false, { setScreenshotLoaded: (_, { screenshotLoaded }) => screenshotLoaded }],containerWidth: [null as number | null, { setContainerWidth: (_, { containerWidth }) => containerWidth }],savedDisplayUrl: [null as string | null, { snapshotSavedDisplayUrl: (_, { displayUrl }) => displayUrl }],+ blockConsentModals: [false as boolean, { setBlockConsentModals: (_, { value }) => value }],+ savedBlockConsentModals: [false as boolean, { snapshotSavedBlockConsentModals: (_, { value }) => value }],pageUrlDraft: ['' as string,{@@ -143,6 +147,8 @@ export const heatmapLogic = kea<heatmapLogicType>([actions.setDisplayUrl(item.url)actions.setDataUrl(item.data_url)actions.snapshotSavedDisplayUrl(item.url ?? null)+ actions.setBlockConsentModals(item.block_consent_modals ?? false)+ actions.snapshotSavedBlockConsentModals(item.block_consent_modals ?? false)actions.setType(item.type)if (item.type === 'screenshot') {const desiredWidth = values.widthOverride@@ -246,6 +252,7 @@ export const heatmapLogic = kea<heatmapLogicType>([url: values.displayUrl || '',data_url: values.dataUrl,type: values.type,+ block_consent_modals: values.blockConsentModals,}const created = await api.savedHeatmaps.create(data)actions.loadSavedHeatmaps()@@ -260,16 +267,22 @@ export const heatmapLogic = kea<heatmapLogicType>([updateHeatmap: async () => {actions.setLoading(true)const previousSavedUrl = values.savedDisplayUrl+ const previousBlockConsentModals = values.savedBlockConsentModalstry {const data = {name: values.name || DEFAULT_HEATMAP_NAME,url: values.displayUrl || '',data_url: values.dataUrl,type: values.type,+ block_consent_modals: values.blockConsentModals,}const updated = await api.savedHeatmaps.update(props.id, data)actions.snapshotSavedDisplayUrl(updated.url ?? null)- if (values.type === 'screenshot' && updated.url !== previousSavedUrl) {+ actions.snapshotSavedBlockConsentModals(updated.block_consent_modals ?? false)+ const renderInputChanged =+ updated.url !== previousSavedUrl ||+ (updated.block_consent_modals ?? false) !== previousBlockConsentModals+ if (values.type === 'screenshot' && renderInputChanged) {actions.setScreenshotUrl(null)actions.setScreenshotLoaded(false)actions.setScreenshotError(null)diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex e6b97e71a091..e2a1b02a4cad 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -7495,6 +7495,7 @@ export interface HeatmapScreenshotType {width: numberstatus: HeatmapStatushas_content: boolean+ block_consent_modals?: booleancreated_at: stringupdated_at: stringexception?: stringdiff --git a/posthog/settings/integrations.py b/posthog/settings/integrations.pyindex b319ed6e3a96..92b12f4d7caa 100644--- a/posthog/settings/integrations.py+++ b/posthog/settings/integrations.py@@ -125,6 +125,3 @@ HEATMAP_BROWSERLESS_TOKEN = get_from_env("HEATMAP_BROWSERLESS_TOKEN", "")HEATMAP_BROWSERLESS_TIMEOUT_MS = get_from_env("HEATMAP_BROWSERLESS_TIMEOUT_MS", 180000, type_cast=int)HEATMAP_BROWSERLESS_CONNECT_TIMEOUT_MS = get_from_env("HEATMAP_BROWSERLESS_CONNECT_TIMEOUT_MS", 30000, type_cast=int)HEATMAP_BROWSERLESS_BLOCK_ADS = get_from_env("HEATMAP_BROWSERLESS_BLOCK_ADS", False, type_cast=str_to_bool)-HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS = get_from_env(- "HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS", True, type_cast=str_to_bool-)diff --git a/products/web_analytics/backend/api/heatmaps_api.py b/products/web_analytics/backend/api/heatmaps_api.pyindex 0af0f8a72d83..8d642500b4cb 100644--- a/products/web_analytics/backend/api/heatmaps_api.py+++ b/products/web_analytics/backend/api/heatmaps_api.py@@ -754,6 +754,7 @@ class HeatmapScreenshotResponseSerializer(serializers.ModelSerializer):"has_content","snapshots","deleted",+ "block_consent_modals","created_by","created_at","updated_at",@@ -779,6 +780,10 @@ class HeatmapScreenshotResponseSerializer(serializers.ModelSerializer):"status": {"help_text": "Screenshot generation status: 'processing', 'completed', or 'failed'."},"has_content": {"help_text": "Whether at least one rendered image is ready to fetch."},"deleted": {"help_text": "Soft-delete flag; deleted heatmaps are hidden from the list."},+ "block_consent_modals": {+ "help_text": "Whether the headless browser dismisses cookie/consent banners before capturing "+ "the screenshot. Only applies to 'screenshot' heatmaps."+ },"exception": {"help_text": "Error detail when screenshot generation failed, otherwise null."},}@@ -926,7 +931,7 @@ class SavedHeatmapRequestSerializer(serializers.ModelSerializer):class Meta:model = SavedHeatmap- fields = ["name", "url", "data_url", "widths", "type", "deleted"]+ fields = ["name", "url", "data_url", "widths", "type", "deleted", "block_consent_modals"]extra_kwargs = {"name": {"required": False, "allow_null": True, "help_text": "Human-readable label for the saved heatmap."},"url": {@@ -945,6 +950,12 @@ class SavedHeatmapRequestSerializer(serializers.ModelSerializer):"or 'recording'. Only 'screenshot' generates image bytes.",},"deleted": {"required": False, "help_text": "Set true to soft-delete the saved heatmap."},+ "block_consent_modals": {+ "required": False,+ "help_text": "When true, ask the headless browser to dismiss cookie/consent banners before "+ "capturing the screenshot. Off by default: the blocker can stall the render on some sites and "+ "time out. Only applies to 'screenshot' heatmaps.",+ },}@@ -1048,6 +1059,7 @@ class SavedHeatmapViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Gdata_url = serializer.validated_data.get("data_url") or urlwidths = serializer.validated_data.get("widths", DEFAULT_TARGET_WIDTHS)heatmap_type = serializer.validated_data.get("type", SavedHeatmap.Type.SCREENSHOT)+ block_consent_modals = serializer.validated_data.get("block_consent_modals", False)screenshot = SavedHeatmap.objects.create(team=self.team,@@ -1056,6 +1068,7 @@ class SavedHeatmapViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Gdata_url=data_url,target_widths=widths,type=heatmap_type,+ block_consent_modals=block_consent_modals,created_by=cast(User, request.user),status=SavedHeatmap.Status.PROCESSINGif heatmap_type == SavedHeatmap.Type.SCREENSHOT@@ -1129,11 +1142,13 @@ class SavedHeatmapViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Gdef partial_update(self, request: request.Request, *args: Any, **kwargs: Any) -> response.Response:obj = self.get_object()old_url = obj.url+ old_block_consent_modals = obj.block_consent_modalsserializer = SavedHeatmapRequestSerializer(obj, data=request.data, partial=True)serializer.is_valid(raise_exception=True)updated = serializer.save()- if updated.type == SavedHeatmap.Type.SCREENSHOT and updated.url != old_url:+ render_input_changed = updated.url != old_url or updated.block_consent_modals != old_block_consent_modals+ if updated.type == SavedHeatmap.Type.SCREENSHOT and render_input_changed:self._regenerate(updated)log_activity(diff --git a/products/web_analytics/backend/migrations/0005_savedheatmap_block_consent_modals.py b/products/web_analytics/backend/migrations/0005_savedheatmap_block_consent_modals.pynew file mode 100644index 000000000000..d57dbc3ef0ef--- /dev/null+++ b/products/web_analytics/backend/migrations/0005_savedheatmap_block_consent_modals.py@@ -0,0 +1,17 @@+# Generated by Django 5.2.14 on 2026-06-23 17:17++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("web_analytics", "0004_rename_achievement_track_keys"),+ ]++ operations = [+ migrations.AddField(+ model_name="savedheatmap",+ name="block_consent_modals",+ field=models.BooleanField(default=False),+ ),+ ]diff --git a/products/web_analytics/backend/migrations/max_migration.txt b/products/web_analytics/backend/migrations/max_migration.txtindex 4078b0ac76f6..4dd522ec9e6c 100644--- a/products/web_analytics/backend/migrations/max_migration.txt+++ b/products/web_analytics/backend/migrations/max_migration.txt@@ -1 +1 @@-0004_rename_achievement_track_keys+0005_savedheatmap_block_consent_modalsdiff --git a/products/web_analytics/backend/models/heatmap_saved.py b/products/web_analytics/backend/models/heatmap_saved.pyindex cf05922c807e..01d660c8fbce 100644--- a/products/web_analytics/backend/models/heatmap_saved.py+++ b/products/web_analytics/backend/models/heatmap_saved.py@@ -24,6 +24,7 @@ class SavedHeatmap(UUIDTModel):target_widths = models.JSONField(default=list)type = models.CharField(max_length=20, choices=Type, default=Type.SCREENSHOT)status = models.CharField(max_length=20, choices=Status, default=Status.PROCESSING)+ block_consent_modals = models.BooleanField(default=False)# Content moved to HeatmapSnapshot per width@@ -62,6 +63,7 @@ class SavedHeatmap(UUIDTModel):"target_widths": self.target_widths,"type": self.type,"status": self.status,+ "block_consent_modals": self.block_consent_modals,}diff --git a/products/web_analytics/backend/tasks/heatmap_screenshot.py b/products/web_analytics/backend/tasks/heatmap_screenshot.pyindex 76dad39553b7..850b85efc436 100644--- a/products/web_analytics/backend/tasks/heatmap_screenshot.py+++ b/products/web_analytics/backend/tasks/heatmap_screenshot.py@@ -346,7 +346,7 @@ def _validate_screenshot_response(response: requests.Response, endpoint_url: strreturn content-def _browserless_screenshot(endpoint_url: str, page_url: str, width: int) -> bytes:+def _browserless_screenshot(endpoint_url: str, page_url: str, width: int, block_consent_modals: bool) -> bytes:# Render one width via the Browserless /screenshot REST API. viewport.width sets the captured width;# scrollPage triggers lazy-loaded content and blockConsentModals dismisses cookie banners server-side.body: dict[str, object] = {@@ -366,7 +366,7 @@ def _browserless_screenshot(endpoint_url: str, page_url: str, width: int) -> byt# blockConsentModals / blockAds are browserless.io cloud API extensions; the self-hosted OSS# image rejects unknown body fields (400 "must NOT have additional properties"), so only send# them when enabled.- if settings.HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS:+ if block_consent_modals:body["blockConsentModals"] = Trueif settings.HEATMAP_BROWSERLESS_BLOCK_ADS:body["blockAds"] = True@@ -501,7 +501,7 @@ def _generate_browserless_screenshots(screenshot: SavedHeatmap, widths: list[int)count = 0for w in widths:- image_data = _browserless_screenshot(endpoint_url, screenshot.url, w)+ image_data = _browserless_screenshot(endpoint_url, screenshot.url, w, screenshot.block_consent_modals)_persist_snapshot(screenshot, w, image_data)count += 1return countdiff --git a/products/web_analytics/backend/tasks/test/test_heatmap_screenshot.py b/products/web_analytics/backend/tasks/test/test_heatmap_screenshot.pyindex 05d252b9e772..9b5149cca16c 100644--- a/products/web_analytics/backend/tasks/test/test_heatmap_screenshot.py+++ b/products/web_analytics/backend/tasks/test/test_heatmap_screenshot.py@@ -76,15 +76,33 @@ class TestHeatmapScreenshotTask(APIBaseTest):patcher.start()self.addCleanup(patcher.stop)- def _make_heatmap(self, target_widths: list[int] | None = None) -> SavedHeatmap:+ def _make_heatmap(self, target_widths: list[int] | None = None, block_consent_modals: bool = False) -> SavedHeatmap:return SavedHeatmap.objects.create(team=self.team,url="https://example.com",created_by=self.user,target_widths=target_widths or [1024],status=SavedHeatmap.Status.PROCESSING,+ block_consent_modals=block_consent_modals,)+ @parameterized.expand([("blocking_on", True), ("blocking_off", False)])+ @override_settings(**BROWSERLESS_SETTINGS, HEATMAP_BROWSERLESS_BLOCK_ADS=False)+ @patch("products.web_analytics.backend.tasks.heatmap_screenshot.requests")+ def test_per_heatmap_consent_blocking_flows_into_body(+ self, _name: str, block_consent_modals: bool, mock_requests: MagicMock+ ) -> None:+ mock_requests.post.return_value = _make_response(_jpeg(b"1024"))++ heatmap = self._make_heatmap(block_consent_modals=block_consent_modals)+ generate_heatmap_screenshot(heatmap.id)++ body = mock_requests.post.call_args.kwargs["json"]+ if block_consent_modals:+ assert body["blockConsentModals"] is True+ else:+ assert "blockConsentModals" not in body+@override_settings(**BROWSERLESS_SETTINGS)@patch("products.web_analytics.backend.tasks.heatmap_screenshot.requests")def test_uses_rest_screenshot_api(self, mock_requests: MagicMock) -> None:@@ -192,7 +210,6 @@ class TestBrowserlessScreenshotRequest(SimpleTestCase):HEATMAP_BROWSERLESS_TIMEOUT_MS=180000,HEATMAP_BROWSERLESS_CONNECT_TIMEOUT_MS=30000,HEATMAP_BROWSERLESS_BLOCK_ADS=False,- HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS=True,)@patch("products.web_analytics.backend.tasks.heatmap_screenshot.requests")def test_posts_full_page_body_with_viewport_width(@@ -200,7 +217,9 @@ class TestBrowserlessScreenshotRequest(SimpleTestCase):) -> None:mock_requests.post.return_value = _make_response(_jpeg(b"img"))- content = _browserless_screenshot("https://host/screenshot?token=t", "https://example.com", width)+ content = _browserless_screenshot(+ "https://host/screenshot?token=t", "https://example.com", width, block_consent_modals=True+ )assert content == _jpeg(b"img")body = mock_requests.post.call_args.kwargs["json"]@@ -223,21 +242,24 @@ class TestBrowserlessScreenshotRequest(SimpleTestCase):@patch("products.web_analytics.backend.tasks.heatmap_screenshot.requests")def test_block_ads_added_to_body_when_enabled(self, mock_requests: MagicMock) -> None:mock_requests.post.return_value = _make_response()- _browserless_screenshot("https://host/screenshot?token=t", "https://example.com", 1024)+ _browserless_screenshot(+ "https://host/screenshot?token=t", "https://example.com", 1024, block_consent_modals=False+ )assert mock_requests.post.call_args.kwargs["json"]["blockAds"] is True@override_settings(HEATMAP_BROWSERLESS_TIMEOUT_MS=180000,HEATMAP_BROWSERLESS_CONNECT_TIMEOUT_MS=30000,HEATMAP_BROWSERLESS_BLOCK_ADS=False,- HEATMAP_BROWSERLESS_BLOCK_CONSENT_MODALS=False,)@patch("products.web_analytics.backend.tasks.heatmap_screenshot.requests")def test_cloud_only_fields_omitted_when_disabled(self, mock_requests: MagicMock) -> None:# The self-hosted OSS browserless image rejects bodies carrying these cloud-only fields,# so disabling them must omit the keys entirely rather than send false.mock_requests.post.return_value = _make_response()- _browserless_screenshot("https://host/screenshot?token=t", "https://example.com", 1024)+ _browserless_screenshot(+ "https://host/screenshot?token=t", "https://example.com", 1024, block_consent_modals=False+ )body = mock_requests.post.call_args.kwargs["json"]assert "blockAds" not in bodyassert "blockConsentModals" not in body@@ -257,7 +279,7 @@ class TestBrowserlessScreenshotRequest(SimpleTestCase):mock_requests.post.side_effect = Exception("ECONNREFUSED https://host/screenshot?token=secret-token")with self.assertRaises(BrowserlessError) as ctx:- _browserless_screenshot(endpoint, "https://example.com", 1024)+ _browserless_screenshot(endpoint, "https://example.com", 1024, block_consent_modals=False)message = str(ctx.exception)# The token must never reach the (API-readable) persisted exception@@ -279,7 +301,9 @@ class TestBrowserlessScreenshotRequest(SimpleTestCase):# A 200 that isn't a real JPEG must not be stored and served as image/jpeg.mock_requests.post.return_value = _make_response(content, content_type=content_type)with self.assertRaises(BrowserlessError):- _browserless_screenshot("https://host/screenshot?token=t", "https://example.com", 1024)+ _browserless_screenshot(+ "https://host/screenshot?token=t", "https://example.com", 1024, block_consent_modals=False+ )@override_settings(HEATMAP_BROWSERLESS_TIMEOUT_MS=180000, HEATMAP_BROWSERLESS_CONNECT_TIMEOUT_MS=30000)@patch("products.web_analytics.backend.tasks.heatmap_screenshot.HEATMAP_SCREENSHOT_MAX_BYTES", 8)@@ -287,7 +311,9 @@ class TestBrowserlessScreenshotRequest(SimpleTestCase):def test_rejects_oversized_body_as_permanent(self, mock_requests: MagicMock) -> None:mock_requests.post.return_value = _make_response(_jpeg(b"way over the cap"))with self.assertRaises(BrowserlessPermanentError):- _browserless_screenshot("https://host/screenshot?token=t", "https://example.com", 1024)+ _browserless_screenshot(+ "https://host/screenshot?token=t", "https://example.com", 1024, block_consent_modals=False+ )# Pure-function tests for the Browserless URL helpers — no DB, so they run on SimpleTestCase.diff --git a/products/web_analytics/backend/test/test_heatmap_screenshots.py b/products/web_analytics/backend/test/test_heatmap_screenshots.pyindex 0f1925da062e..6dc8091d1f3d 100644--- a/products/web_analytics/backend/test/test_heatmap_screenshots.py+++ b/products/web_analytics/backend/test/test_heatmap_screenshots.py@@ -35,6 +35,50 @@ class TestHeatmapsAPI(APIBaseTest):self.assertEqual(saved.target_widths, [768, 1024])mock_task.assert_called_once_with(saved.id)+ @patch("products.web_analytics.backend.tasks.heatmap_screenshot.generate_heatmap_screenshot.delay")+ def test_create_defaults_consent_blocking_off(self, _mock_task):+ resp = self.client.post(+ f"/api/environments/{self.team.id}/saved/",+ {"url": "https://example.com"},+ )+ self.assertEqual(resp.status_code, 201)+ self.assertFalse(resp.data["block_consent_modals"])+ saved = SavedHeatmap.objects.get(id=resp.data["id"])+ self.assertFalse(saved.block_consent_modals)++ @patch("products.web_analytics.backend.tasks.heatmap_screenshot.generate_heatmap_screenshot.delay")+ def test_create_persists_consent_blocking_when_enabled(self, _mock_task):+ resp = self.client.post(+ f"/api/environments/{self.team.id}/saved/",+ {"url": "https://example.com", "block_consent_modals": True},+ )+ self.assertEqual(resp.status_code, 201)+ self.assertTrue(resp.data["block_consent_modals"])+ saved = SavedHeatmap.objects.get(id=resp.data["id"])+ self.assertTrue(saved.block_consent_modals)++ @patch("products.web_analytics.backend.api.heatmaps_api.generate_heatmap_screenshot")+ def test_partial_update_consent_toggle_triggers_regenerate(self, mock_task):+ saved = SavedHeatmap.objects.create(+ team=self.team,+ url="https://example.com",+ created_by=self.user,+ status=SavedHeatmap.Status.COMPLETED,+ type=SavedHeatmap.Type.SCREENSHOT,+ block_consent_modals=False,+ )+ HeatmapSnapshot.objects.create(heatmap=saved, width=1024, content=b"old")++ r = self.client.patch(+ f"/api/environments/{self.team.id}/saved/{saved.short_id}/",+ {"block_consent_modals": True},+ )+ self.assertEqual(r.status_code, 200)+ self.assertTrue(r.data["block_consent_modals"])+ self.assertEqual(r.data["status"], "processing")+ mock_task.delay.assert_called_once_with(saved.id)+ self.assertEqual(HeatmapSnapshot.objects.filter(heatmap=saved).count(), 0)+def test_content_returns_202_until_snapshot_exists(self):saved = SavedHeatmap.objects.create(team=self.team, url="https://example.com", created_by=self.user)r = self.client.get(f"/api/environments/{self.team.id}/heatmap_screenshots/{saved.id}/content/?width=1024")diff --git a/products/web_analytics/frontend/generated/api.schemas.ts b/products/web_analytics/frontend/generated/api.schemas.tsindex 5ba7c70469a1..c775f93ca8c0 100644--- a/products/web_analytics/frontend/generated/api.schemas.ts+++ b/products/web_analytics/frontend/generated/api.schemas.ts@@ -137,6 +137,8 @@ export interface HeatmapScreenshotResponseApi {readonly snapshots: readonly HeatmapSnapshotMetadataApi[]/** Soft-delete flag; deleted heatmaps are hidden from the list. */deleted?: boolean+ /** Whether the headless browser dismisses cookie/consent banners before capturing the screenshot. Only applies to 'screenshot' heatmaps. */+ block_consent_modals?: booleanreadonly created_by: UserBasicApireadonly created_at: stringreadonly updated_at: string@@ -232,6 +234,8 @@ export interface SavedHeatmapRequestApi {type?: HeatmapTypeApi/** Set true to soft-delete the saved heatmap. */deleted?: boolean+ /** When true, ask the headless browser to dismiss cookie/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps. */+ block_consent_modals?: boolean}export interface PatchedSavedHeatmapRequestApi {@@ -267,6 +271,8 @@ export interface PatchedSavedHeatmapRequestApi {type?: HeatmapTypeApi/** Set true to soft-delete the saved heatmap. */deleted?: boolean+ /** When true, ask the headless browser to dismiss cookie/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps. */+ block_consent_modals?: boolean}/**diff --git a/products/web_analytics/frontend/generated/api.zod.ts b/products/web_analytics/frontend/generated/api.zod.tsindex dc3fa7902544..bd8b88e88000 100644--- a/products/web_analytics/frontend/generated/api.zod.ts+++ b/products/web_analytics/frontend/generated/api.zod.ts@@ -51,6 +51,12 @@ export const SavedCreateBody = /* @__PURE__ */ zod.object({"Render mode: 'screenshot' (renders the page headlessly, default), 'iframe', or 'recording'. Only 'screenshot' generates image bytes.\n\n\* `screenshot` - Screenshot\n\* `iframe` - Iframe\n\* `recording` - Recording"),deleted: zod.boolean().optional().describe('Set true to soft-delete the saved heatmap.'),+ block_consent_modals: zod+ .boolean()+ .optional()+ .describe(+ "When true, ask the headless browser to dismiss cookie\/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps."+ ),})/**@@ -100,6 +106,12 @@ export const SavedPartialUpdateBody = /* @__PURE__ */ zod.object({"Render mode: 'screenshot' (renders the page headlessly, default), 'iframe', or 'recording'. Only 'screenshot' generates image bytes.\n\n\* `screenshot` - Screenshot\n\* `iframe` - Iframe\n\* `recording` - Recording"),deleted: zod.boolean().optional().describe('Set true to soft-delete the saved heatmap.'),+ block_consent_modals: zod+ .boolean()+ .optional()+ .describe(+ "When true, ask the headless browser to dismiss cookie\/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps."+ ),})/**diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 390a13e00b28..4a85ab91b2cd 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -24161,6 +24161,8 @@ export namespace Schemas {readonly snapshots: readonly HeatmapSnapshotMetadata[];/** Soft-delete flag; deleted heatmaps are hidden from the list. */deleted?: boolean;+ /** Whether the headless browser dismisses cookie/consent banners before capturing the screenshot. Only applies to 'screenshot' heatmaps. */+ block_consent_modals?: boolean;readonly created_by: UserBasic;readonly created_at: string;readonly updated_at: string;@@ -39133,6 +39135,8 @@ export namespace Schemas {type?: HeatmapType;/** Set true to soft-delete the saved heatmap. */deleted?: boolean;+ /** When true, ask the headless browser to dismiss cookie/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps. */+ block_consent_modals?: boolean;}export interface PatchedScheduledChange {@@ -45927,6 +45931,8 @@ export namespace Schemas {type?: HeatmapType;/** Set true to soft-delete the saved heatmap. */deleted?: boolean;+ /** When true, ask the headless browser to dismiss cookie/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps. */+ block_consent_modals?: boolean;}/**diff --git a/services/mcp/src/generated/web_analytics/api.ts b/services/mcp/src/generated/web_analytics/api.tsindex 5961e7c43086..7a2bcc4f8c3b 100644--- a/services/mcp/src/generated/web_analytics/api.ts+++ b/services/mcp/src/generated/web_analytics/api.ts@@ -294,6 +294,12 @@ export const SavedCreateBody = /* @__PURE__ */ zod.object({.describe("Render mode: 'screenshot' (renders the page headlessly, default), 'iframe', or 'recording'. Only 'screenshot' generates image bytes.\n\n* `screenshot` - Screenshot\n* `iframe` - Iframe\n* `recording` - Recording"),+ block_consent_modals: zod+ .boolean()+ .optional()+ .describe(+ "When true, ask the headless browser to dismiss cookie/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps."+ ),})/**@@ -362,6 +368,12 @@ export const SavedPartialUpdateBody = /* @__PURE__ */ zod.object({"Render mode: 'screenshot' (renders the page headlessly, default), 'iframe', or 'recording'. Only 'screenshot' generates image bytes.\n\n* `screenshot` - Screenshot\n* `iframe` - Iframe\n* `recording` - Recording"),deleted: zod.boolean().optional().describe('Set true to soft-delete the saved heatmap.'),+ block_consent_modals: zod+ .boolean()+ .optional()+ .describe(+ "When true, ask the headless browser to dismiss cookie/consent banners before capturing the screenshot. Off by default: the blocker can stall the render on some sites and time out. Only applies to 'screenshot' heatmaps."+ ),})/**diff --git a/services/mcp/src/tools/generated/web_analytics.ts b/services/mcp/src/tools/generated/web_analytics.tsindex 7f35c21b6934..05907be4fae1 100644--- a/services/mcp/src/tools/generated/web_analytics.ts+++ b/services/mcp/src/tools/generated/web_analytics.ts@@ -100,6 +100,9 @@ const heatmapsSavedCreate = (): ToolBase<typeof HeatmapsSavedCreateSchema, Schemif (params.type !== undefined) {body['type'] = params.type}+ if (params.block_consent_modals !== undefined) {+ body['block_consent_modals'] = params.block_consent_modals+ }const result = await context.api.request<Schemas.HeatmapScreenshotResponse>({method: 'POST',path: `/api/projects/${encodeURIComponent(String(projectId))}/saved/`,@@ -197,6 +200,9 @@ const heatmapsSavedUpdate = (): ToolBase<typeof HeatmapsSavedUpdateSchema, Schemif (params.deleted !== undefined) {body['deleted'] = params.deleted}+ if (params.block_consent_modals !== undefined) {+ body['block_consent_modals'] = params.block_consent_modals+ }const result = await context.api.request<Schemas.HeatmapScreenshotResponse>({method: 'PATCH',path: `/api/projects/${encodeURIComponent(String(projectId))}/saved/${encodeURIComponent(String(params.short_id))}/`,