diff options
| -rw-r--r-- | danixland-site-plugin.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/danixland-site-plugin.php b/danixland-site-plugin.php index 395263e..a6859e5 100644 --- a/danixland-site-plugin.php +++ b/danixland-site-plugin.php @@ -76,3 +76,29 @@ add_action( 'wp_enqueue_scripts', 'baguette_enqueue_assets' ); * Do not translate smileys into emoticons. */ add_filter( 'option_use_smilies', '__return_false' ); + +/* + # Add matomo tracking js code to head + */ +if ( ! function_exists( 'matomo_tracking' ) ) : + function matomo_tracking() { + ?> +<!-- Matomo --> +<script type="text/javascript"> + var _paq = window._paq = window._paq || []; + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="//lucky.danix.xyz/"; + _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.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<!-- End Matomo Code --> + <?php + } +endif; +add_action( 'wp_head', 'matomo_tracking' ); |
