plausible-tracker icon indicating copy to clipboard operation
plausible-tracker copied to clipboard

Clarify setup for outbound click tracking

Open nztomas opened this issue 1 year ago • 3 comments

Sorry it's not very clear from your documentation if I need to add the additional .js file or if everything is already included in the module so when I switch on the option, the additional JS is included automatically.

"Outbound Link Click Tracking" is an enhanced measurement and not included in our default script. This is because we want to keep the default script as simple and lightweight as possible. The [additional enhanced measurements](https://plausible.io/docs/script-extensions) you can choose to add depending on your needs.

Detailed Description

Context

Possible Implementation

nztomas avatar Aug 04 '24 20:08 nztomas

Just trying to work out the same thing. I'm currently using plausible-tracker and the <script> snippet and it looks like it might be double-counting.

sfreytag avatar Aug 12 '24 16:08 sfreytag

@nztomas hi, it looks current repository is not actively maintained, so i've created my own implementation of plausible tracker for client side. You may check it at https://github.com/vitonsky/plausible-client

There you may just run next code to collect outbound clicks:

import { Plausible, enableAutoOutboundTracking } from 'plausible-client';

const plausible = new Plausible({
  apiHost: 'https://plausible.io',
  domain: 'example.org',
});

// Function returns cleanup callback and starts track outbound clicks
enableAutoOutboundTracking(plausible);

vitonsky avatar May 29 '25 09:05 vitonsky

Thanks - this looks good. I like the trackEvent filter too. I have an open issue to work on a bug related to this which would be fixed by your package, so I'll amend it to try out plausible-client instead.

sfreytag avatar May 29 '25 09:05 sfreytag