Set up a UserID
The necessary tools: Analytics + Tag Manager
The UserID feature is one of the mechanisms used to recognize visitors on your website. It can be applied when your website or app has a mechanism to strictly recognize the visitor. In other words, you can capture a trustworthy ID, for example, an email, user name or other ID.
After setting up the UserID feature, the
UserID is used as a single source of truth.
Before you start
Here are some things to know about UserID before you begin working with it:
UserIDyou can recognize a visitor across many devices. For example, when a visitor is logged in and switches between a laptop, mobile, and tablet, he or she will be seen as the same visitor.
- When the visitor logs out and the
UserIDvalue is no longer available, he or she will be tracked as a new visitor and Piwik PRO will use the cookie as a source of information.
Set up a UserID
You can set up the UserID in our Tag Manager. You only need to create a variable that will be catching the userID value. The value can be anything you like but it’s important for it to be unique. In the example below, the value will be an email address of a logged-in user.
First of all, you need to verify if the email address is provided anywhere on your page for you to grab.
When you find it, just right-click it and inspect it to reveal the code.
Our code has an id parameter so it can easily be grabbed by Tag Manager
Now all you need to do is setup your tracking code so it will be passing the variable to Piwik PRO.
That’s it – you are now tracking UserID in the Piwik PRO.
Set up a UserID manually
All you need to add is following line:
Just before the
Of course, you will need to pass the correct value in the