You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Worst case projected costs](#worst-case-projected-costs)
11
+
-[What's in the box](#what-s-in-the-box)
12
+
*[Frontend](#frontend)
13
+
*[Backend](#backend)
14
+
*[Ingestion API](#ingestion-api)
15
+
-[Upgrading](#upgrading)
16
+
-[Sponsors](#sponsors)
17
+
-[Contributing](#contributing)
18
+
-[Roadmap](#roadmap)
19
+
3
20
This is a CDK serverless website analytics construct that can be deployed to AWS. This construct creates backend,
4
21
frontend and the ingestion APIs.
5
22
@@ -145,10 +162,17 @@ Then include the standalone script in your HTML:
145
162
<head> ... </head>
146
163
<body>
147
164
...
148
-
<scriptsrc="<YOUR BACKEND ORIGIN>/cdn/client-script.js"site="<THE SITE YOU ARE TRACKING>"></script>
165
+
<scriptsrc="<YOUR BACKEND ORIGIN>/cdn/client-script.js"site="<THE SITE YOU ARE TRACKING>"attr-tracking="true"></script>
149
166
</body>
150
167
</html>
151
168
```
169
+
You need to replace `<YOUR BACKEND ORIGIN>` with the origin of your deployed backend. Available attributes on the script
170
+
are:
171
+
-`site` - Required. The name of your site, this must correspond with the name you specified when deploying the
172
+
`serverless-website-analytics` backend.
173
+
-`attr-tracking` - Optional. If `"true"`, the script will track all `button` and `a` HTML elements that have the
174
+
`swa-event` attribute on them. Example: `<button swa-event="download">Download</button>`, it is also possible to
175
+
specify a category(`swa-event-category`) and the data(`swa-event-data`).
152
176
153
177
See the [client-side library](https://www.npmjs.com/package/serverless-website-analytics-client) for more options.
154
178
@@ -166,12 +190,12 @@ Irrelevant of the framework, you have to do the following to track page views on
166
190
site's `Origin` is whitelisted in the backend config.
167
191
2. On each route change call the `analyticsPageChange` function with the name of the new page.
168
192
169
-
The following sections show you how to do it in Vue, see [the readme of the client](https://github.com/rehanvdm/serverless-website-analytics-client-development#usage)
193
+
The following sections show you how to do it in Vue, see [the readme of the client](https://github.com/rehanvdm/serverless-website-analytics-client#usage)
170
194
for React and Svelte usage, but again the SDK allows for usage in **ANY framework**.
-[Worst case projected costs](#worst-case-projected-costs)
11
+
-[What's in the box](#what-s-in-the-box)
12
+
*[Frontend](#frontend)
13
+
*[Backend](#backend)
14
+
*[Ingestion API](#ingestion-api)
15
+
-[Upgrading](#upgrading)
16
+
-[Sponsors](#sponsors)
17
+
-[Contributing](#contributing)
18
+
-[Roadmap](#roadmap)
19
+
3
20
This is a CDK serverless website analytics construct that can be deployed to AWS. This construct creates backend,
4
21
frontend and the ingestion APIs.
5
22
@@ -145,10 +162,17 @@ Then include the standalone script in your HTML:
145
162
<head> ... </head>
146
163
<body>
147
164
...
148
-
<scriptsrc="<YOUR BACKEND ORIGIN>/cdn/client-script.js"site="<THE SITE YOU ARE TRACKING>"></script>
165
+
<scriptsrc="<YOUR BACKEND ORIGIN>/cdn/client-script.js"site="<THE SITE YOU ARE TRACKING>"attr-tracking="true"></script>
149
166
</body>
150
167
</html>
151
168
```
169
+
You need to replace `<YOUR BACKEND ORIGIN>` with the origin of your deployed backend. Available attributes on the script
170
+
are:
171
+
-`site` - Required. The name of your site, this must correspond with the name you specified when deploying the
172
+
`serverless-website-analytics` backend.
173
+
-`attr-tracking` - Optional. If `"true"`, the script will track all `button` and `a` HTML elements that have the
174
+
`swa-event` attribute on them. Example: `<button swa-event="download">Download</button>`, it is also possible to
175
+
specify a category(`swa-event-category`) and the data(`swa-event-data`).
152
176
153
177
See the [client-side library](https://www.npmjs.com/package/serverless-website-analytics-client) for more options.
154
178
@@ -166,12 +190,12 @@ Irrelevant of the framework, you have to do the following to track page views on
166
190
site's `Origin` is whitelisted in the backend config.
167
191
2. On each route change call the `analyticsPageChange` function with the name of the new page.
168
192
169
-
The following sections show you how to do it in Vue, see [the readme of the client](https://github.com/rehanvdm/serverless-website-analytics-client-development#usage)
193
+
The following sections show you how to do it in Vue, see [the readme of the client](https://github.com/rehanvdm/serverless-website-analytics-client#usage)
170
194
for React and Svelte usage, but again the SDK allows for usage in **ANY framework**.
0 commit comments