recordIndirectAttribution static method

Future<String?> recordIndirectAttribution(
  1. Map<String, String> attributionValues
)

set indirect attribution Id for campaign attribution reporting. Use 'AttributionKey' to set key of IDFA and ADID

Implementation

static Future<String?> recordIndirectAttribution(Map<String, String> attributionValues) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "recordIndirectAttribution"';
    log('recordIndirectAttribution, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  int attributionValuesCount = attributionValues.length;
  log('Calling recordIndirectAttribution: [$attributionValuesCount]');
  attributionValues.forEach((k, v) {
    if (k.isEmpty) {
      String error = 'recordIndirectAttribution, Key should not be empty, ignoring that key-value pair';
      log(error);
      attributionValues.removeWhere((key, value) => key == k && value == v);
    }
  });
  List<dynamic> args = [];
  args.add(attributionValues);
  final String? result = await _channel.invokeMethod('recordIndirectAttribution', <String, dynamic>{'data': json.encode(args)});
  return result;
}