diff --git a/public/internal/header.php b/public/internal/header.php
index 764fe7b6998351138398fe3e4ee65f9a1fa89c67..1964a8fa925834d574e2b9f41b9ebf3a0aa816f0 100644
--- a/public/internal/header.php
+++ b/public/internal/header.php
@@ -1,9 +1,16 @@
 <?php
+include "config.php";
 include "menue.php";
 
 function getHeader($pagetitle, $navselect)
 {
     $menu = getMenu($navselect);
+    if (strpos($_SERVER['HTTP_HOST'], '.onion') !== false) {
+        $trackURL = $trackURLTor;
+    } else {
+        $trackURL = $trackURLNormal;
+    }
+
     echo(<<<EOF
     <!DOCTYPE html >
     <html lang = "de" >
@@ -45,7 +52,7 @@ function getHeader($pagetitle, $navselect)
     </header >
     <div id = "content" >
     <!--Matomo Image Tracker -->
-    <img src = "https://matomo.jonasled.de/matomo.php?idsite=1&amp;rec=1" style = "border:0" alt = "" />
+    <img src = "$trackURL" style = "border:0" alt = "" />
     <!--End Matomo -->
 EOF);
 }
\ No newline at end of file