Troubleshooting

Missing cookie

By default, events coming from your backend needs to tracking cookie set by the Castle JavaScript. This is a way for Castle to know that the user's client and backend environment match up, and that the user has not tampered with the user-agent, timezone or other properties that should be consistent.

If you are not using the Castle JavaScript, you will need to configure your backend library to run in a different mode.

I can't see events tracked via Segment

In order for Castle to make sense of any events they'll need to contain information about from which device and location they were tracked. In the simplest form this means user agent and IP address. Segment doesn't automatically track these properties when you use one their backend libraries so you'll need to add these manually for each call:

Analytics.track(
  user_id: current_user.id,
  event: 'Logged in',
  context: {
    ip: request.ip,
    user_agent: request.user_agent
  })