# Bypassing Adblockers

Bypassing adblockers require you to change the code snippet you put on your website, host the script and the endpoint yourself and route data to our servers afterwards.

This requires a small development effort to get it up and running but we are here to help with any technical questions.

There are two main steps that are covered below:

### Hosting the Script

Our tracking script normally is hosted through the following url: <https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js>&#x20;

In order to host it on your own domain you should talk with your developer to host a Javascript file in your own domain (or subdomain). Once the file is hosted you should be able to visit the link your developer provides and see minified code output to make sure it is successful.

You need to put the newly created link into the code snippet. This is the original code snippet that you had put on your website during the implementation process. The snippet has an `src` attribute that normally points to our hosted url but you should switch it with your url.

There is an example at the end of this guide on how the change looks.

### Hosting the Endpoint

The tracking script normally makes requests to an endpoint called `https://data.hockeystack.com/send` .

You should create a passthrough proxy in your hosting provider that points to `data.hockeystack.com` . This solution would not work with CNAME based approach because adblockers can detect and block it still.

Once you have that, add an extra data attribute to the code snippet called `data-server-url` . The value of this is the endpoint url you created starting with `https://`  but omitting the `/send` at the end.

For example, if you created an endpoint called `https://yourdomain.com/hs-web-trck/v2/send` then the url you should put as the value of `data-server-url` is `https://yourdomain.com/hs-web-trck/v2`.

**NOTE:** Be sure the new urls doesn't contain words such as "track", "hockeystack", or "tracker". Examples we suggest include, but are not limited to "pineapple", "alpaca", and "foobar".

### **How does it look in the code snippet as an example?**

Keep in mind this is an example with a fake API key. You should make the change in the code snippet provided to you during the implementation process.

Change

```html
<script>
  var script = document.createElement("script");
  script.id = "wphs";
  script.src = "https://cdn.hockeystack.com/script.js";
  script.async = 1;
  script.dataset.apikey = "<your-api-key>";
  script.dataset.cookieless = 1;
  document.getElementsByTagName('head')[0].appendChild(script);
</script>
```

to

```html
<script>
  var script = document.createElement("script");
  script.id = "wphs";
  script.src = "https://yourdomain.com/hs-web-trck/script.js";
  script.dataset.serverUrl = "https://yourdomain.com/hs-web-trck/v2"
  script.async = 1;
  script.dataset.apikey = "<your-api-key>";
  script.dataset.cookieless = 1;
  document.getElementsByTagName('head')[0].appendChild(script);
</script>
```

***

If you have any other questions or issues, you can always reach us through live support or just send an email to <hello@hockeystack.com>!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hockeystack.com/technical-details/tracking/bypassing-adblockers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
