Skip to content

Instantly share code, notes, and snippets.

@timfong888
Created May 15, 2022 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timfong888/c36ae11afe053f331143dd4db033c6a4 to your computer and use it in GitHub Desktop.
Save timfong888/c36ae11afe053f331143dd4db033c6a4 to your computer and use it in GitHub Desktop.
AmplitudeFlutterCustomAction
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