Sending tracking requests to multiple Matomo servers is easily done using the Matomo JavaScript tracker.

The standard Matomo JavaScript tracking code contains the following lines for tracking to a single Matomo server:

_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', YOUR_SITE_ID_HERE]); 

To add a second tracking URL to Matomo, we can add the following code below it:

var secondaryTracker = 'https://matomo.example.com/matomo.php';
var secondaryWebsiteId = YOUR_SITE_ID_HERE;

// Also send all of the tracking data to the new Matomo server
_paq.push(['addTracker', secondaryTracker, secondaryWebsiteId]);

It is not necessary to have the same Site ID in both the Matomo servers (Each tracker can have a unique Site ID for the website you are tracking)

Adding additional Matomo servers can likewise be added with the following:

var tertiaryTracker = 'https://matomo2.example.com/matomo.php';
var tertiaryWebsiteId = YOUR_SITE_ID_HERE;
_paq.push(['addTracker', tertiaryTracker, tertiaryWebsiteId]);

There is no limit to the number of trackers you can add via this method to send tracking requests to multiple Matomo servers.

You can find more information about Multiple Matomo Trackers in our Developer Documentation.
You can even further customize the different Matomo tracker instances.

Previous FAQ: How do I accurately measure the same visitor across multiple domain names (cross domain linking)?