basics
peasy has three fundamental methods that you can use to track events and manage visitor profiles: track
, page
, and setVisitorProfile
.
track custom events
The track
method allows you to track custom events within your application. This is useful for monitoring specific actions that users take, such as completing a purchase or signing up for a newsletter.
peasy.track("order_created", {
order_id: 123,
total: 100
});
manually track page views
The page
method is for manually tracking page views when the autoPageView
configuration option is set to false
.
peasy.page();
set visitor profile
The setVisitorProfile
method allows you to set or update the profile of a visitor. Great for tracking your authorized users. You more about it on the profiles page.
peasy.setVisitorProfile("123", {
name: "John Doe",
avatar:"/avatar.png"
});
Let's move on to the next section: Advanced Usage.