{"id":19914733,"url":"https://github.com/fullstorydev/fullstory-segment-middleware-android","last_synced_at":"2025-05-03T05:31:49.455Z","repository":{"id":44752700,"uuid":"269399630","full_name":"fullstorydev/fullstory-segment-middleware-android","owner":"fullstorydev","description":"Enables sending Segment Analytics data to FullStory and adding FullStory session replay links to Segment events","archived":false,"fork":false,"pushed_at":"2024-02-22T14:31:26.000Z","size":203,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-02-22T15:40:00.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fullstorydev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-04T15:43:05.000Z","updated_at":"2024-02-22T14:03:57.000Z","dependencies_parsed_at":"2022-09-06T01:20:52.699Z","dependency_job_id":null,"html_url":"https://github.com/fullstorydev/fullstory-segment-middleware-android","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fullstorydev","download_url":"https://codeload.github.com/fullstorydev/fullstory-segment-middleware-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224354151,"owners_count":17297401,"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":[],"created_at":"2024-11-12T21:36:54.068Z","updated_at":"2024-11-12T21:36:55.019Z","avatar_url":"https://github.com/fullstorydev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Deprecation Notice**\n\nAs of February 22nd, 2024, this repository will no longer have any maintenance performed, but will remain published in its current form for the time being. Please be sure to consider this when utilizing any of the information \u0026 code found within.\n\n# FullStory Segment Middleware Android\n\nSegment is a customer data platform that unifies data collection and provides data to every team in your company. The middleware is a easy way to integrate FullStory with the Segment Analytics for Android SDK.\n\nWith minimal code changes, the FullStory Segment Middleware provides developers the ability to send Segment Analytics data to FullStory, and adds FullStory session replay links to Segment events.\n\n### More information\n\n[FullStory Getting Started with Android Recording](https://help.fullstory.com/hc/en-us/articles/360040596093-Getting-Started-with-Android-Recording)\n\n[Segment Middleware for Android](https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/middleware/)\n\nFullStory's KB Article: [FullStory Integration with Segment Technical Guide - Mobile](https://help.fullstory.com/hc/en-us/articles/360051691994-FullStory-Integration-with-Segment-Technical-Guide-Mobile-Beta-)\n\n## Sending data to FullStory using Middleware\n\n### Handle Login/Logout\n\n#### Identify a user and their traits at login\n\nSimilar to `FS.identify`, Segment has an `Analytics.identify` API that lets you tie a user’s identity to their actions and recordings in order to help you understand their journey.\n\nWith this API, you can also record what Segment calls traits (`userVars` in FullStory) about your users, like their email, name, preferences, etc.\n\nThe middleware automatically hooks into Segment's API: `Analytics.identify` that sends the user ID and traits to FullStory\n\n#### Anonymize the user at logout\n\nIf your app supports login/logout, then you need to anonymize logged in users when they log out by calling `Analytics.reset` to clear Segment cache and anonymize the user. Make sure you set the correct segment tag when initializing FullStoryMiddleware. See implementation details below.\n\nAlternatively, you can manually call `FS.anonymize` after Analytics.reset, see below section \"Manual Client-side integration\" for more information\n\n### Custom events\n\nSimilar to identify, we can automatically hook into `Analytics.track` and `Analytics.screen` events and funnel the data to FullStory session replay.\n\nNote that by default, no track or screen events are recorded as custom events. Learn more about our [Privacy by Default](https://help.fullstory.com/hc/en-us/articles/360044349073-FullStory-Private-by-Default) approach.\n\nWhen initiating the middleware, allowlist the events that you would like to send to FullStory. If you wish to enable all events, set `allowlistAllTrackEvents` to true. See below section \"Implementation Guide\" for code examples.\n\nWe will log to FullStory that a Segment API is called but omit all data if the event is not allowlisted.\n\nAll custom events are searchable in FullStory. You can find and view sessions that match your search criteria.\n\n## Add FS session replay URL to Segment events using Middleware\n\nWith FullStory for Mobile Apps, you can retrieve a link to the session replay and attach it to any Segment event.\n\n- By default we automatically insert the FullStory session replay URL as part of the Segment track and screen event properties, and all event contexts.\n\n- Depending on the destinations, some may receive only properties, others may be able to parse information in event context.\n\n- This enables you to receive FullStory session replay links at your destinations and easily identify and navigate to the session of interest.\n\n- You can disable this behavior by setting enableFSSessionURLInEvent to false\n\n## Implementation Guide\n\n1. Before you begin, make sure you have both FullStory and Segment setup in your application:\n\n    - Add FullStory to your Android app: [Getting Started with Android Recording](https://help.fullstory.com/hc/en-us/articles/360040596093-Getting-Started-with-Android-Recording)\n\n    - Use Gradle to add as dependencies:\n\n      - Android (via jitpack):  Root build.gradle:\n\n      ```gradle\n      allprojects {\n          repositories {\n              ...\n              maven {\n                  url 'https://jitpack.io'\n              }\n          }\n      }\n      ```\n\n      - App level build.gradle:\n\n      ```gradle\n      implementation 'com.github.fullstorydev:fullstory-segment-middleware-android:1.2.3'\n      ```\n\n    - Alternatively, download the files manually:\n\n      - Add the files inside [FullStoryMiddleware](https://github.com/fullstorydev/fullstory-segment-middleware-android/tree/master/fullstory-segment-middleware/src/main/java/com/fullstorydev/fullstory_segment_middleware)  to your Android project\n\n2. Add the middleware during the initialization of your segment analytics client to enable FullStory.\n\n    - Create FullStoryMiddleware with appropriate settings. \n\n      ```java\n      // use the same values as Segment builder uses. By default, uses your segment write key\n      // if you set a custom segment, tag explicitly (see below),\n      // use the same tag rather than the write key to init FullStoryMiddleware\n      FullStoryMiddleware fsm = new FullStoryMiddleware(getApplicationContext(),\n                                                \"write_key\",\n                                                [\"Order Completed\",\n                                                  \"Viewed Checkout Step\",\n                                                  \"Completed Checkout Step\"]);\n\n      // enable to insert FS session URL to Segment event properties and contexts\n      // default to true\n      fsm.enableFSSessionURLInEvents = true;\n      // when calling Segment group, send group traits as userVars\n      // default to false\n      fsm.enableGroupTraitsAsUserVars = true;\n      // when calling Segment screen, sent the screen event as custom events to FS\n      // default to false\n      fsm.enableSendScreenAsEvents = true;\n      // allow all track events as FS custom events\n      // alternatively allow list that you would like to track\n      // default to false\n      fsm.allowlistAllTrackEvents = true;\n      // enable Segment identify event to be sent as FS identify event\n      // default to true\n      fsm.enableIdentifyEvents = true;\n\n      Analytics analytics = new Analytics\n          .Builder(getApplicationContext(), \"your_key\")\n          .useSourceMiddleware(fsm)\n          .build();\n      ```\n      \n    \u003e To set a custom tag for your Segment instance, use the [`tag` function](https://github.com/segmentio/analytics-android/blob/d263870011fc92e88f16d7ae35a53d8a9883ba7c/analytics/src/main/java/com/segment/analytics/Analytics.java#L1188) when building your Segment client.\n\n3. Your integration is now ready.\n\n#### Local Develop\nThe `demo` app is included in the project. By default the demo app is excluded from the build, add the following line and sync gradle to include it.\n\n```\ninclude.demo=true\n```\n\nYou should now see the `demo` module, and should be able to run the demo app against the local version of the middleware and make or apply changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullstorydev%2Ffullstory-segment-middleware-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffullstorydev%2Ffullstory-segment-middleware-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullstorydev%2Ffullstory-segment-middleware-android/lists"}