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
Here's how to add Plausible Analytics to your Carrd site and set up the tracking of custom events such as button clicks and form submissions.
7
+
Here's how to add Plausible Analytics to your Carrd site and set up the tracking of custom events such as button clicks.
8
8
9
-
## How to add Plausible to your Carrd website
9
+
## How to add Plausible to your Carrd website
10
10
11
-
### Enable "Hashed page paths" for your site in your Plausible account
11
+
### Get your site snippet
12
12
13
-
Carrd is a one-page website builder that doesn't support normal navigation. This means that you can enable "**Hashed page paths**" tracking as an optional measurement when adding a new site to your Plausible account. If the site has already been added to your account, you can control how data is collected in the "**Site Installation**" area of the "**General**" section in your [site settings](website-settings.md).
14
-
15
-
<img alt="Enable hashed page paths tracking during onboarding" src={useBaseUrl('img/onboarding-enable-hash-based-tracking.png')} />
16
-
17
-
Plausible tracking snippet changes depending on your selection of optional measurements. When making changes to your optional measurements, do ensure to insert the newest snippet into your site for all tracking to work as expected.
13
+
We display your snippet during the process of adding a new site to your account. You can also see the snippet within the "**Site Installation**" area of the "**General** section in your [site settings](website-settings.md).
18
14
19
15
### Go to your Carrd website editor
20
16
21
17
* Go to the editor of your Carrd website and add an "**Embed**" component.
22
18
23
19
<img alt="Add embed element to Carrd" src={useBaseUrl('img/add-embed-element-to-carrd.png')} />
24
20
25
-
* In the element's settings make sure:
21
+
* In the element's settings make sure:
26
22
27
23
- Type is set to "**Code**"
28
24
- Style is set to "**Hidden**" and "**Head**"
29
25
30
26
* Then paste your Plausible tracking script in the **Code** field
31
27
28
+
* In the snippet, update `plausible.init()` to `plausible.init({ hashBasedRouting: true })`. This allows plausible to track hashed page paths that Carrd uses during navigation.
29
+
32
30
* Do click on the "**Done**" button and then "**Publish**" your changes. After you change the tracking snippet on your site, all the hash-based page paths on your Carrd website will start being tracked and will be displayed in the "**Top Pages**" report of your Plausible Analytics dashboard.
33
31
34
32
<img alt="Add Plausible Analytics script to Carrd" src={useBaseUrl('img/add-plausible-script-to-carrd.png')} />
@@ -41,97 +39,25 @@ Now you can go to your Carrd website and verify that Plausible script has been a
41
39
As an alternative to custom events, check out [pageview goals](pageview-goals.md). Since pageviews are collected automatically, you don’t need to change your website’s code to measure pageview goals. This makes pageview goals the easiest way to start tracking any type of conversions.
42
40
:::
43
41
44
-
### 1. Enable "Custom events" for your site
45
-
46
-
You can enable "**Custom events**" as an optional measurement when adding a new site to your Plausible account. If the site has already been added to your account, you can control what data is collected in the "**Site Installation**" area of the "**General** section in your [site settings](website-settings.md).
47
-
48
-
### 2. Change the snippet on your site
49
-
50
-
The tracking snippet changes depending on your selection of optional measurements. When making changes to your optional measurements, do ensure to insert the newest snippet into your site for all tracking to work as expected. We display your snippet during the process of adding a new site to your account. You can also see the snippet within the "**Site Installation**" area of the "**General** section in your [site settings](website-settings.md).
51
-
52
-
### 3. Trigger custom events with JavaScript on your site
53
-
54
-
Here's the code you will need to insert in the `<head>` section of the page where the element ID that you want to track is located. You can use the "**Custom Code**" feature to do this similarly to how you've inserted the Plausible snippet into your site.
55
-
56
-
Make sure to change the `elementId` line in the code below to include the ID attribute of the element you want to track (`form01` in our example). In Carrd forms have default IDs. Usually they're assigned IDs based on the order you've added them. If you only have one form on the page it has an ID of "**form01**". If you're on a higher plan, like Pro Plus, you'll be able to set these IDs yourself from the element's settings.
57
-
58
-
Also do change the `classes` line to include the goal name in this format: `plausible-event-name=Goal+Name`. The goal name is completely up to you. It's the name under which the goal conversions will appear in your Plausible dashboard. We've used `Form+Submit` goal name in our example.
59
-
60
-
:::tip To represent a space character in goal names, you can use a `+` sign
61
-
For example: `plausible-event-name=Form+Submit` will display as `Form Submit` in your Plausible dashboard
62
-
:::
63
-
64
-
```html
65
-
<script>
66
-
var toTag = [
67
-
{
68
-
elementId:'form01',
69
-
classes:'plausible-event-name=Form+Submit'
70
-
}
71
-
]
72
-
73
-
document.addEventListener('DOMContentLoaded', function (_e) {
74
-
toTag.forEach(function (tagObject) {
75
-
var element =document.getElementById(tagObject.elementId)
<img alt="Modify Plausible script Carrd for form tracking" src={useBaseUrl('img/track-form-submissions-carrd.png')} />
85
-
86
-
Now you'll have to click on the form element to select it, click on the gear icon to access the form settings and then on "**Events**" tab. Add the same script as above in the "**On Success**" event box
87
-
88
-
```html
89
-
<script>
90
-
var toTag = [
91
-
{
92
-
elementId:'form01',
93
-
classes:'plausible-event-name=Form+Submit'
94
-
}
95
-
]
96
-
97
-
document.addEventListener('DOMContentLoaded', function (_e) {
98
-
toTag.forEach(function (tagObject) {
99
-
var element =document.getElementById(tagObject.elementId)
<img alt="On success form tracking in Carrd" src={useBaseUrl('img/track-form-submissions-submit-carrd.png')} />
42
+
You can enable form submission tracking as an optional measurement when adding a new site to your Plausible account. If the site has already been added to your account, you can control how data is collected in the "**Site Installation**" area of the "**General**" section in your [site settings](website-settings.md).
109
43
110
44
## Tracking button clicks and other links on your Carrd site
111
45
112
-
### 1. Enable "Custom events" for your site
113
-
114
-
You can enable "**Custom events**" as an optional measurement when adding a new site to your Plausible account. If the site has already been added to your account, you can control what data is collected in the "**Site Installation**" area of the "**General** section in your [site settings](website-settings.md).
115
-
116
-
### 2. Change the snippet on your site
46
+
### 1. Set an ID to the element you want to track
117
47
118
-
The tracking snippet changes depending on your selection of optional measurements. When making changes to your optional measurements, do ensure to insert the newest snippet into your site for all tracking to work as expected. We display your snippet during the process of adding a new site to your account. You can also see the snippet within the "**Site Installation**" area of the "**General** section in your [site settings](website-settings.md).
48
+
In Carrd buttons and links have default IDs. Usually they're assigned IDs based on the order you've added them. So first button or link has an ID of "**buttons01**"/"**links01**", second button or link has an ID of "**buttons02**"/"**links02**" and so on and so forth.
119
49
120
-
### 3. Set an ID to the element you want to track
50
+
If you're on a higher plan, like Pro Plus, you'll be able to set these IDs yourself from the element's settings.
121
51
122
-
In Carrd buttons and links have default IDs. Usually they're assigned IDs based on the order you've added them. So first button or link has an ID of "**buttons01**"/"**links01**", second button or link has an ID of "**buttons02**"/"**links02**" and so on and so forth.
123
-
124
-
If you're on a higher plan, like Pro Plus, you'll be able to set these IDs yourself from the element's settings.
125
-
126
-
To be sure of your element's ID, you can use your browser's dev tool to inspect the element.
52
+
To be sure of your element's ID, you can use your browser's dev tool to inspect the element.
127
53
128
54
<img alt="Confirm element ID in Carrd" src={useBaseUrl('img/confirm-element-id-carrd.png')} />
129
55
130
-
### 4. Trigger custom events with JavaScript on your site
56
+
### 2. Trigger custom events with JavaScript on your site
131
57
132
58
Here's the code you will need to insert in the `<head>` section of the page where the element ID that you want to track is located. You can use the "**Custom Code**" feature to do this similarly to how you've inserted the Plausible snippet into your site.
133
59
134
-
Make sure to change the `elementId` line in the code below to include the ID attribute of the element you want to track (`buttons01` in our example).
60
+
Make sure to change the `elementId` line in the code below to include the ID attribute of the element you want to track (`buttons01` in our example).
135
61
136
62
Also do change the `classes` line to include the goal name in this format: `plausible-event-name=Goal+Name`. The goal name is completely up to you. It's the name under which the goal conversions will appear in your Plausible dashboard. We've used `Button+Click` goal name in our example.
137
63
@@ -159,21 +85,21 @@ Also do change the `classes` line to include the goal name in this format: `plau
159
85
160
86
Do click on the "**Save Changes**" button and then "**Publish**" your changes.
161
87
162
-
### 5. Create a custom event goal in your Plausible account
88
+
### 3. Create a custom event goal in your Plausible account
163
89
164
90
When you send custom events to Plausible, they won't show up in your dashboard automatically. You'll have to configure the goal for the conversion numbers to show up.
165
91
166
-
To configure a goal, go to [your website's settings](website-settings.md) in your Plausible account and visit the "**Goals**" section.
92
+
To configure a goal, go to [your website's settings](website-settings.md) in your Plausible account and visit the "**Goals**" section.
167
93
168
94
Click on the "**+ Add goal**" button to go to the goal creation form. Select `Custom event` as the goal trigger and enter the name of the custom event you are triggering. The name must be an exact match to the one you added to your site for the conversions to show up in your dashboard.
169
95
170
96
So in our example where we added a goal name `plausible-event-name=Button+Click` to the Carrd site, the goal to add in the Plausible account is `Button Click` (plus is replaced by a space).
171
97
172
98
<img alt="Add your custom event goal" src={useBaseUrl('img/button-click-custom-event-goal-carrd.png')} />
173
99
174
-
Next, click on the "**Add goal**" button and you'll be taken back to the Goals page.
100
+
Next, click on the "**Add goal**" button and you'll be taken back to the Goals page.
175
101
176
-
### 6. Your goal should now be ready and tracking
102
+
### 4. Your goal should now be ready and tracking
177
103
178
104
Your goal should now be set up. When you navigate back to your Plausible Analytics dashboard, you should see the number of visitors who triggered the custom event. Goal conversions are listed at the very bottom of the dashboard. The goal will show up in your dashboard as soon as it has been completed at least once.
179
105
@@ -186,11 +112,11 @@ If you want to trigger multiple custom events on the same site, you don't need t
0 commit comments