Skip to content

newapplesho/mixpanel-smalltalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mixpanel-smalltalk Build Status

Mixpanel Pharo Smalltalk Client Library

Supported Smalltalk Versions

Pharo Smalltalk 4.0, 5.0, 6.0, 6.1

Installation

Metacello new
    baseline: 'Mixpanel';
    repository: 'github:https://newapplesho/mixpanel-smalltalk/pharo-repository';
    load.

How to use

Setup

"Mixpanel project token, PROJECT_TOKEN"
MixpanelSettings default token:'PROJECT_TOKEN'.

Sending events

tracker := MixpanelTracker new.
tracker track:'Sent Message'.
tracker := MixpanelTracker new.
json := NeoJSONObject new.
json at:'Programming language' put:'Pharo Smalltalk'.
json at:'version' put:'4.0'.
tracker track:'Sent Message' properties: json.
tracker := MixpanelTracker new.
json := MixpanelEngagementJsonObject new.
json browser:'Safari'.
json os:'Mac'.
json referrer:'http:https://www.sorabito.com/'.
json currentUrl:'https://allstocker.com/'.
" XXXX.XXXX.XXXX.XXXX is ip address. "
tracker track:'Sent Message' properties: json ip:'XXXX.XXXX.XXXX.XXXX'.

Managing user identity

The Mixpanel library will assign a default unique identifier (we call it "distinct_id") to each unique user who comes to your website.

tracker := MixpanelTracker new.
"distinct_id 13793"
tracker identify:'13793'.
tracker track:'Sent Message'.

Storing user profiles

tracker := MixpanelTracker new.
tracker identify:'13793'.
people := tracker people.
json := MixpanelPeopleJsonObject new.
json firstname:'Sho'.
json lastname:'Yoshida'.
json at:'Favorite programming language' put:'Smalltalk'.
people setUserProfiles: json.