项目作者: SiriusTsou

项目描述 :
Google Analytics Bypassing Adblockers
高级语言:
项目地址: git://github.com/SiriusTsou/google_analytics_bypassing_adblockers.git


Google Analytics Bypassing Adblockers

Client

change www.googletagmanager.com => your.domain.com

  1. <!-- Global site tag (gtag.js) - Google Analytics -->
  2. <script async src="https://your.domain.com/gtag/js?id=UA-123456789-1"></script>

Nginx File

  1. server {
  2. listen 80;
  3. server_name your.domain.com;
  4. access_log off;
  5. resolver 8.8.8.8 ipv6=off;
  6. set $ga 'www.google-analytics.com';
  7. location = /gtag/js {
  8. proxy_set_header Accept-Encoding "";
  9. sub_filter $ga $server_name;
  10. sub_filter_types *;
  11. sub_filter_once off;
  12. proxy_pass https://www.googletagmanager.com$uri$is_args$args;
  13. break;
  14. }
  15. location = /analytics.js {
  16. proxy_set_header Accept-Encoding "";
  17. sub_filter $ga $server_name;
  18. sub_filter '"/r/collect' '"/r/c';
  19. sub_filter '"/j/collect' '"/j/c';
  20. sub_filter '"/collect' '"/c';
  21. sub_filter_types *;
  22. sub_filter_once off;
  23. proxy_pass https://$ga/analytics.js;
  24. break;
  25. }
  26. location / {
  27. if ($uri ~ /r/c){
  28. proxy_pass https://$ga/r/collect$is_args$args&uip=$remote_addr;
  29. break;
  30. }
  31. if ($uri ~ /j/c){
  32. proxy_pass https://$ga/j/collect$is_args$args&uip=$remote_addr;
  33. break;
  34. }
  35. if ($uri ~ /c){
  36. proxy_pass https://$ga/collect$is_args$args&uip=$remote_addr;
  37. break;
  38. }
  39. proxy_pass https://$ga$uri$is_args$args&uip=$remote_addr;
  40. }
  41. # Cloudflare
  42. set_real_ip_from 103.21.244.0/22;
  43. set_real_ip_from 103.22.200.0/22;
  44. set_real_ip_from 103.31.4.0/22;
  45. set_real_ip_from 104.16.0.0/12;
  46. set_real_ip_from 108.162.192.0/18;
  47. set_real_ip_from 131.0.72.0/22;
  48. set_real_ip_from 141.101.64.0/18;
  49. set_real_ip_from 162.158.0.0/15;
  50. set_real_ip_from 172.64.0.0/13;
  51. set_real_ip_from 173.245.48.0/20;
  52. set_real_ip_from 188.114.96.0/20;
  53. set_real_ip_from 190.93.240.0/20;
  54. set_real_ip_from 197.234.240.0/22;
  55. set_real_ip_from 198.41.128.0/17;
  56. set_real_ip_from 2400:cb00::/32;
  57. set_real_ip_from 2606:4700::/32;
  58. set_real_ip_from 2803:f800::/32;
  59. set_real_ip_from 2405:b500::/32;
  60. set_real_ip_from 2405:8100::/32;
  61. set_real_ip_from 2c0f:f248::/32;
  62. set_real_ip_from 2a06:98c0::/29;
  63. # use any of the following two
  64. real_ip_header CF-Connecting-IP;
  65. }