Tracking Code
Matomo offers you various ways to embed the tracking code for your website, mobile app, and even for any device or application.
You can track visitors to your website in many different ways. The recommended way to do it is through JavaScript. To use this method you must make sure every webpage of your website has some JavaScript code, which you can generate here.
Once you have the JavaScript tracking code for your website, copy and paste it to all the pages you want to track with Matomo. In most websites, blogs, CMS, etc. you can use a pre-made plugin to do the technical work for you. (See our list of plugins used to integrate Matomo.) If no plugin exists you can edit your website templates and add the JavaScript tracking code to the </head> tag which is often defined in a 'header.php', 'header.tpl' or similar template file.
If you don't want to use JavaScript to track visitors, generate an image tracking link below.
If you want to do more than track page views, please check out the Matomo Javascript Tracking documentation for the list of available functions. Using these functions you can track goals, custom variables, ecommerce orders, abandoned carts and more.
Advanced
Note: To use cross domain linking, you must specify more than one domain name (URLs) for your website.
Note: Server side DoNotTrack support has been enabled, so this option will have no effect.
JavaScript Tracking Code
Make sure this code is on every page of your website. We recommend pasting it immediately before the closing </head> tag.
When a visitor has disabled JavaScript, or when JavaScript cannot be used, you can use an image tracking link to track visitors. Generate the link below and copy-paste the generated HTML in the page. If you're using this as a fallback for JavaScript tracking, you can surround it in <noscript></noscript>
tags.
For the whole list of options you can use with an image tracking link, see the Tracking API Documentation.
Image Tracking Link
An alternative to tracking visitors through the browser (either via JavaScript or an image link) is to continuously import server logs. Learn more about Server Log File Analytics.
Not tracking a website? You can alternatively track a mobile app or any other type of application using one of the available SDKs.
The HTTP Tracking API allows you to track anything. This may be useful if you are using a programming language for which no SDK exists yet. It may also be useful when you want to track devices or application in a special way.