analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Subdomain analytics

Open thibaultleouay opened this issue 2 years ago • 9 comments

For openstatus we allow users to create subdomain hosted under our own domain

They are rewritten using next middleware

Is it possible to track this subdomain ? Maybe with before send function?

Does the event contains the full request hostname ?

thibaultleouay avatar Aug 02 '23 21:08 thibaultleouay

We're already tracking the full hostname but we don't expose a hostname filter/domain selector yet. Do you want to filter for a specific domain eg my.custom-domain.com and see all the pageviews/events from it?

tobiaslins avatar Aug 03 '23 06:08 tobiaslins

yep that would do the job, I want to be able to differentiate the page views from our landing page www.openstatus.dev -> page / and custom-domain.openstatus.dev -> page /

What i thought of doing was something like these

<Analytics
  beforeSend={(event) => {
    if (event.host.includes('www')) {
      return event;
    } else {
    return {
      ...event,
      url: `/domain/${event.host}/${url.toString()}`,
    };;
    }
  }}
/>

thibaultleouay avatar Aug 03 '23 07:08 thibaultleouay

This is how I managed it

https://github.com/openstatusHQ/openstatus/blob/main/apps/web/src/app/_components/analytics.tsx

In order to catch the custom subdomain

Their might be a better way ?

thibaultleouay avatar Aug 03 '23 22:08 thibaultleouay

@thibaultleouay looks good. for now this is the only way to "see" that data. We'll let you know once we add support for hostnames!

tobiaslins avatar Aug 08 '23 07:08 tobiaslins

Hey, is there an update on this yet? I want to track analytics for a multi-tenant app. how do i do this ? Also the openstatus github link isn't working. Could you explain on how i can achieve this currently ?

nikl216 avatar Jan 04 '24 10:01 nikl216

@nikl216
We removed it from subdomain pages but you have achieve it like this : https://github.com/openstatusHQ/openstatus/blob/935787d332ea3f5ac36248ee1865e75790bc370e/apps/web/src/app/_components/analytics.tsx

thibaultleouay avatar Jan 04 '24 10:01 thibaultleouay

+1 for this feature, filter analytics by subdomain

im using multiple TLDs on a single project for localization (.com, .de, .fr) and cannot differentiate them in the analytics. this would be a very beneficial feature!

everettglovier avatar May 29 '24 14:05 everettglovier