Tracking links from a different domain other than the Matomo site with Matomo tracking code

Currently using a php server-side shortening service called YOURLS. The setup is on a different domain (https://www.example.ME). My Matomo install is on (https://analytics.example.COM) Is there a way to generate tracking to the Matomo install (where example.COM is setup in the dashboard with javascript code and a site id) from the .ME domain?

Apparently there was a plugin for YOURLS that used the PiwikTracker.php and setup to track links to the .COM site. But it no longer works and has not been maintained to work with the current release of Matomo.

YOURLS generates dynamic links to create the shortcode. My use of it are for audio and video links that are not contained with a web landing page, but just a link to a folder on the example.ME site.

Any thoughts about how I’d get this accomplished (aside from purchasing the Media Analytics plugin). I’ve seen a few queries about this but no follow-ups.

Also, I can’t add Javascript code to the the other site as its has no editable files to add tracking code.

Is there a way to do this via the Tag Manager?


If there is no way for you to edit the files (javascript or other server side code), it won’t be possible to do any tracking for that website. When you use the tag manager you would still need to add code to the website you want to track.
That’s also normal if not you would be able to start tracking for example on traffic on facebook or google.

If it’s your own installation of yourls you should be able to edit the php code and add server side tracking from there. A good start would be taking a look here:

And more details can be found here:

An alternative is doing it by HTTP requests, but not logical if you can do it server side, more info here:

@Aphotrax Thanks for your suggestions. I suspect I’d need to us the matomotracker.php file to do what I need.

I’ll follow up review the links to the documentation you suggested.

Thanks a bunch!

@Aphotrax I read thru the docs and added (or attempted to add the Tracker) and get the errors below:

Not sure how the path is incorrect?

Well it seems to be :wink: But it’s hard to say why without knowing your folder structure and the way include the file. The file should be in the same folder as the file where you include it if you only use the filename and no path.

@Aphotrax After much work, I figured it out and most (if not all) are working correctly. Thanks again for your suggestions/help with this. It really was a matter of making changes - then addressing any errors in the error log, and then making changes and trying again, but finally got it all working.