Skip to content
This repository has been archived by the owner on Aug 10, 2020. It is now read-only.
/ ga-resty Public archive

OpenResty libriary to build a google_analytics webserver

License

Notifications You must be signed in to change notification settings

lua-resty-minami/ga-resty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Name

lua-resty-minami/google_analytics : Openresty library to build a google_analytics webserver

Table of Contents

Status

This library is considered passed testing and may change without notice.

Back to TOC

Description

This library requires a Openresty build, please take here as reference.

Back to TOC

Synopsis

# nginx.conf

# library folder 'resty' dir
lua_package_path "/path/to/conf/?.lua;;";



# website.conf
location / {
    ...
    
    header_filter_by_lua_file /path/to/conf/headerfilter.lua;

    mirror                    /google_analytics;
    mirror_request_body       on;
}

location /google_analytics {
    internal;

    resolver 8.8.8.8 ipv6=off;
    resolver_timeout 10s;

    access_by_lua_file  /path/to/conf/access.lua;
    content_by_lua_file /path/to/conf/content.lua;
}
-- content.lua

-- write your google_anaytics UA-xxxxxxxxx-1 to here
-- local tid    = "UA-111111111-1"
local tid       = 
local post_body = "v=1&t=pageview&tid=" .. tid .. "&uip=" .. ngx.var.remote_addr .. "&cid=" .. ngx.var.cookie_cid .. "&dp=" .. cookie_uri .. "&dr=" .. http_referer .. "&z=" .. ngx.var.msec

Back to TOC

Author

Minami (Nanqinlang) (南琴浪) https://sometimesnaive.org

Back to TOC

Copyright and License

personal work, for non-profit, Copyright (C) 2018 All rights reserved.

This library's License: GPL v3.

Back to TOC

See Also

Back to TOC

Reference

https://sometimesnaive.org/article/77

About

OpenResty libriary to build a google_analytics webserver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages