# Google Analytics with nginx reverse proxy

**URL:** <https://www.ruby-forum.com/t/google-analytics-with-nginx-reverse-proxy/238027>\
**Category:** NGINX\
**Created:** [December 12, 2013, 12:34pm UTC](https://www.ruby-forum.com/t/google-analytics-with-nginx-reverse-proxy/238027 "2013-12-12T12:34:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [December 12, 2013, 12:34pm UTC](https://www.ruby-forum.com/t/google-analytics-with-nginx-reverse-proxy/238027/1 "2013-12-12T12:34:51Z")

</div>

I am using NGINX as reverse proxy and forward the traffic to Apache  
server  
where Google Analytics is configured. I have configured proxy\_set\_header  
and  
from Apache server I can view users IP address. But in Googel Analytics  
users session droped. I am wonder where there is any other  
configuration  
need to be done?

Thanks  
Fakrul

Posted at Nginx Forum:

> **[Google Analytics with nginx reverse proxy](https://forum.nginx.org/read.php?2,245460,245460#msg-245460)**
>
> I am using NGINX as reverse proxy and forward the traffic to Apache server where Google Analytics is configured. I have configured proxy\_set\_header and from Apache server I can view users IP address. But in Googel Analytics users session droped. I am...

---

<div class="post-metadata">

**Author:** ![fakrulalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/aca169/32.png) [@fakrulalam](https://www.ruby-forum.com/u/fakrulalam)\
**Post date:** [December 12, 2013, 1:04pm UTC](https://www.ruby-forum.com/t/google-analytics-with-nginx-reverse-proxy/238027/2 "2013-12-12T13:04:40Z")

</div>

Google analytics code (the JavaScript) isn’t served from your server. I  
don’t quite understand what your problem is?

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![fakrulalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/aca169/32.png) [@fakrulalam](https://www.ruby-forum.com/u/fakrulalam)\
**Post date:** [December 12, 2013, 6:23pm UTC](https://www.ruby-forum.com/t/google-analytics-with-nginx-reverse-proxy/238027/3 "2013-12-12T18:23:41Z")

</div>

Google analytics code (the JavaScript) works properly when I point my  
domain to apache server. But when I point my domain to nginx (as reverse  
proxy); Google Analytics statistics get dropped and it doesn’t show the  
actual users hits.

Posted at Nginx Forum:

> **[Re: Google Analytics with nginx reverse proxy](https://forum.nginx.org/read.php?2,245460,245477#msg-245477)**
>
> I am using NGINX as reverse proxy and forward the traffic to Apache server where Google Analytics is configured. I have configured proxy\_set\_header and from Apache server I can view users IP address. But in Googel Analytics users session droped. I am...
