Commit 2da24fd8 authored by Mikko Ahlroth's avatar Mikko Ahlroth

Merge branch 'master' of gitlab.com:Nicd/tilastokeskus

parents e04db804 fd80c46c
......@@ -17,7 +17,7 @@ defmodule Tilastokeskus.Reception.Routes.PageView do
addr = get_addr(req)
ua = parse_ua(req)
{referrer, referrer_noq, referrer_domain} = parse_referrer(req)
{referrer, referrer_noq, referrer_domain} = parse_referrer(body)
screen_w = Map.get(body, "screen_width")
screen_h = Map.get(body, "screen_height")
......@@ -145,8 +145,8 @@ defmodule Tilastokeskus.Reception.Routes.PageView do
|> UAInspector.parse()
end
defp parse_referrer(req) do
referrer = Raxx.get_header(req, "referer", nil)
defp parse_referrer(body) do
referrer = Map.get(body, "referrer")
case referrer do
nil ->
......
......@@ -122,6 +122,10 @@ SOFTWARE.
data.tz_offset = (new Date()).getTimezoneOffset();
data.url = window.location.href;
if ('referrer' in document && document.referrer != null) {
data.referrer = document.referrer;
}
var data_parts = [];
function add_part(source, key, parts) {
......@@ -132,6 +136,7 @@ SOFTWARE.
add_part(data, 'screen_height', data_parts);
add_part(data, 'tz_offset', data_parts);
add_part(data, 'url', data_parts);
add_part(data, 'referrer', data_parts);
var data_str = data_parts.join('&');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment