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

PoC: plausible client for server side #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GWSzeto
Copy link

@GWSzeto GWSzeto commented Feb 19, 2024

This is a quick PoC for supporting the plausible API on the server side for nextJS

The main inspiration came from the PostHog-node library which does something similar.

Structure

  • Setup as a class to create a persistent client. This would be helpful for inserting context into api route handlers (ie: tRPC)
  • Constructor accepts the baseApiUrl. This is for the self-hosted use case
  • event accepts 2 parameters: name, options
    • name => name of the custom event
    • options => these support passing in a custom domain and url

Admittedly, this structure supports my personal use-case, but it should be translatable to other's use cases fairly well

- Creates class for plausible node
- has event method to support sending custom events from the server
- Inspiration drawn from postHog-node library
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.

None yet

1 participant