8000 fix(analytics): streamline posthog script loading and event capturing by aswwwanth · Pull Request #1974 · jackyzha0/quartz · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(analytics): streamline posthog script loading and event capturing #1974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2025

Conversation

aswwwanth
Copy link
Contributor

Fixes #1962

The posthogScript.onload() event isn't fired because we're not loading an external script (unlike other analytics providers). As a result, the pageview event wasn't being captured correctly.

This PR moves the pageview event-capturing logic inside the posthogScript itself, ensuring it registers properly when the script is loaded.

I've tested the changes locally and confirmed that events are now being sent correctly to PostHog.

Changes made:

  1. Moved pageview event capture into the inline posthogScript
  2. Removed a redudant pageview capture

Copy link
github-actions bot commented May 11, 2025
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
quartz ✅ Ready (View Log) Visit Preview b0c8829

Copy link
Collaborator
@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

I don't use posthog personally, but I assume that this fix works for you?

@aswwwanth
Copy link
Contributor Author

I don't use posthog personally, but I assume that this fix works for you?

Yes, it's working for me.

@aarnphm aarnphm merged commit 6d49d97 into jackyzha0:v4 May 24, 2025
6 checks passed
saberzero1 added a commit that referenced this pull request Jun 2, 2025
* fix(flex): respect DesktopOnly and MobileOnly components

* Use classNames util function

* fix(ofm): allow wikilink alias to be empty (#1984)

This is in line with Obsidian's behavior.

* fix(style): Katex adding scrollbars on non-overflowing content (#1989)

* feat(i18n): Bahasa Indonesia translations (#1981)

* fix(a11y): increased content-meta text contrast (#1980)

* fix(analytics): streamline posthog script loading and event capturing (#1974)

* css: adjust color blend for search bg

* feat(links): added ofm option to style unresolved or broken links differently (#1992)

* feat: add option to disable broken wikilinks

* fix(style): update hover color for broken links and introduce new class

* feat: add "disableBrokenWikilinks" option to ObsidianFlavoredMarkdown

* chore(deps): replace `chalk` and `rimraf` with builtin functions (#1879)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore(deps): bump the production-dependencies group across 1 directory with 9 updates (#1996)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Node 22 (#1997)

* docs: showcase housekeeping

* docs: fix explorernode references (closes #1985)

* fix: tz-less date parse in local tz instead of utc (closes #1615)

* docs: added note to not forget to add https:// to the plausible-host (for #1337) (#2000)

* docs: added note to not forget to add https:// to the plausible-host (for #1337)

* Update docs/configuration.md

---------

Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>

* Updated documentation

---------

Co-authored-by: Nizav <106657905+Ni-zav@users.noreply.github.com>
Co-authored-by: Aswanth <aswanth366@gmail.com>
Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>
Co-authored-by: Keisuke ANDO <g.kei0429@gmail.com>
Co-authored-by: fl0werpowers <47599466+fl0werpowers@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Moser <64004956+c2vi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PostHog pageview events are not being sent
2 participants
0