How do I track how many users open and read my newsletter emails (using a pixel / beacon)?
With Matomo you can add a small image beacon (pixel) in your newsletter emails, so you can track how many people actually read and open the newsletter email.
To track how many people open and read your newsletters, you can add the following HTML image code in your newsletter:
<img src="https://matomo.example.com/matomo.php?idsite=YOUR_MATOMO_WEBSITE_ID&rec=1&bots=1&url=https%3A%2F%2Fexample.com%2Femail-opened%2Fnewsletter_XYZ&action_name=Email%20opened&mtm_campaign=internal%20email%20name&mtm_keyword=newsletter_XYZ" style="border:0;" alt="" />
Once you add this code in your newsletters, when your users open and read the newsletter, it will add a new “Page title” entry for “Email opened” in your Behavior > Page titles report.
You will also be able to see this information in the Visitor Log.
In this example, replace:
https://matomo.example.com/
by your Matomo URLYOUR_MATOMO_WEBSITE_ID
by your Website ID (learn more)
When you use the HTML code above, the following information will also be recorded in Matomo:
&url=%2Femail-opened%2Fnewsletter_XYZ
records a pageview with the URL set to to “/email-opened/newsletter_XYZ” in Behavior > Page URLs report.&action_name=Email%20opened
records a Page Title set to “Email opened” in Behavior > Page titles report.&mtm_campaign=internal%20email%20name
records a visit from a Campaign and sets the campaign name to “internal email name” in Referrers > Campaigns report.&mtm_keyword=newsletter_XYZ
will also set the campaign keyword to “newsletter_XYZ” (set it to the name of this particular email newsletter for example “Summer-deals-2017-August”) in Referrers > Campaigns report.- when the people receiving your emails are all on the same internal networks and using a similar email client, you will find that the Unique Users/Unique Visitors KPI metric value will be wrong. To solve this issue you want to append the parameter:
&cid=
which should be set to a uniquely generated string of exactly 16 hexadecimal characters (containing only characters 01234567890abcdefABCDEF). This will set the Visitor ID to a unique string for each email recipient ensuring Matomo tracks them correctly.&rec=1
in order for the request to be actually recorded.&bots=1
o include all the connections made to this request, bots included.
Attention: If you have configured custom campaign tracking parameters for campaign_var_name
or campaign_keyword_var_name
, you might need to use those instead of mtm_campaign
and mtm_keyword
.
You may have noticed some special characters here such as %20
, %2F
. That’s because the URL is encoded. We strongly recommend you to do so in order for your tracking not to break. Many tools are available on the web in order to encode your URLs such as urlencoder.org.
If you would like to access the previous tracking code easily, keep in mind that you can always find the tracking code generator within the “Matomo > Administration >Tracking code > Image Tracking”.
Tracking even more data: the user ID example
You can go deeper in your URL tracking by inserting other parameters such as the user id if you have this information within your emailing database. One of the main benefit of tracking the User ID is to connect data across multiple devices and browsers for a given user.
You only need to add the following parameter &uid=XXX
where XXX
equals the dynamic value of the user ID.
Make sure that UID from your emailing provider is the same as the one used on your website in order for your data to be consistent.
Important note about inaccurate data
Some email providers (including gmail/google apps) pre-load all images from email messages by default, which results in Matomo tracking an email open even if the user did not actually open the email yet. This inaccuracy affects any other email analytics tools as well.