trackCampaign

The trackCampaign() method tracks online campaigns that bring traffic to your mobile app. To track a campaign, add campaign parameters to each campaign link, then use this method to pass that data. Campaign data is collected with the first tracked screen event.

Syntax

await FlutterPiwikPro.sharedInstance.trackCampaign("campaignURL");

Parameters

campaignURL (string, required)

The campaign URL that brings traffic to your mobile app. Valid formats: HTTPS, HTTP and FTP. Example: http://example.com?pk_campaign=Summer_Promo&pk_keyword=banking_app

Note: You can tag campaigns manually or use the Piwik PRO URL builder. Currently, only the pk_campaign and pk_keyword work with SDKs, so don’t use other campaign parameters.

Examples

To pass campaign data from the campaign link http://example.com?pk_campaign=Summer_Promo&pk_keyword=banking_app:

await FlutterPiwikPro.sharedInstance.trackCampaign("<http://example.com?pk_campaign=Summer_Promo&pk_keyword=banking_app>");

Notes

  • Currently, only the pk_campaign and pk_keyword parameters work with SDKs, so don’t use other campaign parameters.
  • Piwik PRO recognizes the pk_campaign and pk_keyword parameters by default. If you have problems tracking your campaigns, make sure these parameters are added in Administration > Sites & apps > Data collection > Campaigns > Campaign parameters. Read more