How Stat Collection Works
S
Written by Support
Updated over a week ago

We have a separate app (stats-incartupsell) that we use to collect stats on offer clicks and views.

The process of receiving, analyzing, and aggregating this data works like this:

  • When a shopper is SHOWN an offer OR when a shopper CLICKS on an offer, a GET request is sent to https://stats-incartupsell.herokuapp.com/i

  • The stats-incartupsell app receives the request and sends back an empty "OK" message

  • On stats-incartupsell, there is a logging app (papertrail) that tracks ALL web requests, just like an old school apache log file

  • Periodically, the main app (incartupsell) runs the catch_up_with_papertrail job using heroku scheduler. This queries the papertrail app that is attached to the stats-incartupsell app for any new data

If, for some reason, the Papertrail app on the stats-incartupsell app changes, then stat collection on the main app will stop working. To fix this, you need to get the environment variable named PAPERTRAIL_API_TOKEN from the stats-incartupsell app, and apply it to the main app as well.

That is, you need to manually copy the PAPERTRAIL_API_TOKEN config variable FROM stats-incartupsell TO incartupsell

There's code in the stats-incartupsell app to handle data collection using a Redis database, but it's not used. If you want to use Redis instead of pulling data from a logging app, you may want to use that code as a starting point

Did this answer your question?