{"id":13549236,"url":"https://github.com/mixpanel/mixpanel-flutter","last_synced_at":"2025-04-12T22:24:35.335Z","repository":{"id":37589497,"uuid":"328804346","full_name":"mixpanel/mixpanel-flutter","owner":"mixpanel","description":"Official Flutter Tracking Library for Mixpanel Analytics","archived":false,"fork":false,"pushed_at":"2025-04-11T19:50:57.000Z","size":495,"stargazers_count":73,"open_issues_count":42,"forks_count":97,"subscribers_count":29,"default_branch":"main","last_synced_at":"2025-04-11T19:51:43.150Z","etag":null,"topics":["analytics","analytics-tracking","android","flutter","flutter-sdk","ios","library","mixpanel","mixpanel-sdk","plugin","sdk","tracking"],"latest_commit_sha":null,"homepage":"https://mixpanel.com","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mixpanel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-11T22:12:16.000Z","updated_at":"2025-04-11T19:51:02.000Z","dependencies_parsed_at":"2024-01-09T06:47:06.965Z","dependency_job_id":"476858fb-f3a8-4b32-92bf-f04080202d50","html_url":"https://github.com/mixpanel/mixpanel-flutter","commit_stats":{"total_commits":173,"total_committers":15,"mean_commits":"11.533333333333333","dds":0.3179190751445087,"last_synced_commit":"765acc8d0f0c83ad6cf991441e6e6be54d652da4"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixpanel%2Fmixpanel-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixpanel%2Fmixpanel-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixpanel%2Fmixpanel-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixpanel%2Fmixpanel-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mixpanel","download_url":"https://codeload.github.com/mixpanel/mixpanel-flutter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248638773,"owners_count":21137708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","analytics-tracking","android","flutter","flutter-sdk","ios","library","mixpanel","mixpanel-sdk","plugin","sdk","tracking"],"created_at":"2024-08-01T12:01:19.712Z","updated_at":"2025-04-12T22:24:35.306Z","avatar_url":"https://github.com/mixpanel.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"\n\n\n\u003cdiv align=\"center\" style=\"text-align: center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/71290498/231855731-2d3774c3-dc41-4595-abfb-9c49f5f84103.png\" alt=\"Mixpanel Flutter SDK\" height=\"150\"/\u003e\n\u003c/div\u003e\n\n\n# Table of Contents\n\n\u003c!-- MarkdownTOC --\u003e\n- [Introduction](#introduction)\n- [Quick Start Guide](#quick-start-guide)\n    - [Install Mixpanel](#1-install-mixpanel)\n    - [Initialize Mixpanel](#2-initialize-mixpanel)\n    - [Send Data](#3-send-data)\n    - [Check for Success](#4-check-for-success)\n- [I want to know more!](#i-want-to-know-more)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n\n# Introduction\nWelcome to the official Mixpanel Flutter SDK.\nThe Mixpanel Flutter SDK is an open-source project, and we'd love to see your contributions!\nWe'd also love for you to come and work with us! Check out **[Jobs](https://mixpanel.com/jobs/#openings)** for details\n\n# Quick Start Guide\n\nCheck out our **[official documentation](https://developer.mixpanel.com/docs/flutter)** for more in depth information on installing and using Mixpanel on Flutter.\n\n## 1. Install Mixpanel\n### Prerequisites\n- [Setup development environment for Flutter](https://flutter.dev/docs/get-started/install)\n### Steps\n1. Depend on it  \\\nAdd this to your package's pubspec.yaml file:\n```\n   dependencies:\n      mixpanel_flutter: ^1.x.x # set this to your desired version\n```\n2. Install it \\\nYou can install packages from the command line:\n```\n   $ flutter pub get\n```\n3. Import it \\\nNow in your Dart code, you can use:\n```\nimport 'package:mixpanel_flutter/mixpanel_flutter.dart';\n```\n#### Flutter Web Support\nPlease add the following snippet to your `web/index.html` inside  `\u003chead\u003e\u003c/head\u003e` in your Flutter project.\n```\n\u003cscript src=\"./assets/packages/mixpanel_flutter/assets/mixpanel.js\"\u003e\u003c/script\u003e\n```\n## 2. Initialize Mixpanel\nTo start tracking with the SDK you must first initialize with your project token. To initialize the SDK, first add `import 'package:mixpanel_flutter/mixpanel_flutter.dart';` and call `Mixpanel.init(token, trackAutomaticEvents);` with your project token and automatic events setting as it's arguments. You can find your token in [project settings](https://mixpanel.com/settings/project).\n```dart\nimport 'package:mixpanel_flutter/mixpanel_flutter.dart';\n...\nclass _YourClassState extends State\u003cYourClass\u003e {\n  Mixpanel mixpanel;\n\n  @override\n  void initState() {\n    super.initState();\n    initMixpanel();\n  }\n\n  Future\u003cvoid\u003e initMixpanel() async {\n    mixpanel = await Mixpanel.init(\"Your Mixpanel Token\", trackAutomaticEvents: false);\n  }\n...\n```\nOnce you've called this method once, you can access `mixpanel` throughout the rest of your application.\n\n## 3. Send Data\nOnce you've initialized the SDK, Mixpanel will \u003ca href=\"https://mixpanel.com/help/questions/articles/which-common-mobile-events-can-mixpanel-collect-on-my-behalf-automatically\" target=\"_blank\"\u003eautomatically collect common mobile events\u003c/a\u003e. You can enable/disable automatic collection through your project settings.\nWith the `mixpanel` object created in [the last step](#2-initialize-mixpanel) a call to `track` is all you need to send additional events to Mixpanel.\n```dart\n// Track with event-name\nmixpanel.track('Sent Message');\n// Track with event-name and property\nmixpanel.track('Plan Selected', properties: {'Plan': 'Premium'});\n```\nYou're done! You've successfully integrated the Mixpanel Flutter SDK into your app. To stay up to speed on important SDK releases and updates, star or watch our repository on [Github](https://github.com/mixpanel/mixpanel-flutter).\n## 4. Check for Success\n[Open up Events in Mixpanel](https://mixpanel.com/report/events)  to view incoming events.\nOnce data hits our API, it generally takes ~60 seconds for it to be processed, stored, and queryable in your project.\n\n👋 👋  Tell us about the Mixpanel developer experience! [https://www.mixpanel.com/devnps](https://www.mixpanel.com/devnps) 👍  👎\n\n# FAQ\n\n**I want to stop tracking an event/event property in Mixpanel. Is that possible?**\n\nYes, in Lexicon, you can intercept and drop incoming events or properties. Mixpanel won’t store any new data for the event or property you select to drop.  [See this article for more information](https://help.mixpanel.com/hc/en-us/articles/360001307806#dropping-events-and-properties).\n\n**I have a test user I would like to opt out of tracking. How do I do that?**\n\nMixpanel’s client-side tracking library contains the  [optOutTracking()](https://mixpanel.github.io/mixpanel-flutter/mixpanel_flutter/Mixpanel/optOutTracking.html)  method, which will set the user’s local opt-out state to “true” and will prevent data from being sent from a user’s device. More detailed instructions can be found in the section,  [Opting users out of tracking](https://developer.mixpanel.com/docs/flutter#opting-users-out-of-tracking).\n\n**Why aren't my events showing up?**\n\nFirst, make sure your test device has internet access. To preserve battery life and customer bandwidth, the Mixpanel library doesn't send the events you record immediately. Instead, it sends batches to the Mixpanel servers every 60 seconds while your application is running, as well as when the application transitions to the background. You can call  [flush()](https://mixpanel.github.io/mixpanel-flutter/mixpanel_flutter/Mixpanel/flush.html)  manually if you want to force a flush at a particular moment.\n\n```\nmixpanel.flush();\n```\n\nIf your events are still not showing up after 60 seconds, check if you have opted out of tracking. You can also enable Mixpanel debugging and logging, it allows you to see the debug output from the Mixpanel library. To enable it, call  [setLoggingEnabled](https://mixpanel.github.io/mixpanel-flutter/mixpanel_flutter/Mixpanel/setLoggingEnabled.html)  to true, then run your iOS project with Xcode or android project with Android Studio. The logs should be available in the console.\n\n```\nmixpanel.setLoggingEnabled(true);\n```\n\n**Starting with iOS 14.5, do I need to request the user’s permission through the AppTrackingTransparency framework to use Mixpanel?**\n\nNo, Mixpanel does not use IDFA so it does not require user permission through the AppTrackingTransparency(ATT) framework.\n\n**If I use Mixpanel, how do I answer app privacy questions for the App Store?**\n\nPlease refer to our  [Apple App Developer Privacy Guidance](https://mixpanel.com/legal/app-store-privacy-details/)\n\n# I want to know more!\n\nNo worries, here are some links that you will find useful:\n* **[Sample app](https://github.com/mixpanel/mixpanel-flutter/tree/main/example)**\n* **[Full API Reference](https://developer.mixpanel.com/docs/flutter)**\n\nHave any questions? Reach out to Mixpanel [Support](https://help.mixpanel.com/hc/en-us/requests/new) to speak to someone smart, quickly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmixpanel%2Fmixpanel-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmixpanel%2Fmixpanel-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmixpanel%2Fmixpanel-flutter/lists"}