Created
May 15, 2022 21:24
-
-
Save timfong888/c36ae11afe053f331143dd4db033c6a4 to your computer and use it in GitHub Desktop.
AmplitudeFlutterCustomAction
This file contains 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
import 'package:amplitude_flutter/amplitude.dart'; | |
import 'package:amplitude_flutter/amplitude_web.dart'; | |
import 'package:amplitude_flutter/constants.dart'; | |
import 'package:amplitude_flutter/identify.dart'; | |
import 'package:amplitude_flutter/web/amplitude_js.dart'; | |
Future amplitudeAction( | |
BuildContext context, | |
String userID, | |
String page, | |
String apiKey, | |
) async { | |
// Add your function code here! | |
// Create the instance | |
final Amplitude analytics = Amplitude.getInstance(instanceName: "Assembly"); | |
// Initialize SDK | |
analytics.init(apiKey); | |
// Log an event | |
analytics.logEvent('MyApp startup', eventProperties: { | |
'userID': userID, | |
'page': page | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment