2

Right now, I put the Piwik code at the end of html.tpl.php.

How I can integrate it in a Drupal site, so that this JavaScript can be aggregated? Or better loaded and keep my template clean?

Can I put this code to an external JavaScript file (+ how?) and then just declare it at theme.info?

1 Answer 1

4

Even better, use the drupal module that does all the hard work - Piwik Web Analytics.

Here is a quote about it (from the module's project page):

... Adds the Piwik web statistics tracking system to your website.

The module allows you to add the following statistics features to your site:

  • Single/multi domain tracking
  • Selectively track/exclude certain users, roles and pages
  • Monitor what type of links are tracked (downloads, outgoing and mailto)
  • Monitor what files are downloaded from your pages
  • Cache the Piwik code on your local server for improved page loading times
  • Custom variables support with tokens (D7 only)
  • Custom code snippets
  • Site Search
  • Drupal messages tracking
  • Modal dialog tracking (Colorbox)
  • Access denied (403) and Page not found (404) tracking
  • User ID tracking across devices
  • DoNotTrack support
1
  • thanks. In the past it did not have d7 version, so I didn't use it.
    – john
    May 26, 2011 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.