From 8bba640bf5ac2e09b90359eb53c7fa1f536326e7 Mon Sep 17 00:00:00 2001 From: scosman Date: Tue, 5 Nov 2024 12:53:02 -0500 Subject: [PATCH] Move analytics to it's own README Add GA links --- README.md | 15 +-------------- analytics_docs.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 analytics_docs.md diff --git a/README.md b/README.md index 206d5dfe..488e84dc 100644 --- a/README.md +++ b/README.md @@ -321,20 +321,7 @@ After the steps above, you’ll have a working version like the demo page. Howev - Add actual SaaS functionality! - Replace the admin dashboard with real content (`/src/routes/(admin)/account/+page.svelte`). - Add API endpoints and database tables as needed to deliver your SaaS product. - -## Setup Analytics -- Optional - -### PostHog - -- Create a PostHog Account -- Install PostHog JS Library - - Run `npm install posthog-js` in your terminal. This will add PostHog dependencies to your `package.json` and `package-lock.json`. -- Set Up PostHog - - Create a new layout file at `src/routes/+layout.js` - - Log into PostHog. Then copy the code from [Svelte Client-side setup](https://posthog.com/docs/libraries/svelte#client-side-setup) and paste it into your `src/routes/+layout.js` file - - Note: ensure you’re logged into PostHog so that the code includes your unique API key automatically. -- Test analytics - - 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. +- Analytics: optionally add analytics to your project. [guide](/analytics_docs.md) ## Community Extensions diff --git a/analytics_docs.md b/analytics_docs.md new file mode 100644 index 00000000..24edf167 --- /dev/null +++ b/analytics_docs.md @@ -0,0 +1,21 @@ +# Adding Analytics + +Adding analytics to your SaaS Starter project is optional. + +Since each analytics platform has different setup instructions, we've created a guide instead of adding it in code. + +### PostHog + +- Create a PostHog Account +- Install PostHog JS Library + - Run `npm install posthog-js` in your terminal. This will add PostHog dependencies to your `package.json` and `package-lock.json`. +- Set Up PostHog + - 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. +- Test analytics + - 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. + +### Google Analytics + +Follow the [Google Analytics Guide](https://support.google.com/analytics/answer/9304153?hl=en) to add Google Analytics to your project. + +The ideal place to add Google Analytics is in `src/routes/+layout.svelte`.