arp242 / goatcounter

Easy web analytics. No tracking of personal data.
https://www.goatcounter.com
Other
4.54k stars 190 forks source link

Having both overall and per site statistics #741

Open andreuvall opened 6 months ago

andreuvall commented 6 months ago

[!NOTE]
This is a very general question. I formulate it here in the spirit of

Open a GitHub issue. It’s fine to use this for support requests or general questions, as GitHub issues are public and the answers may be useful for others in the future.

I have created two personal pages using Quarto, and I am hosting them on GitLab Pages. Let's call them SiteA and SiteB. I am trying GoatCounter as a service. I am not hosting it for now. I read

Add GoatCounter to multiple websites by creating new sites.

and so I created two GoatCounter sites (codes), SiteA and SiteB, one for each site. I thought of using my main site (username, the site code associated to my user login) to also have the statistics of SiteA and SiteB together. In summary, my plan would be to

with the expectation of having

Let's focus on SiteA. I added the following script to my Quarto index.md

<script data-goatcounter="https://username.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
<script data-goatcounter="https://SiteA.goatcounter.com/count"    async src="//gc.zgo.at/count.js"></script>

which translates into the following lines in index.html

<script data-goatcounter="https://username.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
<script data-goatcounter="https://SiteA.goatcounter.com/count"    async="" src="//gc.zgo.at/count.js"></script>

With this, the dashboard for username works well, but the dashboard for SiteA doesn't receive any data.

Questions

arp242 commented 6 months ago

The first site you create during signup is no different than any other site you create later. There's a bit of stuff going on in the background with database IDs, but that should be transparent (e.g. you can create an account, create a new site, then delete the first site, and all the IDs will get moved to the second site, making all of this "transparent" from a UI perspective).

There isn't really any way to see multiple sites in one dashboard right now. What's your use case for this?

the dashboard for SiteA doesn't receive any data.

That should work, so don't know why it doesn't. If you tell your site I can take a look.

andreuvall commented 6 months ago

The first site you create during signup is no different than any other site you create later. There's a bit of stuff going on in the background with database IDs, but that should be transparent (e.g. you can create an account, create a new site, then delete the first site, and all the IDs will get moved to the second site, making all of this "transparent" from a UI perspective).

I don't quite understand this. Maybe I should experiment a bit with it.

the dashboard for SiteA doesn't receive any data.

That should work, so don't know why it doesn't. If you tell your site I can take a look.

Thank you, that's very generous! I'll send it to you per email. I prefer it over pasting the link here.

arp242 commented 6 months ago

I don't quite understand this. Maybe I should experiment a bit with it.

It's just there is no special "main site"; every site is treated equally, including the one created during signup. That's the short of it.

I'll reply to your other issue over email.

andreuvall commented 6 months ago

I have experimented a bit more with it.

What's your use case for this?

As said in my original message, the idea would be to achieve the following:

It is not essential, but I have been curious to try it out once more. Using count.js, it didn't work out. Now, I tried with the pixel tracking option. I added

<p>
<img src="[https://username.goatcounter.com/count?p=/?t=TitleSiteA](view-source:https://username.goatcounter.com/count?p=/?t=TitleSiteA)">
<img src="[https://SiteA.goatcounter.com/count?p=/?t=TitleSiteA](view-source:https://SiteA.goatcounter.com/count?p=/?t=TitleSiteA)">
</p>

to my index.html and this sort of works:

arp242 commented 6 months ago

You need to use …/count?p=/&t=TitleSiteA (&, not ?). There is only one ? after /count, and the rest of the parameters are separated by &.

andreuvall commented 6 months ago

Thank you, it works!