Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add logged out user tracking library and append to tracking pixel

  • Loading branch information
chrisst committed Mar 25, 2015
1 parent 22625ac commit 063bcf70acfe9a7525370cd39beb24d741e5bf03
Showing with 91 additions and 3 deletions.
  1. +1 −0 r2/r2/lib/js.py
  2. +80 −0 r2/r2/public/static/js/lib/reddit-client-lib.js
  3. +10 −3 r2/r2/templates/base.html
@@ -442,6 +442,7 @@ def outputs(self):
"lib/bootstrap.modal.js",
"lib/bootstrap.transition.js",
"lib/bootstrap.tooltip.js",
"lib/reddit-client-lib.js",
"bootstrap.tooltip.extension.js",
"base.js",
"preload.js",

Some generated files are not rendered by default. Learn more.

@@ -93,11 +93,18 @@
%if g.tracker_url and thing.site_tracking:
<script type="text/javascript">
(function() {
var url = '${tracking.get_pageview_pixel_url()}';
var tracker = new redditlib.Tracker();
var loggedOutData = tracker.getTrackingData();
var loggedOutParams = '';
if (loggedOutData && loggedOutData.loid) {
loggedOutParams = '&loid=' + loggedOutData.loid
+ '&loidcreated=' + loggedOutData.loidcreated;
}
var url = '${tracking.get_pageview_pixel_url()}' + loggedOutParams;
var cachebuster = Math.round(Math.random() * 2147483647);
var cachebusted_url = url + "&r=" + cachebuster;
var cachebustedUrl = url + "&r=" + cachebuster;
var img = new Image();
img.src = cachebusted_url;
img.src = cachebustedUrl;
})();
</script>
%endif

0 comments on commit 063bcf7

Please sign in to comment.
You can’t perform that action at this time.