Skip to content

Keep phone metadata when titles name automatic events - #122

Merged
adriaandotcom merged 1 commit into
v12from
fix/v12-titled-phone-metadata
Oct 16, 2026
Merged

adriaandotcom merged 1 commit into
v12from
fix/v12-titled-phone-metadata

Conversation

@simple-analytics-ai

@simple-analytics-ai simple-analytics-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Summary

Refs #107. Targets v12 for #40.

 titled tel: click
   retain title-derived event name
+  retain phone metadata

User steering: verify unresolved CodeRabbit findings, keep one change per PR, and minimize shipped bytes. Run the existing phone extraction even when the title supplies the event name; other event types retain their behavior.

Evidence

  • Before: tel:+31201234567?extension=42 with title="Call sales" sends phone_Call_sales without phone metadata; the regression test fails.
  • After: the same event includes phone: "+31201234567"; 54 offline unit tests pass.
  • Rebuilt latest and unreleased v12 distributions; ES5 parsing and formatting checks pass. Auto-events grows by 14 minified bytes / 9 gzip bytes, excluding generated headers; the main and light scripts are unchanged.
  • Frozen dependency install and 15 deployment tests pass. BrowserStack was not run locally.

Security implications

Titled phone events now contain the same phone metadata as untitled phone events. Query suffixes are excluded. Collection settings and phone event defaults remain as accepted for v12.

Merge Danger

Door: two-way

Blast Radius: phones

Checklist

Summary by CodeRabbit

  • Bug Fixes
    • Phone links with titles now retain the normalized phone number in event metadata while using the title as the event name.

User requested checking unresolved comments with a focus on CodeRabbit, separate reviewable changes, and minimal shipped bytes. Extract phone metadata before applying the existing title-derived event name and cover the regression.

Refs #107
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9909cf1a-bd3b-4162-839c-6dd018cb9ca2
📥 Commits

Reviewing files that changed from the base of the PR and between 6b84d42 and 64c2359.

⛔ Files ignored due to path filters: 8
  • dist/latest/auto-events.js is excluded by !**/dist/**
  • dist/latest/auto-events.js.map is excluded by !**/dist/**, !**/*.map
  • dist/latest/custom/auto-events.js is excluded by !**/dist/**
  • dist/latest/custom/auto-events.js.map is excluded by !**/dist/**, !**/*.map
  • dist/v12/auto-events.js is excluded by !**/dist/**
  • dist/v12/auto-events.js.map is excluded by !**/dist/**, !**/*.map
  • dist/v12/custom/auto-events.js is excluded by !**/dist/**
  • dist/v12/custom/auto-events.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing: 2
  • src/auto-events.js
  • test/unit/auto-events.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Titled phone links now extract the phone number into event metadata while using the title as the event name. A unit test verifies the event name and metadata.

Changes: Titled phone link metadata

Layer / File(s) Summary
Phone extraction and validation
src/auto-events.js, test/unit/auto-events.test.js
Phone links with titles now populate metadata.phone and use the title as the event name. The test checks the emitted event name, title, and normalized phone number.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: adriaandotcom

Merge Risk: ⚪ Minimal · up to 64c23

Titled phone links are intended to retain phone metadata while using the title as the event name; the examined untitled path is unchanged. No actionable merge risk remains.

### Architecture Summary

Architecture risk: 🔵 Low · up to 64c23

The change affects 2 systems.

Changed systems: src, test

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 1 changed file maps to changed impact.
  • observed — test (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in src/auto-events.js: Phone links now run the type-specific extraction even when a title is present, populating metadata.phone; the title is then used as the event name. Previously, a titled phone link skipped extraction.
  • observed — Modified behavior in test/unit/auto-events.test.js: Added a test for a titled tel: link, asserting the emitted event name uses the title and its metadata contains the title and phone number.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving phone metadata when a title provides the automatic event name.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Comment thread src/auto-events.js
if (useTitle) {
event = theTitle;
} else {
if (!useTitle || type === "phone") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Special-casing phone leaves the same metadata loss in place for the other three types: against the built script, a titled outbound/download link still sends no url and a titled mailto: link no email. Dropping the !useTitle || guard entirely (always run the switch, then let if (useTitle) event = theTitle; rename the event) fixes all four types and builds 19 minified / 10 gzip bytes smaller, at the cost of adding url/email metadata to titled links on existing installations.

@github-actions

Copy link
Copy Markdown

Documentation update

_docs/55_events/05_automated-events.md

Location: new ## Phones section, directly after the ## Downloads section and before ## Script

Copy and paste this into the documentation repository:

## Phones

Do you have `tel:` links on your website? Then you can see how many clicks you get on your phone links. Phone clicks are part of the default `data-collect` value (`outbound,emails,downloads,phones`), so they are collected without extra configuration.

The event name is based on the phone number in the link, without any query parameters: a click on `tel:+31201234567?extension=42` is sent as `phone_31201234567`. The number is also sent as `phone` metadata, so you can see the exact number that was clicked.

When `data-use-title` is enabled (the default) and the link has a `title` attribute, that title is used for the event name instead. A click on `<a href="tel:+31201234567" title="Call sales">` is sent as `phone_Call_sales`, and the `phone` metadata still contains `+31201234567`.

@github-actions

Copy link
Copy Markdown
Claude review checkpoint

Reviewed commit 64c23596a59979faa1d5c079fde16cf00ebc7d67. This is used to keep later automated reviews focused on changes Claude has not checked yet.

@github-actions github-actions Bot added the change: routine Changes to internal tools or low-risk changes (e.g., design updates or content modifications) label Oct 15, 2026
@github-actions

Copy link
Copy Markdown

SDLC label: change: routine because Scoped tracker bug fix that restores the already-collected phone metadata field on titled phone events; collection settings, defaults, permissions, billing and infrastructure are unchanged

@adriaandotcom
adriaandotcom merged commit 5ce3453 into v12 Oct 16, 2026
5 checks passed
@adriaandotcom
adriaandotcom deleted the fix/v12-titled-phone-metadata branch October 16, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change: routine Changes to internal tools or low-risk changes (e.g., design updates or content modifications)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant