Match userID between 2 websites

Hello there,

This is my first post! :hugs: first of all thank you for this wonderfull tracking software!:grinning:

But lets come tot the point! :smiley:

I have 2 websites let’s call it X and Y to make it easy, Website Y is purely informative and it gets hits via google etc …
Website X has a backend where people can log in and make adjustments.

now I get the UserID with these settings( _paq.push([‘setUserId’, ‘USER_ID_HERE’]);.)
This i get from my user who logs in on wesbite X.
I would like to see the user ID on website Y, then I would be able to match this much more easily.

now i read the article:
https://piwik.org/blog/2017/02/complete-guide-tracking-websites-web-apps-multiple-piwiks-easily-efficiently/

if i add this in my tracking script

var u = '//$yourPiwikDomain';
_paq.push(['addTracker', u + '/piwik.php', var idSite = Y]); // adds an additional tracker
_paq.push(['setSiteId', 'X']); // configures your regular Piwik tracker
_paq.push(['setTrackerUrl', u + 'piwik.php']);

but for this piwik doesn’t work anymore and i recieve this error:
Uncaught SyntaxError: Unexpected token var idSite

Can somebody help me plz?

Greetings

Is there nobody that could help me ?

i fixed it:
https://developer.piwik.org/guides/tracking-javascript-guide#multiple-piwik-trackers

var u="//piwik.example.org/";
  _paq.push(['setTrackerUrl', u+'piwik.php']);
  _paq.push(['setSiteId', '1']);

  // We will also collect the website data into Website ID = 7
  var websiteIdDuplicate = 7;
  // The data will be duplicated into `piwik.example.org/piwik.php`
  _paq.push(['addTracker', piwikUrl = u+'piwik.php', websiteIdDuplicate]);
  // Your data is now tracked in both website ID 1 and website 7 into your piwik.example.org server!

now after a while i discover that i only track registerd users on my website with the User ID, the “not registerd” users i dont see anymore in the piwik dashboard,
Why i am not tracking everybody ?

Hello harun,

I’m new to Piwik, but I saw an option on “Settings > Website > Track visitors across all subdomains”. I think it would solve it for you if you are talking about subdomains, but I’m not sure about different domains.