Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having both overall and per site statistics #741

Open
andreuvall opened this issue May 22, 2024 · 6 comments
Open

Having both overall and per site statistics #741

andreuvall opened this issue May 22, 2024 · 6 comments

Comments

@andreuvall
Copy link

andreuvall commented May 22, 2024

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

  • Track SiteA with username and SiteA
  • Track SiteB with username and SiteB

with the expectation of having

  • Dashboard for username: with statistics of SiteA and SiteB together
  • Dashboard for SiteA: with statistics of SiteA only
  • Dashboard for SiteB: with statistics of SiteB only

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

  • Is there an alternative way to have both overall and per site statistics at the same time?
  • Maybe my approach makes sense but I am making a mistake in how I am adding the two counters to SiteA?
@arp242
Copy link
Owner

arp242 commented May 22, 2024

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
Copy link
Author

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
Copy link
Owner

arp242 commented May 22, 2024

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
Copy link
Author

andreuvall commented May 23, 2024

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:

  • Dashboard for username: with statistics of SiteA and SiteB together
  • Dashboard for SiteA: with statistics of SiteA only
  • Dashboard for SiteB: with statistics of SiteB only

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:

  • Both the dashboard for username and for SiteA see statistics from SiteA
  • The problem is that the query count?p=/?t=TitleSiteA is not interpreted as I'd want. It is interpreted as if the path were /?t=TitleSiteA. It's odd, because the same syntax gives the right title when I try the site locally, but when I push it to GitLab Pages, then the title stops working.

@arp242
Copy link
Owner

arp242 commented May 23, 2024

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
Copy link
Author

Thank you, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants