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

Matomo tracking code #176

Closed
Ciacho opened this issue Nov 29, 2021 · 2 comments
Closed

Matomo tracking code #176

Ciacho opened this issue Nov 29, 2021 · 2 comments
Labels
feature New feature or request fixed-in-next-release Issue has already been fixed in the next release

Comments

@Ciacho
Copy link

Ciacho commented Nov 29, 2021

Feature Description

I am asking for the possibility of adding my own html / js code for user tracking.
I use the Matomo application - under my own URL and a changed tracking path - because customers mostly block Google Analytics anyway :)

For example tracking code on JavaScript

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://FQDN/";
    _paq.push(['setTrackerUrl', u+'FILE.php']);
    _paq.push(['setSiteId', '4']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'FILE.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->

Tracking over image:

<!-- Matomo Image Tracker-->
<img referrerpolicy="no-referrer-when-downgrade" src="https://FQDN/FILE.php?idsite={NUMBER}&amp;rec=1" style="border:0" alt="" />
<!-- End Matomo -->

FQDN, FILE and NUMBER are individually set (I don't use the standard ones Matomo proposes;)

Is your feature request related to a problem? Please describe.

Environment & Use Case

Additional Context

@Ciacho Ciacho added the feature New feature or request label Nov 29, 2021
@thatmattlove thatmattlove added accepted Issue is confirmed and will be worked on fixed-in-next-release Issue has already been fixed in the next release and removed accepted Issue is confirmed and will be worked on labels Dec 8, 2021
@thatmattlove
Copy link
Owner

This will be available in the release of 2.0. So you're aware of the implementation details, you'll be able to define custom files like this in config.yaml (currently hyperglass.yaml):

web:
    custom_javascript: <path to your custom js>
    custom_html: <path to your custom html>

The JS will be added inline via a <script/> tag.

The HTML will be nested under a <div/> element adjacent to <div id="__next"/>.

If neither is defined, no custom element is added.

thatmattlove added a commit that referenced this issue Dec 9, 2021
@Ciacho
Copy link
Author

Ciacho commented Dec 9, 2021

Great news, thank you :)

I'm waiting for the 2.0 version to be produced :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request fixed-in-next-release Issue has already been fixed in the next release
Projects
None yet
Development

No branches or pull requests

2 participants