sendEvent
The sendEvent() method records user actions in your mobile app, such as, button taps, voice commands, and gestures.
Syntax
PiwikTracker.sharedInstance()?.sendEvent(
category: "category",
action: "action",
name: "name",
value: value,
path: "path"
)[[PiwikTracker sharedInstance]
sendEventWithCategory:@"category"
action:@"action"
name:@"name"
value:@(value)
path:@"path"];Parameters
- category (string, required)
The category of the tracked event. Categories help group related events. For example, you can organize events by user interaction type (taps, gestures, voice commands) or app feature (media player, search, navigation). - action (string, required)
The action of the tracked event. Example: the category could beuser interactions, and the action could bebutton tap. - name (string, optional)
The name of the tracked event. For example, if a screen contains multiple button controls, you can use the name to identify which button was tapped. - value (NSNumber, optional)
An optional numeric value associated with the event. - path (string, optional)
Path segment for this event (without a leading slash). When set, the SDK sets the URL tohttp://{appName}/{path}. When omitted, the SDK uses the same generated page URL as for other tracking calls.
Examples
To send a custom event when a user taps a signup button on the main signup flow and assign the value 100 to the event:
PiwikTracker.sharedInstance()?.sendEvent(
category: "Clicks",
action: "Button",
name: "Sign up",
value: 100,
path: "main/signup"
)[[PiwikTracker sharedInstance] sendEventWithCategory:@"Clicks"
action:@"Button"
name:@"Sign up"
value:@100
path:@"main/signup"];Notes
- For more on custom events, see Custom events.
Updated 2 months ago
Did this page help you?