createTracker static method
Future<SnowplowTracker>
createTracker({
- required String namespace,
- required String endpoint,
- Method? method,
- String? customPostPath,
- Map<
String, String> ? requestHeaders, - TrackerConfiguration? trackerConfig,
- SubjectConfiguration? subjectConfig,
- GdprConfiguration? gdprConfig,
- EmitterConfiguration? emitterConfig,
Creates a new tracker instance with the given unique namespace
.
endpoint
refers to the Snowplow collector endpoint.
method
is the HTTP method used to send events to collector and it defaults to POST.
customPostPath
is an optional string for custom POST collector paths.
requestHeaders
is an optional map of custom HTTP headers to add to requests to the collector.
Implementation
static Future<SnowplowTracker> createTracker(
{required String namespace,
required String endpoint,
Method? method,
String? customPostPath,
Map<String, String>? requestHeaders,
TrackerConfiguration? trackerConfig,
SubjectConfiguration? subjectConfig,
GdprConfiguration? gdprConfig,
EmitterConfiguration? emitterConfig}) async {
final configuration = Configuration(
namespace: namespace,
networkConfig: NetworkConfiguration(
endpoint: endpoint,
method: method,
customPostPath: customPostPath,
requestHeaders: requestHeaders),
trackerConfig: trackerConfig,
subjectConfig: subjectConfig,
gdprConfig: gdprConfig,
emitterConfig: emitterConfig);
await _channel.invokeMethod('createTracker', configuration.toMap());
return SnowplowTracker(configuration: configuration);
}