Welcome! Log In Create A New Profile

Advanced

Re: nginx and google analytics

June 22, 2011 06:48PM
I think you need to call ga code from a file like below:

location / {
sub_filter </head>
'<script language="javascript" src="/path/to/ga.js"></script></head>';
sub_filter_once on;
}



On Wednesday, June 22, 2011, bwellsnc <bwellsnc@gmail.com> wrote:
> I am trying to find the right sub_filter settings to make nginx place
> my google analytics code on all my pages.  Here is the google code:
>
> <script type="text/javascript">
>
>   var _gaq = _gaq || [];
>   _gaq.push(['_setAccount', 'UA-XXXXX-X']);
>   _gaq.push(['_trackPageview']);
>
>   (function() {
>     var ga = document.createElement('script'); ga.type =
> 'text/javascript'; ga.async = true;
>     ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
> 'http://www') + '.google-analytics.com/ga.js';
>     var s = document.getElementsByTagName('script')[0];
> s.parentNode.insertBefore(ga, s);
>   })();
>
> </script>
>
> If anyone has a suggestion, I would really appreciate it. Thanks!
>
> Brent
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

--
Joshua Parker
Church Management System - http://www.churchmember.us/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx and google analytics

bwellsnc June 22, 2011 06:42PM

Re: nginx and google analytics

parkerj June 22, 2011 06:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 184
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready