{"id":21762097,"url":"https://github.com/segment-integrations/analytics-swift-consent-onetrust","last_synced_at":"2025-10-27T18:43:22.085Z","repository":{"id":205838432,"uuid":"690722047","full_name":"segment-integrations/analytics-swift-consent-onetrust","owner":"segment-integrations","description":"OneTrust integration for Analytics Swift","archived":false,"fork":false,"pushed_at":"2024-05-22T17:19:42.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T04:41:39.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"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/segment-integrations.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-12T18:34:58.000Z","updated_at":"2024-05-22T17:19:46.000Z","dependencies_parsed_at":"2024-11-26T12:11:05.484Z","dependency_job_id":"556363fe-3a13-4f63-b325-bafe87eb095d","html_url":"https://github.com/segment-integrations/analytics-swift-consent-onetrust","commit_stats":null,"previous_names":["segment-integrations/analytics-swift-consent-onetrust"],"tags_count":1,"template":false,"template_full_name":"segment-integrations/analytics-swift-destination-template","purl":"pkg:github/segment-integrations/analytics-swift-consent-onetrust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fanalytics-swift-consent-onetrust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fanalytics-swift-consent-onetrust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fanalytics-swift-consent-onetrust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fanalytics-swift-consent-onetrust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segment-integrations","download_url":"https://codeload.github.com/segment-integrations/analytics-swift-consent-onetrust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fanalytics-swift-consent-onetrust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281323512,"owners_count":26481556,"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","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-26T12:10:54.832Z","updated_at":"2025-10-27T18:43:22.037Z","avatar_url":"https://github.com/segment-integrations.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Segment Consent Management - OneTrust Integration\n\nAdd Segment + OneTrust driven consent management support for your application via this plugin for [Analytics-Swift](https://github.com/segmentio/analytics-swift) \n\nRead more about Segment's Consent Management solutions [here](https://segment.com/docs/privacy/configure-consent-management/), as well as enabling it for your workspace.\n\n## Getting Started\n\n### via Xcode\nIn the Xcode `File` menu, click `Add Packages`.  You'll see a dialog where you can search for Swift packages.  In the search field, enter the URL to these repos.\n\nhttps://github.com/segment-integrations/analytics-swift-consent\nhttps://github.com/segment-integrations/analytics-swift-consent-onetrust\n\nYou'll then have the option to pin to a version, or specific branch, as well as which project in your workspace to add it to.  Once you've made your selections, click the `Add Package` button.  \n\n### via Package.swift\n\nOpen your Package.swift file and add the following to your `dependencies` section:\n\n```\n.package(\n            name: \"SegmentConsent\",\n            url: \"https://github.com/segment-integrations/analytics-swift-consent.git\",\n            from: \"1.0.0\"\n        ),\n.package(\n            name: \"SegmentConsentOneTrust\",\n            url: \"https://github.com/segment-integrations/analytics-swift-consent-onetrust.git\",\n            from: \"1.0.0\"\n        ),\n```\n\nNext you'll need to write some setup/init code where you have your\nAnalytics setup:\n\n```swift\nimport Segment\nimport SegmentConsent\nimport SegmentConsentOneTrust\n\n...\n\nlet analytics = Analytics(configuration: Configuration(writeKey: \"\u003cyour write key\u003e\")\n            .flushAt(1)\n            .trackApplicationLifecycleEvents(true))\n\n// Add the Segment Consent Manager plugin.\n// We'll need the value of this so we can call\n// start(), to once OneTrust is configured.\nlet consentManager = ConsentManager(provider: OneTrustProvider()) {\n    // we were notified (optionally) that consent changed.\n    print(\"Consent Changed\")\n}\n\n// Optionally add the IDFAConsent plugin if ATT is to be used.\n// It will capture ATT changes and notify the consent manager.\n// You'll need to copy this code into YOUR codebase and modify it\n// to suit your needs.\n// NOTE: The code for this plugin can be found in the example app.\nanalytics.add(plugin: IDFAConsent())\n\n// once we do the setup, onetrust triggers the consent UI to pop up on\n// it's own.  you can do it manually if you prefer though, but any way\n// you slice it, you'll need a uiviewcontroller.\nif let mainViewController = UIApplication.shared.mainViewController {\n    OTPublishersHeadlessSDK.shared.setupUI(mainViewController, UIType: .preferenceCenter)\n}\n\n// Tell OneTrush SDK to start.\nOTPublishersHeadlessSDK.shared.startSDK(\n    storageLocation: \"cdn.cookielaw.org\",\n    domainIdentifier: \"\u003cyour domain identifier\u003e\",\n    languageCode: \"en\"\n) { response in\n    // Tell the Semgnet consent manager to start.  Until this happens,\n    // all events are queued so they can get the proper stamps and treatment.\n    consentManager.start()\n}\n\n```\n\nThe Consent Manager plugin will automatically add a ConsentBlockingPlugin to any device mode destinations, so there's no extra steps for you to do in your code. Blocking for cloud mode destinations will be handled server-side at Segment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegment-integrations%2Fanalytics-swift-consent-onetrust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegment-integrations%2Fanalytics-swift-consent-onetrust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegment-integrations%2Fanalytics-swift-consent-onetrust/lists"}