A partial archive of meta.discourse.org as of Tuesday July 18, 2017.

Trouble with Top Traffic Sources Data

RyanK

I have Google Analytics setup via Admin > Settings > Basic Setup. When I visit GA there is an alert that says my tracking code is missing. This appears to be an old message, so it may not longer be relevant.

When I visit my ADMIN area in Discourse I see that Github is often a top referrer. It’s my understanding that while not accessible via Discourse, that referral data should be easy to get from GA. I’m checking traffic Channels, Source/Medium, Referrals, but nothing shows any reference to GitHub anywhere. Am I looking in the wrong place or does this mean my GA setup within Discourse is not right?

Falco

Google Analytics is a JavaScript snippet. So if you have something like an image in your forum hotlinked on GitHub, it will show as a top traffic source on discourse but nothing in Google Analytics.

You can check this theory easily parsing the nginx logs on the shared folder.

RyanK

For the benefit of those who are not as technical as I am…how would one easily parse the nginx logs on the shared folder?

:blush:

Falco

Looks like we can do this using a simple Data Explorer query:

SELECT
  d.name,
  r.path,
  COUNT(*) as occurrences
FROM
  incoming_links AS l
INNER JOIN
  incoming_referers AS r ON r.id = l.incoming_referer_id
INNER JOIN
  incoming_domains AS d ON d.id = r.incoming_domain_id
WHERE
  l.created_at > (CURRENT_DATE - 30)
GROUP BY
  1, 2
ORDER BY
  3 DESC