Skip to main content

i am getting this error in console ..

GET https://cdn.amplitude.com/libs/amplitude-8.17.0-min.gz.js net::ERR_BLOCKED_BY_CLIENT

 

also i am able to send events to dashboard since the. ad-blocker extension is enabled, how do i make amplitude work when ad-blocker is enabled ? 

Hey there,

Happy to help!

We do not offer official support for circumventing ad-blockers but the easiest way to go around Ad-Blockers is by running a reverse proxy through your own domain. - Please note that it is best that this process is done by an Engineer or a Developer as this is a technical workaround.

What is a Reverse Proxy Server?

A Reverse Proxy Server is a server that sits in front of a web server and forwards HTTP requests to that web server. Some examples of popular servers that include Reverse Proxys are: NGINX, Apache, and Squid. Theoretically, you can also do this forwarding with any application server by creating a route that forwards all request headers and the body to Amplitude. In practice, the way this would work is by you running a web server on your domain that forwards all analytics requests from a path on your domain to Amplitude’s event endpoint.

How does it work?

There are two parts of this process: setting up the Reverse Proxy and then configuring Amplitude to use that server as a data source. The Proxy we are going to use is NGINX, a popular web server, and load balancer that also has the ability to function as a reverse proxy:
 

1. Installing NGINX - you can typically use homebrew or apt-get to do the actual installation. For example brew install nginwould work if you are running a Mac OS.

 

2. Configuring NGINX - here you will have to configure NGINX to proxy requests on a particular URL to Amplitude. Please see the below sample of a nginx.conf file that will accomplish that:

worker_processes 1;error_log logs/error.log;error_log logs/error.log notice;error_log logs/error.log info;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8080; server_name localhost; location /analytics/ { proxy_pass https://api.amplitude.com/; } }}

3. Starting and Testing the Proxy - once you have finished setting up the configuration file, you should be able to start and test your Proxy.

 

4. Configuring Amplitude - this is the final step of the process, where you will need to configure Amplitude to send requests to NGINX:


HTTP API Configuration: If you are using our HTTP API all you have to do is send the requests to your endpoint rather than to ours. Please do note that the HTTP API uses a slightly different endpoint from our SDKs, so to test, you will need to temporarily set proxy_pass to https://api.amplitude.com/httpapi/ .

If the Reverse Proxy setup was done correctly, then using the above command should return a 200 response code. In Amplitude, you can use the User Lookup functionality to check if the event was sent successfully.

JS SDK Configuration: Amplitude’s JS SDK provides multiple options that allow events to be sent to an alternative server endpoint. If you are using our JS SDK you can set the apiEndpoint option when initializing the SDK.

Android SDK and iOS SDK Configuration: here you can use setServerUrl to configure the server URL. Once you this is done you should be able to send events through your proxy and see them logged in Amplitude.

Hope this helps and please let me know if you need help with anything else.

We've got some great information on this here: https://developers.amplitude.com/docs/domain-proxies 

Hope this helps! 


@Zhenia Semenina  Thanks for detailed guide but do you similar guide for Apache setup we use apache 


@Zhenia Semenina  if you have similar guide for apache setup please share..


Hi @pawan, Thanks for following up. I’m Jeremie the community manager. Were you able to make progress here? Please let me know if you need any additional support. 😀


Reply