question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updated documentation to recommend discoverRootDomain as default

See original GitHub issue

If 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:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mhadamcommented, Dec 15, 2017

Updated documentation in this wiki fork: mhadam/snowplow.wiki-fork@a963df2

0reactions
alexanderdeancommented, Mar 27, 2018

Ace, thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found