Closed Findus23 closed 3 years ago
What do you think about adding switches for setDomains
and setCookieDomain
(*.domain.org
) to enable smoother tracking across sub domains?
let domain = String(options.piwikdomain)
if (options.trackAcrossSubdomains) {
_paq.push(["setDomains", ["*." + domain]]);
}
if (options.hideSubdomainOutlinks) {
_paq.push(["setCookieDomain", "*." + domain]);
}
if (domain.indexOf('http') !== 0 && domain.indexOf('//') !== 0) {
domain = 'https://' + domain
}
EDIT: Ah, it needs to be assured that the domain does not contain a scheme, no path and no trailing slash etc.
Another idea I had was to allow customising the whole tracking script snippet, so one can follow the docs to configure it freely. But as I see the way now how Cloudflare apps are structured, it seems to be no trivial task, and, it is probably not a good idea since the app could be misused then to inject any other JavaScript that has nothing to do with Matomo at all.
Another idea I had was to allow customising the whole tracking script snippet, so one can follow the docs to configure it freely
If I understand the cloudflare docs correctly they explicitly don't allow settings that customize the code:
Submitted apps that use code fields to insert script tags will be rejected. See our ease of use and security guidelines. https://www.cloudflare.com/apps/developer/docs/install-json/options
It would also make sense to propably hide all these options under an advanced settings section as explained in https://www.cloudflare.com/apps/developer/docs/ease-of-use
If I understand the cloudflare docs correctly they explicitly don't allow settings that customize the code:
Yes, totally makes sense!
It would also make sense to propably hide all these options under an advanced settings section
Agreed, especially when more options are added.
Btw, about sub domain related options: Does Cloudflare somehow make global variables available, i.e. the domain that app is installed on? Since the Matomo instance that tracks this domain could be theoretically hosted on a different domain (right?), so deriving the domain that is to be tracked from the domain of the Matomo instance is probably not always correct.
Anything missing here? While more options could be added, together with an advanced settings section, I think it's okay to do that in subsequent PRs.
Left a few comments. @Findus23 is there anything missing from your side? Happy to merge this and update it on the cloudflare marketplace if all still works.
@tsteur Replaced let/const with var
I think everything else should be ready for publishing
This is now done.
Your app has been successfully submitted to Cloudflare and is awaiting approval. Updates on your submission will be sent to in about 3-4 business days.
Also updated the app store description and some images etc.
Thanks for everyone's help on this!
Many thanks. I'll give it a try once the 3-4 days have been passed 👍.
TODO:
Things outside this repo: