Consentry. Simple, GDPR-compliant cookie consent management.

Installing Consentry

Consentry is the easiest way for you to obtain and maintain data usage consent from your users. It automatically detects, categorises, and summarises what services you are using via Segment, and keeps up to date as you add and remove services.

Preparing to install Consentry

Before installing Consentry, you'll need your Segment Write Key, a privacy policy, and a cookie policy.

Finding your Segment Write Key

If you haven't already, you will need to set up a Segment account.

Consentry uses the Write Key from your Javascript source to hook into your Segment account. It is found in the API Keys section of the Settings tab in the Javascript source. If you're having trouble finding the Write Key, please follow our detailed instructions.

If you don't have them already, we've open sourced our own privacy policy and cookie policy. Feel free to take and modify these to fit your needs.

Find the cookie and privacy policies on your site and copy down their URLs. We recommend using the relative URLs if you can (for example, /cookies instead of https://consentry.org/cookies).

Installing Consentry

Consentry replaces the standard Segment snippet, but all of your calls to the standard Segment API (segment.track, segment.page, segment.identify, etc.) will continue to work as normal. They'll simply be managed by Consentry to ensure that they're respecting your users' privacy preferences, and regional data protection regulations such as the GDPR and the CCPA.

Removing your Segment snippet

If you don't already have Segment installed, you can skip this step and continue on to installing your Consentry snippet.

To install Consentry, find the Segment Javascript snippet in the head tag of your site. Your Segment snippet will look like this:

1
2
3
4
5
6
<script>
  !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var t=analytics.methods[e];analytics[t]=analytics.factory(t)}analytics.load=function(e,t){var n=document.createElement("script");n.type="text/javascript";n.async=!0;n.src="https://cdn.segment.com/analytics.js/v1/"+e+"/analytics.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a);analytics._loadOptions=t};analytics.SNIPPET_VERSION="4.1.0";
  analytics.load("YOUR_SEGMENT_WRITE_KEY");
  analytics.page();
  }}();
</script>

You will be replacing your Segment snippet with your Consentry snippet. Consentry will automatically load the specific Segment services that your user has agreed to, so there is no need to keep the old Segment code around.

Delete the Segment snippet from within your <head> tag.

Installing your Consentry snippet

Paste the following Consentry snippet into the location where you just removed the Segment snippet from. If you didn't have a Segment snippet already, paste the Consentry snippet so that it's the first script in your <head>.

1
2
3
4
5
6
7
8
9
10
11
12
<script type="text/javascript" src="https://consentry.org/public/main.js"></script>
<script type="text/javascript">
  window.consentry({
    segment: "SEGMENT_WRITE_KEY",
    key: "CONSENTRY_API_KEY",
    config: {
      privacyPolicyUrl: "PRIVACY_POLICY_URL",
      cookiePolicyUrl: "COOKIE_POLICY_URL"
    }
  });
  analytics.page();
</script>

And you're done. Your installation validator will now confirm that you're installed, and users will begin to get prompted for consent before they are cookied by any of the services that you use.

Copyright 2020. Consentry Limited, a non-profit company based in Dalston, London, UK.