SnowcatCloud, Inc.

Privacy Settings

We use cookies and other tracking technologies to improve your browsing experience on our website, demo our services, and show you personalized content.

By clicking ”Accept,” you agree to SnowcatCloud's Privacy Policy and use of cookies as described in our Cookie Policy .

We do not sell or share your personal information. You can change your cookie settings at any time by clicking “Privacy Settings.” in the footer and removing any existing cookies from your browser.

Necessary
Marketing

NGINX

Snowplow NGINX Integration

Integrating Snowplow collector into an Nginx reverse proxy allows you to create a Snowplow collector firing on the same domain as your website, on a given path, thus bypassing the Safari ITP IP address limitation. See Safari ITP.

Download Safari Technology Preview to observe Intelligent Tracking Prevention (ITP) in action.

WITHOUT Nginx reverse-proxy (below) even though the domain is the same as the website (sp.snowcatcloud.com) the cookie is set to expire in 7 days (March 27th 2023).

WITH Nginx reverse-proxy (below) the cookie is set to expire in 1 year (March 19th 2024).

WARNING

Setup is straightforward but requires your website to be served through Nginx.

Step 1: Configure NGINX Reverse Proxy

The NGINX Configuration below will map www.yoursite.com/collectorpath to sp.yourcollector.com/com.snowplowanalytics.snowplow/tp2, turning your website path into a Snowplow collector.

location /collectorpath {
  proxy_pass                 https://sp.yourcollector.com/com.snowplowanalytics.snowplow/tp2;
  proxy_read_timeout         90;
  proxy_connect_timeout      90;
  proxy_redirect             off;
  proxy_set_header           Host sp.yourcollector.com;
  proxy_set_header           X-Real-IP $remote_addr;
  proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_ssl_name             sp.yourcollector.com;
  proxy_ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;
  proxy_ssl_server_name      on;
  proxy_buffer_size          256k;
  proxy_buffers              16 384k;
  proxy_busy_buffers_size    384k;
  break;
}

Step 2: Configure your JS Tracker

In your Snowplow initialization script, configure the collector and postPath to reflect the new collector URL and path.

// Note how it points to www.yoursite.com
snowplow("newTracker", "spc", "www.YOURSITE.COM", {
        appId: "aid",
        discoverRootDomain: true,
        postPath: '/collectorpath', // Collector path override
        cookieSameSite: "Lax", // Recommended
        eventMethod: "post",
        bufferSize: 1,
        cookieLifetime: 63072000,
        stateStorageStrategy: "cookieAndLocalStorage",
        contexts: {
          webPage: true,
          performanceTiming: true,
        },
      });

Go to www.YOURSITE.COM, while using the Snowplow Chrome Debugger and observe the Snowplow hit, it should return 200 and you should see the cookies set with one year expiration date, even when using Safari Technology Preview.

INFO

If you would like to see a working example, go to SnowcatCloud and look for polarbear in the Network tab, or use SnowcatCloud's Chrome Extension.