Skip to content

Add piwik_analytics option  #597

Closed
Closed

Description

@Jako

Please add the option to set a piwik tracking code (the same way as google_analytics). The following code would output the Piwik tracking code at the end of the body section.

piwik_analytics: ['piwik_site_id', 'piwik_url']

Piwik Tracking Code:

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//*piwik_url*/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', *piwik_site_id*]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//*piwik_url*/piwik.php?idsite=*piwik_site_id*" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

Activity

  1. waylan commented on Jun 5, 2015

    @waylan
    Contributor

    It does not seem reasonable to me for MkdDocs to need to support every single analytics option out there. Which one(s) are supported out-of-the-box is up to @d0ugal. However, I think a reasonable work around would be to put the analytics code into an include (or block). Then users can use a custom theme dir to override the analytics part only of the theme without needing to re-implement the entire theme. Just my suggestion.

  2. Jako commented on Jun 5, 2015

    @Jako
    Author

    Any option not to re-implement the entire theme is welcome.

  3. d0ugal commented on Jun 5, 2015

    @d0ugal
    Contributor

    You can just add a analytics.js file in with your markdown that contains all the JavaScript required for your preferred service and it will then be automatically included (or you can specify it with extra_javascript) I'm not aware of any reason that they need to be included inline other than a slight performance enhancement.

    We should consider removing Google and documenting this approach assuming it works well enough.

    Google was added before my involvement. I think I'd rather not include any than try to decide which to include.

  4. d0ugal commented on Jun 5, 2015

    @d0ugal
    Contributor

    Hmm, actually, I see there is a requirement for non-JavaScript code too.

  5. d0ugal commented on Jun 7, 2015

    @d0ugal
    Contributor

    For now I think this sort of change has to require a custom theme. We should aim to solve it more generally - #607 takes us toward a discussion about this, so let's continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions