In order that trendcounter is able to collect and process data, you only need to integrate a small HTML code into your website. This HTML code uses several asynchronous technologies that will ensure that the performance of your website is not affected.
<script data-tc-id="your-project-key"> var _tcq = _tcq || []; _tcq.push(['init', 'your-project-key']); (function(d, s) { var e = d.createElement(s); e.type = 'text/javascript';e.async = true; e.src = '//s.tcimg.com/w/v3/trendcounter.js'; var f = d.getElementsByTagName(s)[0]; f.parentNode.insertBefore(e, f); })(document, 'script'); </script>
Hint: Each website receives a personalized HTML code, which you can get when you log in.
By default trendcounter removes a leading www of the domain name. This leads to clearer results and improves the accuracy of the analysis. If you do not wish that domains with and without www are merged, you can disable this behavior.
_tcq.push(['www', 'leave']); // do not remove leading www in domains (standard) _tcq.push(['www', 'strip']); // remove leading www in domains
For the analysis to be as exactly as possible you should ensure that every page is only accessible via one unique URL. Otherwise, each active page would emerge under different URLs in the analysis. For this you have several options available.
_tcq.push(['url', 'full']); // use the full URL with parameters (standard) _tcq.push(['url', 'strip']); // keep only the path and remove all parameters _tcq.push(['url', 'canonical']); // use the canonical tag of the current page
Should it be necessary, you can also set your own domain the analysis cookies are set on.
_tcq.push(['cookie_domain', 'your.domain.tld']);
If you are concerned with the use of cookies, you can disable them easily. But then some stats are no longer recorded. You can for example not identify any recurring visitors.
_tcq.push(['use_cookies', true]); // use cookies (default) _tcq.push(['use_cookies', false]); // dont't use cookies _tcq.push(['respect_dnt', true]); // respect DNT header (default) _tcq.push(['respect_dnt', false]); // dont't respect DNT header
Bei der Verwendung eines Cookie-Banners mit Opt-In (EuGh-Urteil), kannst du nach der Einwilligung mit folgendem Aufruf die Verwendung von Cookies aktivieren.
_trendcounter.enableCookies();Hint: We are using so-called "First-Party"-Cookies, that are giving an increased privacy protection, because they are not available across different domains.
By default, the analysis starts automatically after the 'init' call. Should your application require a separate start of the analysis (for example, AJAX pages), you can disable this feature. You can then start the analysis with a 'track'.
_tcq.push(['init', 'your-project-key', false]); // disabled auto tracking _tcq.push(['track']); // can be called whenever you need it
Dynamic applications sometimes require that URL and Title must be specified.
_tcq.push(['init', 'your-project-key', false]); _tcq.push(['track', 'Custom URL', 'Custom Title']);
https://www.yourdomain.tld/?utm_campaign=your-campaign-name