kissmetrics/km — Issue #8: Sending events not related to the browsing user is not possible
Author: sradu
Created: 2012-02-25 17:21:23+00:00
State: open

Hi.

I have a very simple setup where I have a before_filter in ApplicationController that sets up KM.identify based on cookies/deviceId.

Users can 'like' something which would trigger email notifications which I would like to mark as sent. In this setup I want to do something like KM.record_with_identity(identity, 'Sent notification email') without affecting the KM that was initialized in the ApplicationController.

Here is a function that makes this work, sorry for not forking/requesting commit.

def record_with_identity(id,action,props={})
temp_id = @id
@id = id
record(action, props)
@id = temp_id
end