class Mixpanel::Tracker

Overview

Use Mixpanel::Tracker to track events in your application. To track an event, use

tracker = Mixpanel::Tracker.new "YOUR_TOKEN"
tracker.track "Signup", Mixpanel::Event::Properties{"username" => "Pino", "Age" => 2}

Defined in:

mixpanel/tracker.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(project_token : String, endpoint_track_url : String = ENDPOINT_TRACK) #

Create new Mixpanel::Tracker with your mixpanel token.


[View source]

Instance Method Detail

def track(name : String, properties : Event::Properties) #

The same as #track but creates a new event from name and Event::Properties.


[View source]
def track(event : Event) #

Track event on mixpanel.


[View source]
def track(name : String, &block : Event::Properties -> ) #

Same as #track but yields Event::Properties to the block.


[View source]
def track(events : Array(Event)) #

Sends Array(Event) as a batch request to mixpanel.


[View source]
def track(*events : Event) #

Sends all events as a batch request to mixpanel.


[View source]
def track_url(event : Event, ip : Bool = false, redirect : String | Nil = nil, img : Bool = false, callback : String | Nil = nil, verbose : Bool = false) : URI #

Generates tracking URI from event and request parameters.


[View source]
def track_url(name : String, properties : Event::Properties, ip : Bool = false, redirect : String | Nil = nil, img : Bool = false, callback : String | Nil = nil, verbose : Bool = false) : URI #

Same as #track_url but creates a new event based on name and Event::Properties.


[View source]