Fix incomplete ALLURE_NO_ANALYTICS opt-out in report html template#3332
Merged
baev merged 2 commits intoMay 11, 2026
Merged
Conversation
The <#if analyticsDisable == false> guard in index.html.ftl wrapped
only the external gtag.js <script> tag. The inline block that calls
gtag('config', 'G-FVWC4GKEYS', { allureVersion, reportUuid, single_file })
ran unconditionally, populating window.dataLayer and defining the
gtag() function even when analytics were disabled via
ALLURE_NO_ANALYTICS.
With gtag.js absent the data went nowhere, so behavior was harmless,
but the opt-out leaked report metadata into a dataLayer that any
co-located script could read. Extend the guard to wrap both scripts
so ALLURE_NO_ANALYTICS removes the entire analytics surface from the
rendered report.
Strengthen ReportWebGeneratorTest#shouldDisableAnalytics to also
assert the measurement id and dataLayer are absent, which the
previous googletagmanager-only check did not catch.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
2 tasks
baev
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The
<#if analyticsDisable == false>guard inallure-generator/src/main/resources/tpl/index.html.ftlonly wrapped the externalgtag.js<script>tag. The inline block that callsran unconditionally — even when the user had set
ALLURE_NO_ANALYTICS=1. Withoutgtag.jsloaded the data goes nowhere, so user-visible behavior didn't change, but the opt-out leaked report metadata into awindow.dataLayerthat any co-located script (a future plugin, an embed, a downstream HTML processor) could read, and it left a globalgtag()function defined on the disabled path.This PR extends the guard to wrap both scripts so
ALLURE_NO_ANALYTICSremoves the entire analytics surface from the rendered report.While here,
ReportWebGeneratorTest#shouldDisableAnalyticsis strengthened to also assert the measurement id (G-FVWC4GKEYS) anddataLayerare absent from the generated HTML. The previous single-string check ongoogletagmanagerwould have passed even with the leak, which is why the gap went unnoticed.Checklist