solidusio-contrib / solidus_tracking

Data tracking extension for your Solidus store.
BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

Allow specifying global context #22

Open aldesantis opened 3 years ago

aldesantis commented 3 years ago

In many cases, it's useful to send some global context along with an event, such as the request's IP or user agent.

This is usually done via a before_action in a controller, e.g.:

before_action :set_tracking_context

def set_tracking_context
  SolidusTracking.set_context(user_ip: request.remote_ip)
end

We should support this to allow for integrating additional plugins, such as Segment.