Install a tracking code


Needed permissions: owner

Piwik PRO uses a tracking code (a JavaScript code) to collect data about people who visit your site or app. The tracking code is part of the container embedded on your web pages. Every time a visitor views a page, the tracking code grabs information about that visitor and sends it to Piwik PRO. Then Piwik PRO organizes this data into reports.

In this article, we’ll show you how to install a tracking code to your website or app.

Before you start

Before you start setting up tracking, here are some basic things you should know:

  • First, add a website or an app to Piwik PRO.

    Note: Before you install the code, you can set up data collection under Administration > Websites & apps > Settings.

  • You always need to install the basic container (async) because it holds your tracking code and is used to handle most tags. You can also install the additional container (sync) if you want to use sync tags.
  • For WordPress sites, you can use a plugin to install the container (with the tracking code).
  • You can change the tracking code either under Tag Manager > Tags > Piwik PRO tag, or using JavaScript tracking API.

Add a tracking code

Each website or app added to Piwik PRO, has a separate tracking code. But under one website or app, you can track many domains (many websites) and subdomains, and then the tracking code is the same. So as you set up tracking, make sure you’re using the code relevant to the website or app you’re installing it to.

To install a tracking code, follow these steps:

  1. Go to Menu > Administration.
  2. Navigate to Websites & apps.
  3. On the left, pick the website or app that you want to work with.
  4. Navigate to Installation.
  5. In Basic container (async), click Copy to clipboard.
    Basic container (async) in Piwik PRO

    Note: This container holds your tracking code and is used to handle most tags.

  6. Paste the code right after the opening <body> tag on every page of your website or app.
  7. Data will appear in reports in about an hour. Data in the tracker debugger will appear instantly.

    Tip: You can also check manually if the tracking works. Read more

  8. Optionally, in Additional container (sync), click Copy to clipboard.
    Additional container (sync) in Piwik PRO

    Note: Add this container if you want to use sync tags. It loads tags before the page content loads.

  9. Paste the code inside <head></head> tags on your website or app. Don’t add this code elsewhere because it may slow down your site and tracking won’t work correctly.
  10. You can start adding sync tags right away.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center