recordDirectAttribution static method

Future<String?> recordDirectAttribution(
  1. String campaignType,
  2. String campaignData
)

set direct attribution Id for campaign attribution reporting. returns error or success message

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;
}