# Privacy and consent

> What to tell your visitors about Link Studio, and how to load the tracker only after they agree.

Link Studio records visits for you, so your visitors should hear about it from you. Here is text for your privacy policy, and how to load the tracker only once a visitor agrees.

## Text for your privacy policy

Add this to your own privacy policy. Keep the part in brackets if you ask for consent before loading the tracker.

> **Note:** We use Link Studio to understand which of our links, ads and campaigns bring visitors to our site and lead to sign ups and sales. When you click one of our links or visit our site, Link Studio records the pages you view, the buttons you click, how you arrived and your approximate location. Your location is worked out from your IP address, which isn't stored with your visit. It uses a random ID kept in a cookie on our website, plus your account ID if you're signed in, and the last link you clicked is kept in your browser for 30 days. So the same device isn't counted twice, it also keeps a one-way code made from your network and device type for 30 days. Link Studio processes this information for us under a data processing agreement and stores it in the UK. [We only do this if you accept analytics cookies.] Learn more at linkstudio.link/privacy.

Our [Data Processing Agreement](https://linkstudio.link/dpa/) applies automatically when you use Link Studio, and our [sub-processors page](https://linkstudio.link/subprocessors/) lists the providers involved.

## Load the tracker after consent

The tracker sets its cookies as soon as it loads, so add it only once the visitor agrees. The first line of your snippet, the one that starts `window.linkStudio`, stores nothing. Keep it on every page, and anything you track before the tracker loads is sent once it does.

With your own cookie banner

1. Keep the first line of the snippet on every page, and remove the line that loads the tracker.
2. Add this function to your site, with your own key.
3. Call `loadLinkStudio()` when the visitor accepts analytics, and on every later page they visit once they have.

```
function loadLinkStudio() {
  if (window.linkStudioLoaded) return;
  window.linkStudioLoaded = true;
  var script = document.createElement("script");
  script.src = "https://app.linkstudio.link/t.js";
  script.dataset.key = "YOUR_KEY";
  document.head.appendChild(script);
}
```

Shopify

Shopify's Customer Privacy API tells you whether a visitor allows analytics. In your theme, keep the first line of the snippet and add this instead of the line that loads the tracker.

```
<script>
function loadLinkStudio() {
  if (window.linkStudioLoaded) return;
  window.linkStudioLoaded = true;
  var script = document.createElement("script");
  script.src = "https://app.linkstudio.link/t.js";
  script.dataset.key = "YOUR_KEY";
  document.head.appendChild(script);
}
window.Shopify.loadFeatures(
  [{ name: "consent-tracking-api", version: "0.1" }],
  function (error) {
    if (error) return;
    var privacy = window.Shopify.customerPrivacy;
    if (privacy.analyticsProcessingAllowed()) loadLinkStudio();
  }
);
document.addEventListener("visitorConsentCollected", function (event) {
  if (event.detail.analyticsAllowed) loadLinkStudio();
});
</script>
```

Google Tag Manager

1. Add a **Custom HTML** tag with your whole Link Studio snippet.
2. In the tag's **Advanced settings**, open **Consent settings**, choose **Require additional consent for tag to fire** and add `analytics_storage`.
3. Fire it on **All Pages**, and on the event your consent tool sends when someone accepts, so it also runs on the page where they agree. Then publish.

## If someone changes their mind

Stop loading the tracker on later pages, and delete what it stored in their browser. Our [Privacy Policy](https://linkstudio.link/privacy/#cookies) lists the cookies and browser storage it uses, and most consent tools can delete them for you when someone opts out.

> **Note:** This is general information, not legal advice. You're responsible for what your site tells visitors and for getting any consent the law requires.

Source: https://linkstudio.link/docs/privacy-for-customers/
