How to track your forms with Plausible Analytics
Count a form's visits in Plausible Analytics by pasting its script into a custom domain's code injection box, and what a goal can and cannot see.
Plausible Analytics is a lightweight, cookie-free analytics service. To have it count visits to a form made with Tinyform, the form has to be served from a custom domain: a connected domain has a Code injection box, and that box is where the Plausible script goes. There is no per-form analytics setting, and injected code never runs on the form's default /r/<id> link.
Connect a custom domain
Follow Custom domains and give the form a pretty URL on it.Open the code injection box
Go toDomains, pick the domain, and scroll toGeneral settingsfor the domain-wideCode injectionbox. A single pretty URL has its own box too, under its page settings; that one runs after the domain's code, on that page only.Get your Plausible snippet
Copy the tracking script Plausible shows for your site. It looks like the block below, with your own domain in it.Paste and save
Paste the script into the box and pressSave changes.
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
Injected scripts are run again after the page has mounted, so an ordinary analytics snippet works as it would on any page. From then on every visit to the form on that domain is a page view in Plausible.
Custom event goals
Plausible's custom event goals count things beyond a page view, such as a submission. Whether the form can feed one depends on where it is shown.
A form on its own page
A form on a custom-domain page fires no browser event of its own for a page turn or a submission, so there is nothing for an injected script to listen to there. Two things still work:
- Submissions. Turn on
Redirect on completionunderSettings,General, and send the visitor to a thank-you page on the same domain. A pageview goal on that page's path counts completions. - Multi-page drop-off. The form's own
Insightstab draws the per-question funnel underDrop-offs, counted on the server without any script.
An embedded form
When the form is embedded on a page you control and Track form events is on in the embed dialog, the frame posts a message to the host page for each event: form-view once the form is shown, and form-submit once the server has accepted the submission. A small script on the host page, next to the Plausible snippet, can turn those into goals:
<script>
window.addEventListener('message', function (e) {
var data = e.data;
if (!data || data.type !== 'tinyform-event') return;
if (data.event === 'form-submit') plausible('Form submitted');
if (data.event === 'form-view') plausible('Form viewed');
});
</script>
Each message also carries formId, so a page with several forms can name a goal per form. The embed's event forwarding is described in full on its own page.
Without any script
Sources, devices, countries, cities, browsers and operating systems for a form's visitors are on the Insights tab under Visits, beside the counts of visits, submissions and unique respondents. See Form Insights.