-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Baseframe has included support for Google Analytics since the beginning. We have considered using other tools such as Matomo (formerly Piwik) and Mixpanel, but never gotten around to it.
This has come up again following a recent policy change to engage with users on the platforms they prefer to be on, rather than insisting on them coming to our websites: we now need to use the analytics tools and trackers provided by these platforms, such as Facebook Pixel. Baseframe should include a formal specification for how an app/website may use trackers:
- A list of supported analytics tools and trackers could be considered in the comments on this section.
- Baseframe currently recognises a
GA_CODEkey in config for Google Analytics. Other tools could be recognised with<id>_CODEkeys, where a non-blank value requests insertion of that tool's JavaScript snippet. A tool that doesn't require a specific code could be set toTrue. - Baseframe compiles these codes into
app.config['analytics'][name.lower()], so that the code for (say) Google Analytics could be inspected from a template with{% if config.analytics.ga %}. Alternatively, this is specified in the config file itself as a dictionary, with Baseframe providing backwards compatibility forGA_CODE. - The JS code to be inserted could be included as macros in a
analytics.html.jinja2template, invoked frombaseframe.html.jinja2. - If the browser sets the Do Not Track (DNT) flag, none (?) of these tools are inserted into the page. This check could be part of the tool's own code, since something like Matomo (Piwik) is self-hosted and is not a third-party tracker.
- Various parts of the page may want to interact with an analytics tool, such as to report events. Baseframe must provide a way to flag whether the tool is currently available. This could be via the
window.Baseframeglobal object.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels