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

Formal support for analytics tools and trackers #189

Open
jace opened this issue Apr 16, 2018 · 0 comments
Open

Formal support for analytics tools and trackers #189

jace opened this issue Apr 16, 2018 · 0 comments

Comments

@jace
Copy link
Member

jace commented Apr 16, 2018

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:

  1. A list of supported analytics tools and trackers could be considered in the comments on this section.
  2. Baseframe currently recognises a GA_CODE key in config for Google Analytics. Other tools could be recognised with <id>_CODE keys, 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 to True.
  3. 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 for GA_CODE.
  4. The JS code to be inserted could be included as macros in a analytics.html.jinja2 template, invoked from baseframe.html.jinja2.
  5. 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.
  6. 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.Baseframe global object.
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

1 participant