cookieID value as a variable


Can I use the cookieID value as a variable in the Piwik tag manager?
If yes, how can I do that?
(I would like to send this value to Microsoft Clarity later on)


Hi. Something like that should work assuming that the analytics tracking library is already loaded.

function() {

  var visitorID;
  var _paq = window._paq || [];
  _paq.push([ function() {visitorID = this.getVisitorId()}]);

  return visitorID;

You might need to delay sending the event to Clarity a bit to make sure that the getVisitorID method is already available.

Other solution would be to simply manually extract it from the _pk_id cookie. Cookies docs are available here: Cookies created for visitors by Piwik PRO | Data and cookies | Piwik PRO help center