trackGoal
The trackGoal() method tracks completed goals in your app. You can set any event as a goal, such as when visitors sign up, buy a product, download a whitepaper or complete another action that’s important to your business.
Syntax
await FlutterPiwikPro.sharedInstance.trackGoal(
goal: "goal",
revenue: revenue,
currencyCode: "currencyCode");Parameters
goal (string, required)
The goal ID. To find a goal ID, go to Menu > Analytics > Goals.
revenue (number, optional)
The goal value. This value is used to calculate the goal revenue.
currencyCode (string, optional)
The ISO 4217 currency code for the revenue. Example: USD, EUR, PLN.
Examples
To send a goal with the ID 27ecc5e3-8ae0-40c3-964b-5bd8ee3da059 and the value 20:
await FlutterPiwikPro.sharedInstance.trackGoal(
goal: "27ecc5e3-8ae0-40c3-964b-5bd8ee3da059",
revenue: 20);Notes
- After you set up a goal in Analytics > Goals > Add a goal, the goal is tracked automatically. The trackGoal() method can be used in addition to the automatic method.
- For more on goals, see our help article.
Updated 21 days ago