recordDirectAttribution static method
set direct attribution Id for campaign attribution reporting.
Implementation
static Future<String?> recordDirectAttribution(String campaignType, String campaignData) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "recordDirectAttribution"';
log('recordDirectAttribution, $message', logLevel: LogLevel.ERROR);
return message;
}
log('Calling recordDirectAttribution: [$campaignType] with campaignData: [$campaignData]');
if (campaignType.isEmpty) {
String error = 'recordDirectAttribution, campaignId cannot be empty';
log(error);
return 'Error : $error';
}
List<String> args = [];
args.add(campaignType);
args.add(campaignData);
final String? result = await _channel.invokeMethod('recordDirectAttribution', <String, dynamic>{'data': json.encode(args)});
return result;
}