Skip to content

[feature] Track clicks on features and faqs#172

Merged
nemesifier merged 1 commit intomasterfrom
track-clicks
Feb 4, 2026
Merged

[feature] Track clicks on features and faqs#172
nemesifier merged 1 commit intomasterfrom
track-clicks

Conversation

@nemesifier
Copy link
Member

Track clicks on features and faqs.

@nemesifier nemesifier self-assigned this Feb 4, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Walkthrough

  • Added DOMContentLoaded handlers in js/faq.js and js/modal.js to attach click listeners that push Matomo _paq trackEvent calls for FAQ menu links and modal open links, respectively, only if _paq is defined.
  • Moved the scripts block in theme/templates/base.html to render after the Matomo block.
  • Appended cache-busting query parameters (?v=2) to script tags in theme/templates/page-faq.html and theme/templates/page-modal.html.
  • No changes to existing navigation or modal-opening logic; analytics hooks run independently and conditionally.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Browser as Browser
  participant Matomo as Matomo (_paq)

  Note over Browser: Page load
  Browser->>Matomo: Initialize _paq queue (MATOMO block)
  Browser->>Browser: Load page scripts (after MATOMO)
  Browser->>Browser: DOMContentLoaded handlers attach listeners if _paq exists

  alt FAQ link click
    User->>Browser: Click aside.faq .menu-list > li a
    Browser->>Matomo: _paq.push(['trackEvent','FAQ','Open', linkText])
  end

  alt Modal link click
    User->>Browser: Click a.open-modal
    Browser->>Matomo: _paq.push(['trackEvent','Modal','Open', linkText])
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding analytics tracking for clicks on features and FAQs sections.
Description check ✅ Passed The description is minimal but directly related to the changeset, which adds click tracking functionality for features and FAQs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch track-clicks

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4e2ced and c314d20.

📒 Files selected for processing (5)
  • js/faq.js
  • js/modal.js
  • theme/templates/base.html
  • theme/templates/page-faq.html
  • theme/templates/page-modal.html
🔇 Additional comments (5)
js/modal.js (1)

85-95: LGTM. The guarded tracking hook is isolated and doesn’t interfere with modal behavior.

js/faq.js (1)

57-67: LGTM. Conditional tracking is clean and keeps the existing FAQ navigation intact.

theme/templates/page-faq.html (1)

3-3: LGTM. Cache-busting query param is a safe update for refreshed assets.

theme/templates/page-modal.html (1)

4-4: LGTM. Cache-busting query param is a safe update for refreshed assets.

theme/templates/base.html (1)

261-261: LGTM. Script block placement looks consistent with the analytics setup order.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nemesifier nemesifier merged commit c314d20 into master Feb 4, 2026
3 checks passed
@nemesifier nemesifier deleted the track-clicks branch February 4, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant