Updated documentation to recommend discoverRootDomain as default
See original GitHub issueIf the tracker is implemented across various root domains, it feel like there should be an option to set the cookie domain dynamically, so that you can easily deploy the tracker across, eg:
www.mysite.com blog.mysite.com www.mysite.co.uk application.mysite.co.uk etc
Currently, we add this to the tracker tag:
function getDomain(url, subdomain) {
subdomain = subdomain || false;
url = url.replace(/(https?:\/\/)?(www.)?/i, '');
if (!subdomain) {
url = url.split('.');
url = url.slice(url.length - 2).join('.');
}
if (url.indexOf('/') !== -1) {
return url.split('/')[0];
}
return url;
};
var cookieDomain = (".").concat(getDomain(window.location.href));
and then:
(...)
cookieDomain: cookieDomain;
(...)
Maybe this should be the default?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Initialization options | Snowplow Documentation
Set the cookie secure attribute for the tracker instance using the cookieSecure field of the configuration object. The default is "true". Valid ...
Read more >Set up a Snowplow JS tracker for pageviews on GitLab.com
The script in Snowplow's documentation includes window.snowplow('trackPageView'); , which should yield pageview tracking for all pages on ...
Read more >Snowplow Analytics
discoverRootDomain optional - string, Automatically discover root domain. trackerSettings.cookieName optional - string, Prefix for cookies ("sp" default).
Read more >snowplow/javascript-tracker - UNPKG
\"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + ... this software and associated documentation files (the \"Software\"), ...
Read more >JS-0015 · Reassigning function declarations - DeepSource
Default analysis branch is ... getTimezoneOffset();return null!==t?t:0}function r(e,t,n){var r=new Date;return void 0!==e&&r. ... discoverRootDomain&&(H=it.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Updated documentation in this wiki fork: mhadam/snowplow.wiki-fork@a963df2
Ace, thanks