Support Matomo and Google analytics #21

Closed
opened 2025-11-02 03:04:27 -06:00 by GiteaMirror · 28 comments
Owner

Originally created by @joubertredrat on GitHub (Nov 3, 2016).

Hi guys,

I think that Gitea can have support to Piwik or Google analytics. What you think?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38917746-support-to-piwik-and-google-analytics?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github).
Originally created by @joubertredrat on GitHub (Nov 3, 2016). Hi guys, I think that Gitea can have support to [Piwik](https://piwik.org/) or Google analytics. What you think? <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38917746-support-to-piwik-and-google-analytics?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github). </bountysource-plugin>
GiteaMirror added the type/feature label 2025-11-02 03:04:27 -06:00
Author
Owner

@xinity commented on GitHub (Nov 3, 2016):

@joubertredrat what would piwik or analytics benefits for ?

@xinity commented on GitHub (Nov 3, 2016): @joubertredrat what would piwik or analytics benefits for ?
Author
Owner

@joubertredrat commented on GitHub (Nov 3, 2016):

@xinity for general purpose is only to see visitors logs, mine case in specific I scale my gogs instance vertically based on visitors reports and instance performance (cpu, memory, hd).

Personally I prefer https://github.com/gogits/gogs/issues/3004 instead this, but can be dangerous if Gitea owner not understand about javascript.

@joubertredrat commented on GitHub (Nov 3, 2016): @xinity for general purpose is only to see visitors logs, mine case in specific I scale my gogs instance vertically based on visitors reports and instance performance (cpu, memory, hd). Personally I prefer https://github.com/gogits/gogs/issues/3004 instead this, but can be dangerous if Gitea owner not understand about javascript.
Author
Owner

@tboerger commented on GitHub (Nov 3, 2016):

IMHO this is a pretty common use case for hosted services, so we should provide two simple config options, one for piwik and one for google analytics, without modifying the custom templates.

@tboerger commented on GitHub (Nov 3, 2016): IMHO this is a pretty common use case for hosted services, so we should provide two simple config options, one for piwik and one for google analytics, without modifying the custom templates.
Author
Owner

@xinity commented on GitHub (Nov 3, 2016):

@joubertredrat i see thanks for the update.
indeed for hosted services that would use gitea it could be nice to have this kind of feature

@xinity commented on GitHub (Nov 3, 2016): @joubertredrat i see thanks for the update. indeed for hosted services that would use gitea it could be nice to have this kind of feature
Author
Owner

@bkcsoft commented on GitHub (Nov 4, 2016):

Maybe allow to inject custom js-scripts at the bottom of template/base/footer.tmpl ? That way we don't need to maintain the function ourselfs 😅 and people using other analytics-services can easily inject their own 💯

After that one could extend it to have a few "default" scripts (such as GAnalytics/Piwik) to choose from 🙂

Please keep the change in a single MR as small as possible. If you want to contribute a large feature think very hard what the minimum viable change is. Can you split the functionality? Can you only submit the backend/API code? Can you start with a very simple UI? Can you do part of the refactor? The increased reviewability of small MRs that leads to higher code quality is more important to us than having a minimal commit log. The smaller an MR is the more likely it is it will be merged (quickly). After that you can send more MRs to enhance it.

Reference: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md

@bkcsoft commented on GitHub (Nov 4, 2016): Maybe allow to inject custom js-scripts at the bottom of `template/base/footer.tmpl` ? That way we don't need to maintain the function ourselfs :sweat_smile: and people using other analytics-services can easily inject their own :100: After that one could extend it to have a few "default" scripts (such as GAnalytics/Piwik) to choose from :slightly_smiling_face: > Please keep the change in a single MR as small as possible. If you want to contribute a large feature think very hard what the **minimum viable change** is. Can you split the functionality? Can you only submit the backend/API code? Can you start with a very simple UI? Can you do part of the refactor? The **increased reviewability of small MRs** that leads to higher code quality is more important to us than having a minimal commit log. The smaller an MR is the more likely it is it will be merged (quickly). After that you can **send more MRs to enhance it**. Reference: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md
Author
Owner

@joubertredrat commented on GitHub (Nov 4, 2016):

yes @bkcsoft, can be defined templates for piwik, GA and if you define idSite for piwik or UA for GA on config, Gitea add this templates on render and set code into then.

@joubertredrat commented on GitHub (Nov 4, 2016): yes @bkcsoft, can be defined templates for piwik, GA and if you define idSite for piwik or UA for GA on config, Gitea add this templates on render and set code into then.
Author
Owner

@jag3773 commented on GitHub (Nov 29, 2016):

We've implemented support for GA like this https://github.com/unfoldingWord-dev/gogs/pull/97/files . We can issue a PR for this if it's useful for others here.

@jag3773 commented on GitHub (Nov 29, 2016): We've implemented support for GA like this https://github.com/unfoldingWord-dev/gogs/pull/97/files . We can issue a PR for this if it's useful for others here.
Author
Owner

@tboerger commented on GitHub (Nov 29, 2016):

That's only the first step, it also needs snippets within the templates. And beside that we don't want to add Google only

@tboerger commented on GitHub (Nov 29, 2016): That's only the first step, it also needs snippets within the templates. And beside that we don't want to add Google only
Author
Owner

@jag3773 commented on GitHub (Nov 29, 2016):

Indeed, we keep our templates in a separate repository, so the rest of the change is actually in here. Also, if you take this approach it might make sense just to have a separate config for GA and Piwik.

@jag3773 commented on GitHub (Nov 29, 2016): Indeed, we keep our templates in a separate repository, so the rest of the change is actually in [here](https://github.com/unfoldingWord-dev/gogs-custom/commit/5df70e9b2a7a24fe69ee6910764ee31b1dca358d). Also, if you take this approach it might make sense just to have a separate config for GA and Piwik.
Author
Owner

@joubertredrat commented on GitHub (Nov 29, 2016):

@jag3773 make PR with this changes that I make PR with Piwik implementation.

@joubertredrat commented on GitHub (Nov 29, 2016): @jag3773 make PR with this changes that I make PR with Piwik implementation.
Author
Owner

@strk commented on GitHub (Nov 30, 2016):

Couldn't this be done with simple custom templates by administrators ?

@strk commented on GitHub (Nov 30, 2016): Couldn't this be done with simple custom templates by administrators ?
Author
Owner

@strk commented on GitHub (Nov 30, 2016):

As in... I'd rather not advertise proprietary services from Gitea official code repository...

@strk commented on GitHub (Nov 30, 2016): As in... I'd rather not advertise proprietary services from Gitea official code repository...
Author
Owner

@tboerger commented on GitHub (Nov 30, 2016):

We will add options for piwik and Google as it's pretty common. Nobody is forced to enable these options.

@tboerger commented on GitHub (Nov 30, 2016): We will add options for piwik and Google as it's pretty common. Nobody is forced to enable these options.
Author
Owner

@joubertredrat commented on GitHub (Nov 30, 2016):

@strk Piwik is open source analytics.

@joubertredrat commented on GitHub (Nov 30, 2016): @strk [Piwik](https://piwik.org) is open source analytics.
Author
Owner

@strk commented on GitHub (Nov 30, 2016):

Thanks Joubert, than I see no problem with adding support for Piwik.

@strk commented on GitHub (Nov 30, 2016): Thanks Joubert, than I see no problem with adding support for Piwik.
Author
Owner

@bkcsoft commented on GitHub (Dec 6, 2016):

@strk we already "advertise" Slack, IMO as long as we don't include closed-source (never will, but still) we should be fine 😛

With that said, I do agree that this could be done with custom templates instead and should not go into gitea itself 🙂

@bkcsoft commented on GitHub (Dec 6, 2016): @strk we already "advertise" Slack, IMO as long as we don't include closed-source (never will, but still) we should be fine 😛 With that said, I do agree that this could be done with custom templates instead and should not go into gitea itself 🙂
Author
Owner

@strk commented on GitHub (Dec 6, 2016):

On Tue, Dec 06, 2016 at 10:18:16AM -0800, bkcsoft wrote:

@strk we already "advertise" Slack

That's a bug, like the Gravatar advertisement...

@strk commented on GitHub (Dec 6, 2016): On Tue, Dec 06, 2016 at 10:18:16AM -0800, bkcsoft wrote: > @strk we already "advertise" Slack That's a bug, like the Gravatar advertisement...
Author
Owner

@tboerger commented on GitHub (Dec 6, 2016):

It's not a bug, it's intentional. Not everybody is so fanatic...

@tboerger commented on GitHub (Dec 6, 2016): It's not a bug, it's intentional. Not everybody is so fanatic...
Author
Owner

@denji commented on GitHub (Dec 17, 2016):

Open web analytics in Golang & Preact https://github.com/dannyvankooten/ana

@denji commented on GitHub (Dec 17, 2016): Open web analytics in Golang & Preact https://github.com/dannyvankooten/ana
Author
Owner

@cez81 commented on GitHub (Apr 3, 2017):

Would it be good enough to do it same way as Gogs?

https://discuss.gogs.io/t/how-to-inject-custom-head-and-footer/943
c64b842df9 (diff-675f585d9cd6a202ba88a50dc67e52ff)

@cez81 commented on GitHub (Apr 3, 2017): Would it be good enough to do it same way as Gogs? https://discuss.gogs.io/t/how-to-inject-custom-head-and-footer/943 https://github.com/gogits/gogs/commit/c64b842df9d25f6a26abc8efab5d644a3e3cf716#diff-675f585d9cd6a202ba88a50dc67e52ff
Author
Owner

@lolusxy commented on GitHub (Aug 31, 2017):

Is it just this line we have to add?
https://github.com/gogits/gogs/blob/v0.10.1/templates/base/footer.tmpl#L55

Can we please do it? Seems simple

@lolusxy commented on GitHub (Aug 31, 2017): Is it just this line we have to add? https://github.com/gogits/gogs/blob/v0.10.1/templates/base/footer.tmpl#L55 Can we please do it? Seems simple
Author
Owner

@lunny commented on GitHub (Sep 1, 2017):

You can do it via custom templates

@lunny commented on GitHub (Sep 1, 2017): You can do it via custom templates
Author
Owner

@tboerger commented on GitHub (Sep 1, 2017):

For a proper integration we should provide templates that get included if piwik or analytics are configured via app.ini

@tboerger commented on GitHub (Sep 1, 2017): For a proper integration we should provide templates that get included if piwik or analytics are configured via app.ini
Author
Owner

@lolusxy commented on GitHub (Sep 1, 2017):

@lunny
Yeah, thats probably what I am going to do.
But I have to update my custom template every time the original file updates. Gogs' inject solution seems more elegant and simple to add.

@tboerger
That would be the best solution but a lot more complex to add.

@lolusxy commented on GitHub (Sep 1, 2017): @lunny Yeah, thats probably what I am going to do. But I have to update my custom template every time the original file updates. Gogs' inject solution seems more elegant and simple to add. @tboerger That would be the best solution but a lot more complex to add.
Author
Owner

@lunny commented on GitHub (Jun 8, 2018):

Since We supported header.tmpl and footer.tmpl, this maybe closed since https://github.com/go-gitea/gitea/pull/3051

@lunny commented on GitHub (Jun 8, 2018): Since We supported header.tmpl and footer.tmpl, this maybe closed since https://github.com/go-gitea/gitea/pull/3051
Author
Owner

@ptman commented on GitHub (Jun 8, 2018):

But wouldn't it make sense for this to be a couple of settings in app.ini instead of modifying templates?

@ptman commented on GitHub (Jun 8, 2018): But wouldn't it make sense for this to be a couple of settings in app.ini instead of modifying templates?
Author
Owner

@techknowlogick commented on GitHub (Jun 8, 2018):

I think due to how often Google changes their embed (from classic GA, to asynch GA, to now Google Tag) this is better left as an exercise for the user instead of having to closely follow what Google does. Also if we tie GA to a specific version and a user adds additional tracking code (such s onclicks for event tracking) then if we upgrade GA to the latest embed code we risk breaking that for the user).

@techknowlogick commented on GitHub (Jun 8, 2018): I think due to how often Google changes their embed (from classic GA, to asynch GA, to now Google Tag) this is better left as an exercise for the user instead of having to closely follow what Google does. Also if we tie GA to a specific version and a user adds additional tracking code (such s onclicks for event tracking) then if we upgrade GA to the latest embed code we risk breaking that for the user).
Author
Owner

@bkcsoft commented on GitHub (Jun 17, 2018):

I agree with the above, that injecting analytics should be done using custom templates from #3051

@bkcsoft commented on GitHub (Jun 17, 2018): I agree with the above, that injecting analytics should be done using custom templates from #3051
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#21