{"id":19914730,"url":"https://github.com/fullstorydev/fullstory-segment-middleware-ios","last_synced_at":"2025-05-03T05:31:46.025Z","repository":{"id":44770377,"uuid":"269400319","full_name":"fullstorydev/fullstory-segment-middleware-ios","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:04.000Z","size":12465,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-02-22T15:39:54.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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:45:54.000Z","updated_at":"2024-02-22T14:05:35.000Z","dependencies_parsed_at":"2022-08-29T00:51:03.726Z","dependency_job_id":null,"html_url":"https://github.com/fullstorydev/fullstory-segment-middleware-ios","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-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullstorydev%2Ffullstory-segment-middleware-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fullstorydev","download_url":"https://codeload.github.com/fullstorydev/fullstory-segment-middleware-ios/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:53.891Z","updated_at":"2024-11-12T21:36:53.970Z","avatar_url":"https://github.com/fullstorydev.png","language":"Objective-C","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 iOS\n\nSegment is a customer data platform that unifies data collection and provides data to every team in your company. The middleware is an easy way to integrate FullStory with the Segment Analytics for iOS 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 iOS Recording](https://help.fullstory.com/hc/en-us/articles/360042772333-Getting-Started-with-iOS-Recording)\n\n[Segment Middleware for iOS](https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/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 the `Analytics.identify` Segment API that sends 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 this user.\n\nAlternatively, you can manually call `FS.anonymize` after Analytics.reset; see the \"Manual Client side integration\" section below 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 iOS app: [Getting Started with iOS Recording](https://help.fullstory.com/hc/en-us/articles/360042772333-Getting-Started-with-iOS-Recording)\n\n    - Use CocoaPods to add to project:\n\n      ```ruby\n      pod 'FullStorySegmentMiddleware', :git =\u003e 'https://github.com/fullstorydev/fullstory-segment-middleware-ios.git',:tag =\u003e '1.2.2'\n      ```\n\n    - Alternatively, download the files manually:\n\n      - Add the files inside [FullStoryMiddleware](https://github.com/fullstorydev/fullstory-segment-middleware-ios/tree/sabrina/dev/FullStoryMiddleware)  to your iOS 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      ```swift\n      let fullStoryMiddleware: FullStoryMiddleware\n            = FullStoryMiddleware.init(allowlistEvents:\n                    [\"Order Completed\",\n                      \"Viewed Checkout Step\",\n                      \"Completed Checkout Step\"])\n\n      // allow all events to be tracked by FS, default is false\n      fsm.allowlistAllTrackEvents = true\n      // allow FS session URL to be added in Segemnt event properties, default is true\n      fsm.enableFSSessionURLInEvents = true\n      // enable to send group traits as userVars, default is false\n      fsm.enableGroupTraitsAsUserVars = true\n      // enable to send FS custom events on screen event, default is false\n      fsm.enableSendScreenAsEvents = true\n      // enable Segment identify events to be sent as FS identify event, default is true\n      fsm.enableIdentifyEvents = true\n\n      configuration.middlewares = [fsm]\n      SEGAnalytics.setup(with: configuration)\n      ```\n\n3. Your integration is now ready.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullstorydev%2Ffullstory-segment-middleware-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffullstorydev%2Ffullstory-segment-middleware-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullstorydev%2Ffullstory-segment-middleware-ios/lists"}