No Piwik PRO Tag Manager: install a tracking code

If you simply want to install a Piwik PRO tracking code without a container, you can use the code described below. Keep in mind that this will let you use Analytics only, without access to Tag Manager or Consent Manager.

To install a tracking code on its own, follow these steps:

  1. Get your tracking code ready:
    <script type="text/javascript">
        var _paq = _paq || [];
        _paq.push(["trackPageView"]);
        _paq.push(["enableLinkTracking"]);
        (function() {
            var u = "https://your-account-name.piwik.pro/";
            _paq.push(["setTrackerUrl", u + "ppms.php"]);
            _paq.push(["setSiteId", "XXX-XXX-XXX-XXX-XXX"]);
            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 + "ppms.js";
            s.parentNode.insertBefore(g, s);
        })();
    </script>

    Parameters

    https://your-account-name.piwik.pro
    The address you use to log in to Piwik PRO.

    XXX-XXX-XXX-XXX-XXX
    The ID of the site or app in Piwik PRO where you want to send data. (Where to find it?)

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

Tip: You can also check manually to see if your tracking works. Read more

Optional settings

Some settings are exclusively controlled at the tracking-code level, while others can be found in Piwik PRO’s user interface. Here’s a brief overview of the most common settings.

Controlled in Piwik PRO’s UI

Setting Where
Basic info
Time zone Administration > Sites & apps > Data collection > Time zone
Currency Administration > Sites & apps > Data collection > Currency
Internal search engine
Keywords from your internal search engine

Administration > Sites & apps > Data collection > Keywords from your internal search engine

Administration > Settings > Global site & app settings > Data collection > Keywords from your internal search engine

Remove keyword parameters from page URLs

Administration > Sites & apps > Data collection > Remove keyword parameters from page URLs

Administration > Settings > Global site & app settings > Data collection > Remove keyword parameters from page URLs

Page URLs
Remove parameters from page URLs

Administration > Sites & apps > Data collection > Remove parameters from page URLs

Administration > Settings > Global site & app settings > Data collection > Remove parameters from page URLs

Keep anchors in page URLs

Administration > Sites & apps > Data collection > Keep anchors in page URLs

Administration > Settings > Global site & app settings > Data collection > Keep anchors in page URLs

Campaigns
Campaign parameters

Administration > Sites & apps > Data collection > Campaign parameters

Administration > Settings > Global site & app settings > Data collection > Campaign parameters

Start a new session when the campaign changes

Administration > Sites & apps > Data collection > Start a new session when the campaign changes

Administration > Settings > Global site & app settings > Data collection > Start a new session when the campaign changes

Filters
Don’t collect data from these IP addresses

Administration > Sites & apps > Data collection > Don’t collect data from these IP addresses

Administration > Settings > Global site & app settings > Data collection > Don’t collect data from these IP addresses

Don’t collect data from known crawlers

Administration > Sites & apps > Data collection > Don’t collect data from known crawlers

Administration > Settings > Global site & app settings > Data collection > Don’t collect data from known crawlers

Add crawlers

Administration > Sites & apps > Data collection > Add crawlers

Administration > Settings > Global site & app settings > Data collection > Add crawlers

Collect data only from known sites

Administration > Sites & apps > Data collection > Collect data only from known sites

Administration > Settings > Global site & app settings > Data collection > Collect data only from known sites

Other options
Start a new session when the referrer changes

Administration > Sites & apps > Data collection > Start a new session when the referrer changes

Administration > Settings > Global site & app settings > Data collection > Start a new session when the referrer changes

Controlled at the tracking-code level

Method Description
enableCookies() Enables setting visitor cookies like like _pk_id.* and _pk_ses.* that are responsible for recognizing visitors and their sessions.
disableCookies() Disables setting visitor cookies like like _pk_id.* and _pk_ses.* that are responsible for recognizing visitors and their sessions.
setUserIsAnonymous() Marks a visitor as anonymous or non-anonymous. An anonymous visitor has a hidden IP address (Example: 0.0.0.0) and hidden location data (only Country data is available).
deanonymizeUser() Turns an anonymous visitor to non-anonymous. Enriches session data with a visitor’s IP address and location data.
setDomains()

Sets a list of domains that are tracked as one site or app. Use the same tracking code for these domains.

Listed domains are not treated as outlinks. Listed domains get the pk_vid parameter to pass the visitor ID between them when you use enableCrossDomainLinking().

Note: For the links that are added dynamically, you need to call enableLinkTracking() each time.

enableCrossDomainLinking()

Enables recognizing a visitor across domains. The visitor who goes from one website to the other will be recognized as the same visitor. Sessions that would be treated as separate for each website, will be treated as one session.

This method needs to be preceded with setDomains().

setCookieDomain()

Sets a domain where you’ll store a cookie with the visitor ID. Used to recognize a visitor across subdomains. The visitor who goes from one subdomain to the other will be recognized as the same visitor. Sessions that would be treated as separate for each subdomain, will be treated as one session.

This method needs to be preceded with setDomains().

setSessionIdStrictPrivacyMode() Enables or disables reading screen resolution and browser plugins from visitor’s device without consent. Accessing a visitor’s device is not compliant with the German Data Protection Act (TDDDG) and similar privacy laws
For more, see the developer documentation.

Examples:

To recognize a visitor across two domains example.com and example-two.com:

// Set the domains that are tracked as one site or app. Use the same tracking code for these domains.
_paq.push(["setDomains", ["example.com", "example-two.com"]]);

// Enable recognizing a visitor across domains.
_paq.push(["enableCrossDomainLinking"]);

To recognize a visitor across two subdomains example.com and help.example.com:

// Set the domains that are tracked as one site or app. Use the same tracking code for these domains.
_paq.push(["setDomains", ["example.com", "help.example.com"]]);

// Store a cookie with the visitor ID on this domain. Use it for recognizing a visitor across subdomains.
_paq.push(["setCookieDomain", "*.example.com"]);

Was this article helpful?

Technical support

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

Back to help center