nginx and google analytics

Parker, Joshua josh at joshparker.us
Thu Jun 23 02:47:38 MSD 2011


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 at 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 at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

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



More information about the nginx mailing list