analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Add the domain option to the tracker trigger

Open iizno opened this issue 1 year ago • 2 comments

Changes

Add the domain option to the tracker trigger

Below you'll find a checklist. For each item on the list, check one option and delete the other.

Tests

  • [X] This PR does not require tests

Changelog

  • [X] This PR does not make a user-facing change

Documentation

  • [X] This change does not need a documentation update

Dark mode

  • [X] This PR does not change the UI

iizno avatar Nov 16 '23 14:11 iizno

Sorry about the delay here :/ What's the use-case for this?

ukutaht avatar Apr 23 '24 08:04 ukutaht

Sorry about the delay here :/ What's the use-case for this?

Hello @ukutaht and thanks for you response. On our App, we are using Plausible, one domain per customer + one domain which we add to each customer. That let us get a "domain" with the sum of all the views from all of our customer.

For exemple, this is our data-domain for three of our customers :

 <script data-domain="client1.ourapp.com,all.ourapp.com">
 <script data-domain="client2.ourapp.com,all.ourapp.com">
 <script data-domain="client3.ourapp.com,all.ourapp.com">

But we only need the "events" on the customer domain, not the "all" one.

Without this Pull Request, we are doing this :

const domains_before = script.getAttribute('data-domain');

script.setAttribute('data-domain', domains_before.replace(',all.ourapp.com', ''));
window.plausible(event_name);
script.setAttribute('data-domain', domains_before);

iizno avatar Apr 23 '24 09:04 iizno