Skip to content

Commit 3814d10

Browse files
authored
Merge pull request #171 from CriticalMoments/analytics_instructions
Analytics instructions
2 parents 8d1b90a + 8bba640 commit 3814d10

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ After the steps above, you’ll have a working version like the demo page. Howev
321321
- Add actual SaaS functionality!
322322
- Replace the admin dashboard with real content (`/src/routes/(admin)/account/+page.svelte`).
323323
- Add API endpoints and database tables as needed to deliver your SaaS product.
324+
- Analytics: optionally add analytics to your project. [guide](/analytics_docs.md)
324325
325326
## Community Extensions
326327

analytics_docs.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Adding Analytics
2+
3+
Adding analytics to your SaaS Starter project is optional.
4+
5+
Since each analytics platform has different setup instructions, we've created a guide instead of adding it in code.
6+
7+
### PostHog
8+
9+
- Create a PostHog Account
10+
- Install PostHog JS Library
11+
- Run `npm install posthog-js` in your terminal. This will add PostHog dependencies to your `package.json` and `package-lock.json`.
12+
- Set Up PostHog
13+
- in `src/routes/+layout.svelte` add PostHog to the script section following the [Posthog Svelte Guide](https://posthog.com/docs/libraries/svelte#client-side-setup). Note: ensure you’re logged into PostHog so that the code includes your unique API key automatically.
14+
- Test analytics
15+
- Click around and view a few pages on your site to generate some events. You can view these events in PostHog to ensure tracking is active.
16+
17+
### Google Analytics
18+
19+
Follow the [Google Analytics Guide](https://support.google.com/analytics/answer/9304153?hl=en) to add Google Analytics to your project.
20+
21+
The ideal place to add Google Analytics is in `src/routes/+layout.svelte`.

0 commit comments

Comments
 (0)