Cross Domain Linking doesn't work

Hey guys, I’m having a problem with a Matomo instance that is implemented on a domain and two subdomains:

3 goals are on the maindomain and 1 goal each on a subdomain. All goals on the maindomain get tracked, but not the goals on the subdomains, and the visitor-log doesn’t show me any movement from the maindomain to the subdomain, so I figure, that it is not implemented properly. I implemented the tracking code and activated cross domain linking but it somehow doesnt track the goals and the traffic on the subdomains. I want to to measure everything in one Matomo instance. This is the tracking code that I implemented:

<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
  _paq.push(["setCookieDomain", "*"]);
  _paq.push(["setDomains", ["*","*"]]);
  (function() {
    var u="//";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
<!-- End Matomo Code -->```