analytics/lib/plausible_web/plugs
RobertJoonas 135471c32e
Add tagged-events script extension (#2333)
Adds a new script extension that allows tracking interactions with specific HTML elements on a website. For example - to track link clicks on one specific `<a>` element, you can tag it like this:

```html
<a href=... class="plausible-event-name=<your_event_name>">
```

And you can also tag the link with custom property names and values:

```html
<a href=... class="plausible-event-name=<your_event_name> plausible-event-<your_custom_prop>=<your_value>">
```

Tagging a link as above will send a custom event with the given name and props, if a `click` or `auxclick` browser event happens, and targets the link element.

The tracking behavior is somewhat different based on the HTML element type:  

- `<a>` 
  - triggers on `click` and `auxclick` events
  - intercepts navigation based on the same rules as `outbound-links` and `file-downloads`
- `<form>`
  - triggers on `submit` event
  - always intercepts navigation (calls `form.submit()` after preventing default and sending the Plausible event)
- other (`<img>`, `<button>`, `<span>`, `<div>`, `<h2>`, etc ...)
  - triggers on `click` and `auxclick` events
  - does not prevent default to intercept possible navigation. Simply calls Plausible with the event name and props read from the element class list.
2022-11-21 16:17:44 +02:00
..
auth_plug.ex OpenTelemetry (OTEL) Implementation (#2317) 2022-10-18 12:11:30 -03:00
authorize_site_access.ex OpenTelemetry (OTEL) Implementation (#2317) 2022-10-18 12:11:30 -03:00
authorize_sites_api.ex Add limit of 20 sites 2021-05-05 10:30:05 +03:00
authorize_stats_api.ex OpenTelemetry (OTEL) Implementation (#2317) 2022-10-18 12:11:30 -03:00
crm_auth_plug.ex Allow admin access to locked dashboards (#1710) 2022-02-23 13:48:33 -06:00
favicon.ex Fix svg favicons (#2295) 2022-10-04 13:20:51 +03:00
firewall.ex Mix format 2020-11-03 11:20:11 +02:00
first_launch_plug.ex improve first launch experience for self-hosters (#2357) 2022-11-10 12:42:22 +01:00
last_seen_plug.ex Formatting only changes - No code change (#75) 2020-06-08 10:35:13 +03:00
require_account.ex Add ability to delete account and start over in activate flow 2021-04-01 10:43:32 +03:00
require_logged_out.ex Add elixir action (#526) 2020-12-29 15:17:27 +02:00
session_timeout_plug.ex Formatting only changes - No code change (#75) 2020-06-08 10:35:13 +03:00
tracker.ex Add tagged-events script extension (#2333) 2022-11-21 16:17:44 +02:00