Created
May 18, 2020 19:32
-
-
Save bsneed/5cf69e0d93a47c98ac2b30a7191d9f96 to your computer and use it in GitHub Desktop.
Segment Middleware Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let checkConsentOfEvent = SEGBlockMiddleware { (context, next) in | |
if context.eventType == .track { | |
if (hasConsent(for: blah)) { | |
next(context) | |
} else { | |
return | |
} | |
} else { | |
next(context) | |
} | |
} | |
configuration.integrationMiddleware = [ | |
SEGIntegrationMiddleware(key: mixpanelIntegration.key(), middleware: [checkConsentOfEvent]) | |
] | |
SEGAnalytics.setup(with: configuration) | |
SEGAnalytics.shared()?.identify("brandon") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment