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! We accept bounties via Bountysource.
@joubertredrat what would piwik or analytics benefits for ?
@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.
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.
@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
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
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.
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.
That's only the first step, it also needs snippets within the templates. And beside that we don't want to add Google only
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 make PR with this changes that I make PR with Piwik implementation.
Couldn't this be done with simple custom templates by administrators ?
As in... I'd rather not advertise proprietary services from Gitea official code repository...
We will add options for piwik and Google as it's pretty common. Nobody is forced to enable these options.
@strk Piwik is open source analytics.
Thanks Joubert, than I see no problem with adding support for Piwik.
@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 馃檪
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...
It's not a bug, it's intentional. Not everybody is so fanatic...
Open web analytics in Golang & Preact https://github.com/dannyvankooten/ana
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
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
You can do it via custom templates
For a proper integration we should provide templates that get included if piwik or analytics are configured via app.ini
@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.
Since We supported header.tmpl and footer.tmpl, this maybe closed since https://github.com/go-gitea/gitea/pull/3051
But wouldn't it make sense for this to be a couple of settings in app.ini instead of modifying templates?
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).
I agree with the above, that injecting analytics should be done using custom templates from #3051
Most helpful comment
Since We supported header.tmpl and footer.tmpl, this maybe closed since https://github.com/go-gitea/gitea/pull/3051