Using use_third_party_id_cookie=1, Idvisitor same in database but JS getVisitorId() return different

Hello,
I am using the third party cookie to track users cross different sites with different site ids. I have set use_third_party_id_cookie=1 and the idvisitor column in the database are the same for all sites but when I try to get idvisitor through Javascript getVisitorId(), the Ids are different. Is this a normal behavior?
How should I take with same Id for different visits with Javascript?

I’m fairly sure that comes from UserID so in your javascript code block add the following:

_paq.push([‘setUserId’, ]);

No, That’s a different story. I want to take the VisitorId that is stored in the database. But the VisitorId for a single user browsing my different sites are same in database not in javascript.