Skip to content
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

[Analytics][l]: #238 Add support for plausible, simpleanalytics, Google, PostHog analytics #614

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

mohamedsalem401
Copy link
Contributor

@mohamedsalem401 mohamedsalem401 commented Jan 5, 2024

For #238

  1. The configuration for analytics would be something like: config.mjs
    analyticsConfig: {
        plausibleAnalytics: {
            plausibleDataDomain: 'tailwind-nextjs-starter-blog.vercel.app',
        },
        simpleAnalytics: {
            src: "https://scripts.simpleanalyticscdn.com/latest.js"
        },
        umamiAnalytics: {
            umamiWebsiteId: '123e4567-e89b-12d3-a456-426614174000',
        },
        posthogAnalytics: {
            posthogProjectApiKey: '123e4567-e89b-12d3-a456-426614174000',
        },
        googleAnalytics: {
            googleAnalyticsId: 'G-XXXXXXX', // e.g. G-XXXXXXX
        },
    }
  1. The user can add more than a single analytics at the same time
  2. Old analytics for users would work just fine
  3. No documentation has been updated yet

Copy link

vercel bot commented Jan 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowershow-ssr-r2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2024 10:15pm

@mohamedsalem401 mohamedsalem401 changed the title [Analytics][l]: Add support for plausible, simpleanalytics, Google, PostHob analytics [Analytics][l]: Add support for plausible, simpleanalytics, Google, PostHog analytics Jan 5, 2024
@rufuspollock
Copy link
Member

rufuspollock commented Jan 9, 2024

@mohamedsalem401 did you follow pliny here? Could we even directly reuse pliny via importing their modules?

And could you reference the issue this came from in the PR please 🙏

@mohamedsalem401
Copy link
Contributor Author

@rufuspollock Yes I did follow Pliny.
I don't think they export this directly, but I will check again

@mohamedsalem401 mohamedsalem401 changed the title [Analytics][l]: Add support for plausible, simpleanalytics, Google, PostHog analytics [Analytics][l]: #238 Add support for plausible, simpleanalytics, Google, PostHog analytics Jan 9, 2024
@rufuspollock
Copy link
Member

rufuspollock commented Jan 9, 2024

@mohamedsalem401 should these changes be upstream in the core repo i.e. https://github.com/datopian/portaljs/tree/main/packages/core/src? (I'm not certain but wanted to check).

Generally, we want stuff in a core library and then we just import the parts we want in the template (in a perfect world we only import something if we use it). cf how pliny approaches this ...

@mohamedsalem401
Copy link
Contributor Author

@rufus, as per your suggestion, I managed to find the npm package for Pliny: https://www.npmjs.com/package/pliny. It doesn't have any documentation, I tried to pull the components of the npm package. It didn't workout ( without even throwing any error )

1- I will see if I should push those changes to https://github.com/datopian/portaljs/tree/main/packages/core/src
2- Should I update the documentation ( open a PR ) for the multiple analytic in flowershow-app? https://github.com/datopian/flowershow-app/blob/main/content/docs/analytics.md

@mohamedsalem401 mohamedsalem401 merged commit d5acfe2 into main Jan 18, 2024
3 checks passed
@mohamedsalem401 mohamedsalem401 deleted the analytics branch January 18, 2024 23:21
@mohamedsalem401
Copy link
Contributor Author

I moved the components to @portaljs/core and updated the code.

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.

2 participants