Skip to content

Commit 38164f1

Browse files
Improve instructions
1 parent aa4b670 commit 38164f1

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

_docs/33_explained/20_platform-integration.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,30 @@ last_modified_at: 2025-07-04
77

88
Add an **Enable Simple Analytics** checkbox in your settings page.
99

10-
* When the user checks the box, inject the embed script below into their pages.
11-
* When the user unchecks, remove the script.
10+
- When the user checks the box, inject the embed script below into their pages.
11+
- When the user unchecks, remove the script.
1212

13-
![](https://assets.simpleanalytics.com/docs/explained/platform-integration.png)
13+
<img class="border" src="https://assets.simpleanalytics.com/docs/explained/platform-integration.png" alt="Simple Analytics integration in your platform" />
14+
15+
Usually it's just a user or team setting in your platform.
1416

1517
## Embed script
1618

19+
The only thing that's required, is enabling this script somewhere in the `<body>` (or `<head>`) of your platform when your user enables the *Simple Analytics Enabled* checkbox. They don't need to enter a website ID and don't need to create a Simple Analytics account before this checkbox can be enabled. We use the domain as an identifier.
20+
1721
```html
18-
<!-- Simple Analytics privacy first analytics -->
19-
<script async data-affiliate="<affiliate-code>" data-hostname="<customer_subdomain>.example.com" src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
22+
<!-- Simple Analytics platform integration -->
23+
<script async data-hostname="<customer_domain>" data-platform="<your-platform-name>" data-affiliate="<affiliate-code>" src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
2024
```
2125

22-
*`<customer_subdomain>`* is the stable identifier you create for that site on day one. Keep it even if the user changes domains later. It's also the hostname the Simple Analytics users will see in their dashboard.
23-
24-
*`<affiliate-code>`* is a unique code you can get from us which we use to attach it to every hit so new sign ups are credited to your account.
26+
- *`<customer_domain>`* (required) is the stable identifier you create for that site on day one. Usually this is `customerxxx.yourplatform.com`, or `customerdomain.com`. Keep it even if the user changes domains later. It's also the hostname the Simple Analytics users will see in their dashboard.
27+
- *`<your-platform-name>`* (required) is a unique name of your platform (eg.: `netlify`, `partner.com`, `kennis.shop`). This helps us linking all domains to your platform. Allowing us to give your users tailored instructions.
28+
- *`<affiliate-code>`* (optional) is a unique code you can get from us which we use to attach it to every hit so new sign ups are credited to your account. This is optional.
2529

2630
## Optional event tracking
2731

32+
This part is completely optional, but some users like it when implemented. You can track clicks on buttons, submitting of forms, or clicks on download links.
33+
2834
Add this helper once in `<head>`. You can include it for every customer. If the Simple Analytics script is not enabled the events remain in the browser and are ignored. When the script is enabled they are automatically sent to Simple Analytics servers.
2935

3036
```html
@@ -42,7 +48,9 @@ Front end events send with this function:
4248
sa_event("click_signup");
4349
```
4450

45-
Server side events:
51+
<details markdown="1">
52+
53+
<summary>How to implement thisServer side</summary>
4654

4755
```bash
4856
curl -X POST https://queue.simpleanalyticscdn.com/events \
@@ -56,11 +64,14 @@ curl -X POST https://queue.simpleanalyticscdn.com/events \
5664
}'
5765
```
5866

67+
</details>
68+
5969
## Testing
6070

6171
1. Spin up a test site.
6272
2. Enable the checkbox.
63-
3. Load a page and confirm hits appear in your Simple Analytics dashboard under the `affiliate-code` affiliate tab.
73+
3. Visit the test site.
74+
4. Check if there are requests to Simple Analytics in the Network tab of the Developer Tools.
6475

6576
## Support
6677

0 commit comments

Comments
 (0)