Skip to content

Commit be4e921

Browse files
committed
Docs: Update readme
1 parent 5c22be9 commit be4e921

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

README.md

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,31 @@ By default, Plausible Analytics tracks every visitor to your website. When you'r
4949

5050
- Go to `your-domain.tld/~/disable-tracking`. This sets the flag and redirects the visitor to the homepage. Great for people without access to the Neos Backend.
5151
- As an Editor, you can enable/disable the flag also in the Plausible management module: `your-domain.tld/neos/management/plausible`
52+
- Add the component [Carbon.Plausible:Component.Toggle] to a document and click the button.
5253
- You can do this also by yourself by following the [excluding guide on plausible.io]
5354

55+
### Tracking custom event goals with `data-analytics`
56+
57+
To use this feature, you have to enable the `dataAnalyticsTracking` setting. Register events in the HTML with the use of an attribute tag `data-analytics`.
58+
59+
**Note: Watch your quotes!** Especially in the props as we want to be able to create an object.
60+
61+
```html
62+
<!-- Tracking a form -->
63+
<form>
64+
...
65+
<button type="submit" data-analytics='"Contact"'>Send Message...</button>
66+
</form>
67+
68+
<!-- Tracking a link -->
69+
<a
70+
href="/register"
71+
data-analytics='"Register", {"props":{"plan":"Navigation"}}'
72+
>
73+
Register
74+
</a>
75+
```
76+
5477
## Installation
5578

5679
Run the following command in your site package
@@ -67,15 +90,16 @@ Then run `composer update` in your project root.
6790

6891
If you have a single site setup, you can adjust the configuration under the key `Carbon.Plausible.default` in your [`Settings.yaml`]:
6992

70-
| Key | Default | Description |
71-
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
72-
| `domain` | `null` | Set here the [plausible domain]. This setting is required |
73-
| `host` | `null` | If you have set a [custom domain], you can set it here. Example: `stats.jonnitto.ch` |
74-
| `hashBasedRouting` | `false` | If you want the enable [Hash-based routing], set this to `true` |
75-
| `exclusions` | `false` | If you want to [exclude specific pages] from the analytics, you can set an array with strings or a string. If you want to load just the exclusion variant, set this to `true` |
76-
| `outboundLinks` | `false` | If you want the enable [outbound link click tracking], set this to `true` |
77-
| `customEvents` | `false` | If you want to set [custom events] in your javascript, set this to `true` or a string. If set to a string, this whole string gets included on every document. If you set custom events via Fusion or the [Carbon.Plausible:Mixin.CustomEvent] mixin, you don't have to set it to `true`. The snippet gets activated automatically if needed. The inline javascript get's minified with [JShrink] |
78-
| `sharedLink` | `null` | If you have opened up your [website stats to the public] or created a [private and secure link], enter it to enable the embedded view of the stats in the backend. |
93+
| Key | Default | Description |
94+
| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
95+
| `domain` | `null` | Set here the [plausible domain]. This setting is required |
96+
| `host` | `null` | If you have set a [custom domain], you can set it here. Example: `stats.jonnitto.ch` |
97+
| `hashBasedRouting` | `false` | If you want the enable [Hash-based routing], set this to `true` |
98+
| `exclusions` | `false` | If you want to [exclude specific pages] from the analytics, you can set an array with strings or a string. If you want to load just the exclusion variant, set this to `true` |
99+
| `outboundLinks` | `false` | If you want the enable [outbound link click tracking], set this to `true` |
100+
| `customEvents` | `false` | If you want to set [custom events] in your javascript, set this to `true` or a string. If set to a string, this whole string gets included on every document. If you set custom events via Fusion or the [Carbon.Plausible:Mixin.CustomEvent] mixin, you don't have to set it to `true`. The snippet gets activated automatically if needed. The inline javascript get's minified with [JShrink] |
101+
| `dataAnalyticsTracking` | `false` | If you want to enable `data-analytics` for tracking links and form submits set this to `true`. |
102+
| `sharedLink` | `null` | If you have opened up your [website stats to the public] or created a [private and secure link], enter it to enable the embedded view of the stats in the backend. |
79103

80104
### Multi-site setup
81105

@@ -109,7 +133,9 @@ Carbon:
109133
110134
The key of the site (e.g. `myfirstsite`) is the root node name found under Administration » Sites Management.
111135

112-
## Fusion Component
136+
## Fusion Components
137+
138+
### Carbon.Plausible:Component.TrackingCode
113139

114140
The main Fusion component is [Carbon.Plausible:Component.TrackingCode]. This component gets included into [Neos.Neos:Page] under the path `plausibleTrackingCode`. So if you want to add a [custom event][custom events] to a ceratin document, you can do it like this:
115141

@@ -119,6 +145,10 @@ prototype(Vendor.Site:Document.NotFound) < prototype(Neos.Neos:Page) {
119145
}
120146
```
121147

148+
### Carbon.Plausible:Component.Toggle
149+
150+
[Carbon.Plausible:Component.Toggle] is a small component to let the user if he wants to opt-out from tracking.
151+
122152
[packagist]: https://packagist.org/packages/carbon/plausible
123153
[latest stable version]: https://poser.pugx.org/carbon/plausible/v/stable
124154
[total downloads]: https://poser.pugx.org/carbon/plausible/downloads
@@ -147,5 +177,6 @@ prototype(Vendor.Site:Document.NotFound) < prototype(Neos.Neos:Page) {
147177
[hash-based routing]: https://plausible.io/docs/hash-based-routing
148178
[exclude specific pages]: https://plausible.io/docs/excluding-pages
149179
[carbon.plausible:component.trackingcode]: Resources/Private/Fusion/Component/TrackingCode.fusion
180+
[carbon.plausible:component.toggle]: Resources/Private/Fusion/Component/Toggle.fusion
150181
[neos.neos:page]: Resources/Private/Fusion/Override/Page.fusion
151182
[jshrink]: https://github.com/tedious/JShrink

0 commit comments

Comments
 (0)