Repository navigation
feat: Migrate Analytics From Universal Analytics to GA4 - #33
Merged
Merged
Conversation
The page carried UA-120608786-1. Google stopped processing Universal Analytics data on 1 July 2023 and deleted standard UA properties from 1 July 2024, so the tag has loaded without recording anything since. Point the tag at the GA4 property G-KF4ZEM295Z and override page_location to origin + pathname. GA4 otherwise reports the full href, and the ?invoice= parameter this page accepts would put the user's invoice, offer or payer proof into Google's reports. Add decode_success and decode_error events so the reports show what the tool is actually used for rather than page views alone. request_kind is the decoded model kind on success and the leading prefix on failure, narrowed to the eight prefixes the page decodes; error_stage sorts the 82 distinct error messages into five buckets. Both parameters draw on fixed vocabularies, so no part of the request string is transmitted. Events fire 1.5s after input settles, since updatePage runs on every keystroke.
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.
Problem
index.htmlloadedUA-120608786-1, a Universal Analytics property. Google stopped processing UA data on 1 July 2023 and deleted standard UA properties from 1 July 2024. The tag still loads and still returns a container, so nothing looks broken, but no hit has reached a report in three years. The site has had no working analytics for that entire period.A straight swap to GA4 would also introduce a leak. GA4 sets
page_locationfromdocument.location.href, andrender.jsaccepts an?invoice=parameter. Every shared link would send the full BOLT 11 invoice or BOLT 12 string — payment hashes, node pubkeys, amounts, and forlnppayer proofs the payer identity — to Google.Solution
Point the tag at GA4 property
G-KF4ZEM295Zand overridepage_locationtoorigin + pathname.Add
decode_successanddecode_errorevents, so reports show which formats people decode rather than page views alone.request_kindismodel.kindon success and the leading prefix on failure, narrowed to the eight prefixes the page decodes; anything else reportsunknown.error_stagesorts the 82 distinct error messages intoinput,format,structure,signatureandvalidation. Both parameters draw on fixed vocabularies, so no part of the request string is transmitted — which also keeps the custom dimensions under GA4's cardinality limits.updatePageruns on every keystroke, so events fire 1.5s after input settles. Verified in a fake-DOM harness: 60 keystrokes produce one event, an empty box produces none, and the page still renders when an ad blocker removesgtag.Both parameters need registering as event-scoped custom dimensions in the GA4 UI before they appear in reports.