This website uses necessary cookies to ensure that our website is ideally usable. We do not use cookies that process personal data without your prior consent. Read our Cookie Policy

QR Code tracking with Matomo

book reader icon
6 Minutes
facebook logo gray
linkedin logo gray
mail logo gray
QR Code tracking with Matomo

The General Data Protection Regulation (GDPR) in Europe and the California Consumer Privacy Act (CCPA) in the United States are regulations oriented to give the user full control over his/her personal data and take reasonable measures to protect it.

Companies are therefore required to use fully GDPR/CCPA compliant solutions as soon as they start dealing with customer's data of any kind.

Matomo Analytics is a fully GDPR and CCPA compliant solution alternative to Google Analytics. It is available as a cloud service, on-premise and as a Wordpress Plugin

You can easily integrate in Matomo Analytics. All the QR Code campaigns that you have created with our service will show in your Matomo dashboards and reports just like any other campaign source.

Of course, you can always check your dashboard to see your scan statistics or access them via our API to create your own reports. However, integrating our platform with your main analytics tool will allow you to have a better understanding of the customer journey and your conversion rates. 

How do I create a Matomo tracked QR Code campaign?

1. Login into your account

Log into your account at to access your user settings.

Please note that connecting your account to Matomo is only available in paid subscriptions.


Login Form

2. Go to your account settings

Go to your account settings and navigate to the External tracking section. There, you can enter all the information needed for 3rd party integrations like tracking your campaigns with Matomo.

External tracking custom JS settings
Account settings - External tracking

3. Add your Matomo tracking script

Copy your Matomo JavaScript snippet which you can obtain from your Matomo account by clicking on the top right in the settings icon. Then click on Websites and then on Tracking Code. Select your website from the drop-down menu you will see the appropiate JavaScript code below.

External tracking custom JS settings
Account settings - External tracking

When you add the snippet we recommend you to comment out the line containing trackPageView like shown in the example below. Otherwise, two page views will show up in Matomo for each scan.

<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq = window._paq || [];
 // _paq.push(['trackPageView']);
  (function() {
    var u="//{$MATOMO_URL}/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', {$IDSITE}]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
<!-- End Matomo Code -->

Once your are done, please click on the Save button in your account settings of

With our White Label plan each user can have his own script snippet and it will be applied to all QR Codes created in his account.

Due GDPR and CCPA regulations, express consent from a user is required if cookies that contain unique ids that can identify a person are stored on the user’s device. Our service offers to display an optional cookie banner to ask for the consent of the user.

Account settings - Consent popup
Account settings - Edit the Consent popup

If the option for the consent is activated, the user must first confirm that he agrees to the storage of cookies on his device before he is redirected to the target website. If he does not agree, the cookies are not created, and he is redirected to the target page. When you scan a QR Code with the consent option enabled the following dialog will be displayed.

Consent popup
Consent popup on a user's smartphone

You can adjust the text displayed on the consent pop-up to match your local regulations and requirements.

If the popup for consent is deactivated, the user is redirected to the landing page without his knowledge that third-party cookies are being saved. You can disable the consent option and still be GDPR & CCPA compliant if you configure your Matomo to not store permanent cookies on the user‘s device. See the ePrivacy section for more details.

5. Create your QR Code campaign

Now that you have integrated Matomo in your account settings you can create a QR Code campaign. Go to the sidebar of your account and click on QR Codes > Create QR Code.

QR Codes

Create QR Code



QR Code Options

QR Code 2 Options
Create a new QR Code

6. Add Matomo campaign parameters

After entering your destination URL and before saving your QR Code, you can add the MTM campaign parameters which will be used when reporting the scan to Matomo and will help you on further analysis of your QR Code campaign. The following parameters can be used:

  • Campaign Name (mtm_campaign)
  • Campaign Source (mtm_source) - Example: qrcode
  • Campaign Medium (mtm_medium)
  • Campaign Content (mtm_content)
	Campaign parameters configuration
Campaign parameters configuration

The QR Code tracking via Matamo works for any dynamic QR Code no matter if you point to your website, Facebook, YouTube or and Instagram profile. When using dynamic QR Codes the MTM parameters can be updated by editing the target URL also after the QR Code has been created.

The MTM parameters will be added to the target URL too, if you create a static QR Code. However, our platform will not track your static code and you cannot edit the target URL once a static QR Code is created.

7. View your campaigns in Matomo

You are now ready to start tracking your QR Codes in Matomo. When a QR Code is scanned, the information is sent to your Matomo account and you will see the scans just like any other campaign source e.g. emailing, social media, PPC, etc. To view the aggregated campaigns go to your Matomo instance and click on Acquisition and then on Campaigns.

Matomo dashboard - Visits by source
Matomo dashboard - Visits by source

If you want to have a detailed view about visitors coming from your QR Code campaigns, hover over one campaign and click on the contact user icon.

Matomo dashboard - Visits by campaign source
Matomo dashboard - Visits by campaign source (QR Codes)

Real-Time Tracking

For testing purposes or monitoring your current campaigns you can access the real time section of your Matomo dashboard to immediately see when a QR Code is scanned. To do so, click on Visitors and then on Real-time. Now you can select any visitor by clicking on the contact user icon to open a detailed report.

Matomo dashboard - Visits in Real time
Matomo dashboard - Visits in Real time

ePrivacy Directive compliance

The ePrivacy Directive (EPD), also known as the “cookie law”, lead into the proliferation of cookie consent pop-ups after it was passed. It supplements and in some cases, overrides the GDPR.

Essentially, you need to request users’ explicit consent before you save any cookies that store personal data like a unique user ID or an email address. Exceptions are strictly necessary cookies like session IDs or shopping carts on e-commerces.

Matomo offers you the possibility to fully disable the use of permanent cookies storing any personal data. You will be strictly following the ePrivacy Directive while not adding any friction to the redirect process since you will not need to show any consent window.

To disable the use of permanent cookies click on the settings button on the top right corner in Matomo. Then select Privacy and choose Anonymize Data. Now tick Force tracking without cookies.

Matomo Account settings - Privacy - Anonymize data
Matomo Account settings - Privacy - Anonymize data

When you save your settings the Matomo tracking code will exclude permanent cookies to be written on the user‘s device.

This will imply some loss of detail on your statistics because you will not be able to:

  • identify repeating visitors
  • study the customer journey over time and across devices


If you are experiencing any problems viewing your scans in Matomo these are the most likely reasons:

Verify your script

Make sure that both your Matomo script URL and the site ID is correct and publicly accessible.

Do-no-track (DNT) is set to off

Make sure that the Do-not-track option of your browser is not activated. This will prevent the scan to be tracked.

Do Not Use Ad-Blockers

If Ad-Blockers are running on a smartphone or desktop browser, Matomo script is probably blocked and you will not see any tracking data. However, the internal server-sided tracking of will work.

Matomo script takes too long to load

Per default sets a time window of 700ms to load the Matomo JavaScript and send the tracking request to Matomo. If the script ist not loaded and executed in that time, the user will be forwarded to the target URL, without tracking the QR Code scan in Matomo. You can set a higher delay in your account settings to overcome this problem.

More documentation on Matomo 

The Matomo URL Builder tool lets you generate URLs ready to use for Tracking Campaigns in Matomo.

If you are planning to integrate with Matomo, we really recommend you to go through the article Tracking marketing campaigns.

Last update 1 year ago