Skip to content

Instantly share code, notes, and snippets.

@flurrydev
Last active July 29, 2020 22:15
Show Gist options
  • Select an option

  • Save flurrydev/cdb79c403891de3e2868f66753b9250d to your computer and use it in GitHub Desktop.

Select an option

Save flurrydev/cdb79c403891de3e2868f66753b9250d to your computer and use it in GitHub Desktop.
// Methods to initialize Flurry
Flurry.Builder.withAppVersion(versionName = '1.0'); // iOS only. For Android, please use Flurry.setVersionName() instead.
Flurry.Builder.withContinueSessionMillis(sessionMillis = 10000);
Flurry.Builder.withCrashReporting(crashReporting = true);
Flurry.Builder.withDataSaleOptOut(isOptOut = false);
Flurry.Builder.withIAPReportingEnabled(enableIAP = true); // iOS only.
Flurry.Builder.withIncludeBackgroundSessionsInMetrics(includeBackgroundSessionsInMetrics = true);
Flurry.Builder.withLogEnabled(enableLog = true);
Flurry.Builder.withLogLevel(logLevel = Flurry.LogLevel.WARN); // LogLevel = { VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT }
Flurry.Builder.withPerformanceMetrics(performanceMetrics = Flurry.PerformanceMetrics.ALL)); // performanceMetrics = { NONE, COLD_START, SCREEN_TIME, ALL }
Flurry.Builder.withMessaging(enableMessaging = true); // not available on tvOS
Flurry.Builder.withTVSessionReportingInterval(interval = 5); // tvOS only
Flurry.Builder.withTVEventCountThreshold(threshold = 10); // tvOS only
Flurry.Builder.build(apiKeyAndroid: string, apiKeyIos: string); // preferred; passing null if not available
Flurry.Builder.build(apiKey: string); // use when only single platform is supported, or shared (not recommended)
// Methods to set user preferences
Flurry.setAge(age: number);
Flurry.setGender(gender: Flurry.Gender); // Gender = { MALE, FEMALE }
Flurry.setReportLocation(reportLocation: boolean);
Flurry.setSessionOrigin(originName: string, deepLink: string);
Flurry.setUserId(userId: string);
Flurry.setVersionName(versionName: string); // Android only. For iOS, please use Flurry.Builder.withAppVersion() instead.
Flurry.setDataSaleOptOut(isOptOut: boolean);
Flurry.deleteData();
Flurry.addOrigin(originName: string, originVersion: string);
Flurry.addOrigin(originName: string, originVersion: string, originParameters: { [key: string]: string; });
Flurry.addSessionProperty(name: string, value: string);
// Methods to set user properties
Flurry.UserProperties.set(propertyName: string, propertyValue: string);
Flurry.UserProperties.set(propertyName: string, propertyValues: string[]);
Flurry.UserProperties.add(propertyName: string, propertyValue: string);
Flurry.UserProperties.add(propertyName: string, propertyValues: string[]);
Flurry.UserProperties.remove(propertyName: string);
Flurry.UserProperties.remove(propertyName: string, propertyValue: string);
Flurry.UserProperties.remove(propertyName: string, propertyValues: string[]);
Flurry.UserProperties.flag(propertyName: string);
// Methods to get Flurry versions
Flurry.getVersions(): Promise<{ agentVersion: number; releaseVersion: string; sessionId: string; }>;
Flurry.getVersions(errorCallback: (errorMessage: string) => void,
successCallback: (agentVersion: number, releaseVersion: string, sessionId: string) => void);
// Methods to log Flurry events
Flurry.logEvent(eventId: string);
Flurry.logEvent(eventId: string, timed: boolean);
Flurry.logEvent(eventId: string, parameters: { [key: string]: string; });
Flurry.logEvent(eventId: string, parameters: { [key: string]: string; }, timed: boolean);
Flurry.endTimedEvent(eventId: string);
Flurry.endTimedEvent(eventId: string, parameters: { [key: string]: string; });
Flurry.onPageView(); // Deprecated, API removed, no longer supported by Flurry.
Flurry.onError(errorId: string, message: string, errorClass: string);
Flurry.onError(errorId: string, message: string, errorClass: string, errorParams: { [key: string]: string; });
Flurry.logBreadcrumb(crashBreadcrumb: string);
Flurry.logPayment(productName: string, productId: string, quantity: number, price: number,
currency: string, transactionId: string, parameters: { [key: string]: string; });
// Methods to enable IAP reporting (iOS and tvOS)
Flurry.setIAPReportingEnabled(enableIAP: boolean);
// Methods for Flurry Performance Metrics
Flurry.Performance.startResourceLogger();
Flurry.Performance.logResourceLogger(id: string);
Flurry.Performance.reportFullyDrawn();
// Methods for Flurry Config
Flurry.addConfigListener (callback: (event: { Type: string; isCache?: boolean; isRetrying?: boolean; }) => void);
Flurry.removeConfigListener(callback: (event: { Type: string; isCache?: boolean; isRetrying?: boolean; }) => void);
Flurry.fetchConfig();
Flurry.activateConfig():
Flurry.getConfigString(key: string, defaultValue: string): Promise<{ [key: string]: string; }>;
Flurry.getConfigString(keyAndDefault: { [key: string]: string; }): Promise<{ [key: string]: string; }>;
// Methods for Messaging (Flurry Push)
Flurry.addMessagingListener(callback: (message: { Type: string;
Title?: string; Body?: string; Data?: { [key: string]: string; }; ClickAction?: string;
Token?: string; }) => void);
Flurry.removeMessagingListener(callback: (message: { Type: string;
Title?: string; Body?: string; Data?: { [key: string]: string; }; ClickAction?: string;
Token?: string; }) => void);
Flurry.willHandleMessage(handled: boolean);
Flurry.printMessage(message: { Type: string;
Title?: string; Body?: string; Data?: { [key: string]: string; }; ClickAction?: string;
Token?: string; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment