{"id":21478224,"url":"https://github.com/appsflyersdk/appsflyer-cocos2dx-plugin","last_synced_at":"2025-07-15T10:34:02.853Z","repository":{"id":44700992,"uuid":"105647505","full_name":"AppsFlyerSDK/appsflyer-cocos2dx-plugin","owner":"AppsFlyerSDK","description":"AppsFlyer Cocos2dX plugin","archived":false,"fork":false,"pushed_at":"2024-11-07T16:35:52.000Z","size":76790,"stargazers_count":10,"open_issues_count":5,"forks_count":11,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-07T17:36:22.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AppsFlyerSDK.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2017-10-03T12:11:13.000Z","updated_at":"2024-07-23T06:23:53.000Z","dependencies_parsed_at":"2024-11-07T17:44:54.931Z","dependency_job_id":null,"html_url":"https://github.com/AppsFlyerSDK/appsflyer-cocos2dx-plugin","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyerSDK%2Fappsflyer-cocos2dx-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyerSDK%2Fappsflyer-cocos2dx-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyerSDK%2Fappsflyer-cocos2dx-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppsFlyerSDK%2Fappsflyer-cocos2dx-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AppsFlyerSDK","download_url":"https://codeload.github.com/AppsFlyerSDK/appsflyer-cocos2dx-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226033199,"owners_count":17563127,"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-23T11:17:18.460Z","updated_at":"2024-11-23T11:17:19.289Z","avatar_url":"https://github.com/AppsFlyerSDK.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://massets.appsflyer.com/wp-content/uploads/2018/06/20092440/static-ziv_1TP.png\"  width=\"400\" \u003e \n\n# Cocos2dX AppsFlyer plugin for Android and iOS.\n\n----------\n\n\nIn order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com\n\n*When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.*\n\n----------\n\n## Table of content\n\n- [integration](#integration)\n- [Usage](#usage)\n- [Manual start mode](#manual-start)\n- [API methods](#api-methods)\n - [setIsDebug](#setIsDebug)\n - [stop](#stopTracking) \n - [sharingFilter](#sharingFilter) [Deprecated]\n - [sharingFilterForAllPartners](#sharingFilterForAllPartners) [Deprecated]\n - [logEvent](#trackEvent)\n - [getConversion Listener](#getConversionListener)\n - [setUserEmails](#setUserEmails)\n - [setCustomerUserID](#setCustomerUserID)\n - [setCurrencyCode](#setCurrencyCode)\n - [waitForATTUserAuthorizationWithTimeoutInterval](#waitForATTUserAuthorizationWithTimeoutInterval) *(ios only)*\n - [disableAdvertiserIdentifier](#disableAppleAdSupportTracking)\n - [setShouldCollectDeviceName](#setShouldCollectDeviceName)*(ios only)*\n - [setAppInviteOneLink](#setAppInviteOneLink)\n - [anonymizeUser opt-out](#deviceTrackingDisabled)\n - [disableCollectASA](#disableIAdTracking)*(ios only)*\n - [setUseReceiptValidationSandbox](#setUseReceiptValidationSandbox) *(ios olny)*\n - [setUseUninstallSandbox](#setUseUninstallSandbox) *(ios only)*\n - validateAndLogInAppPurchase\n    - [Android](#validateAndTrackInAppPurchase-a)\n    - [iOS](#validateAndTrackInAppPurchase-i)\n  - [getAppsFlyerUID](#getAppsFlyerUID)\n  - [handleOpenURL Deep-linking](#getAppsFlyerUID) *(ios only)*\n  - Uninstall\n    - [Android](#registerUninstallAndroid)\n    - [iOS](#registerUninstallIOS) \n  - [setHost](#setHost)\n  - [setMinTimeBetweenSessions](#setMinTimeBetweenSessions)\n  - [deep linking Logging](#deep-linking-tracking)\n  - generateInviteLink - TBD\n  - logCrossPromotionImpression - TBD\n  - logAndOpenStore - TBD\n   - [Unified deep linking](#ddl)\n   - [setPartnerData](#partnerData)\n- [setOneLinkCustomDomain](#customDomains)\n- [setCurrentDeviceLanguage](#currentLang) *(ios only)*\n- [setSharingFilterForPartners](#SharingFilterForPartners) \n- [setDisableNetworkData](#disableNetworkID)  *(android only)*\n- [Send consent for DMA compliance](#dma_support) \n- [validateAndLog](#validate_and_log_2.0) \n- [logAdrevenue](#logAdrevenue)\n\n\n### \u003ca id=\"plugin-build-for\"\u003e This plugin is built for\n\n- Android AppsFlyer SDK **v6.15.1** \n- iOS AppsFlyer SDK **v6.15.3**\n\n\n### \u003ca id=\"integration\"\u003e Integration:\n - [Android integration Documents](docs/Android_README.md)\n - [iOS integration Documents](docs/iOS_README.md)\n\n \n\n\n\n## \u003ca id=\"usage\"\u003e Usage:\n\n#### 1\\. Set your  Dev_Key and enable AppsFlyer to detect installations, sessions (app opens) and updates.\n\u003e This is the minimum requirement to start measuring your app installs and is already implemented in this plugin. You **MUST** modify this call and provide:\n**-devKey** - Your application devKey provided by AppsFlyer.\n**-appId**  - (*For iOS only*) Your iTunes Application ID.\n\n\n\nAdd the following lines into `applicationDidFinishLaunching` and to `applicationWillEnterForeground` method to be able to initialize measuring with your own AppsFlyer dev key:\n\n\n```cpp\n#include \"AppsFlyer/AppsFlyerX.h\"\n\nbool AppDelegate::applicationDidFinishLaunching() {\n  AppsFlyerX::setAppsFlyerDevKey(\"YOUR_DEV_KEY\");\n\n#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n    AppsFlyerX::setAppleAppID(\"942960987\");\n#endif\n  \n#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)\n    AppsFlyerX::start();\n#endif\n}\n\nvoid AppDelegate::applicationWillEnterForeground() {\n   //..\n#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)\n    AppsFlyerX::start();\n#endif\n}\n```\n\nAlso notify AppsFlyer SDK about background event:\n\n```cpp\nvoid AppDelegate::applicationDidEnterBackground() {\n\n    //...\n    AppsFlyerX::didEnterBackground();\n}\n\n```\n\n## \u003ca id=\"manual-start\"\u003e Manual mode:\nStarting version 6.13.0, we support a manual mode to seperate the initialization of the AppsFlyer SDK and the start of the SDK. In this case, the AppsFlyer SDK won't start automatically, giving the developer more freedom when to start the AppsFlyer SDK. Please note that in manual mode, the developer is required to implement the API start() in order to start the SDK.\n\u003cbr\u003eIf you are using CMP to collect consent data this feature is needed. See explanation [here](#dma_support).\n### Examples:\n \n```cpp\nbool AppDelegate::applicationDidFinishLaunching() {\n...\n    AppsFlyerX::setAppsFlyerDevKey(\"devkey\");\n\n#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n    // In case you want to use manual mode. \n    AppsFlyerX::setManualStart(true);\n    // \n    AppsFlyerX::setAppleAppID(\"appleAppId\");\n...\n}\n```\n- See that we aren't calling any AppsFlyerX::start() in any case. \nThe init function is called in the background in order to catch any deeplinking.\n\n\nAnd to start the AppsFlyer SDK:\n\n### Example:\n\n```cpp\n//In case you use manual mode\n #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n     AppsFlyerX::setManualStart(false);\n #endif\n AppsFlyerX::start();\n // \n ```\n\n\n## \u003ca id=\"api-methods\"\u003e API Methods\n\n---\n\n##### \u003ca id=\"setIsDebug\"\u003e **`setIsDebug(boolean);`**\n\n if `true` AppsFlyer SDK will run in debug mode\n\n\n*Example:*\n\n```cpp\nAppsFlyerX::setIsDebug(true);\n```\n\n---\n\n##### \u003ca id=\"stopTracking\"\u003e **`stopTracking(boolean);`**\n\n if `true` AppsFlyer SDK will enter to pending mode, no activity\nBe sure to set `stop(false)` to release the SDK from stop measuring events\n\n*Example:*\n\n```cpp\nAppsFlyerX::stop(false); // or false\n```\n---\n##### \u003ca id=\"sharingFilter\"\u003e **`sharingFilter(partners);`**\n Use to prevent sharing data with some (one or more) networks/integrated partners.\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `eventName` | `std::vector\u003cstd::string\u003e`  | list of partners\n\n\n*Example:*\n\n```cpp\n  std::vector\u003cstd::string\u003e partners;\n  partners.push_back(\"facebook_int\");\n  partners.push_back(\"googleadwords_int\");\n  AppsFlyerX::sharingFilter(partners);\n```\n---\n##### \u003ca id=\"sharingFilterForAllPartners\"\u003e **`sharingFilterForAllPartners();`**\n\nUse to prevent sharing data with all networks/integrated partners.\n\n```cpp\nAppsFlyerX::sharingFilterForAllPartners();\n```\n___\n\n##### \u003ca id=\"validate_and_log_2.0\"\u003e **`Validate and log 2.0 API`**\n\n| Property      | Type                           | Description                                                       | Platform     |\n| ------------- | ------------------------------ | ----------------------------------------------------------------- | ------------ |\n| purchaseType  | `AFXPurchaseType`              | Purchase type of the event. For Apple implementation, use `APPLE`  | Android only |\n| purchaseToken | `std::string`                  | Field required to validate the purchase                           | Android only |\n| transactionId | `std::string`                  | Transaction ID of the Apple purchase                              | iOS only     |\n| productId     | `std::string`                  | ID of the purchased product                                       | Android/iOS  |\n| price         | `std::string`                  | Price of the product                                              | Android/iOS  |\n| currency      | `std::string`                  | Currency according to the ISO format (ISO 4217)                   | Android/iOS  |\n\n*Description:*\nThe `validateAndLogInAppPurchase` method is part of the receipt validation flow, which enables your app to validate in-app purchase events generated by Google Play and Apple.\n\n\n`AFSDXPurchaseDetails` encapsulates all purchase necessary data for Android and iOS. \n* `AFXPurchaseType` is used for Android only, so for iOS, be sure to use `APPLE` option, which is empty string and will be omitted by the implementation. \n* `purchaseToken` is the Android propperty, for Apple impl, please use empty string;\n* The `transactionId`is used by Apple implementation, Android omits this propperty;\n\n*Example:*\n```cpp\nValueMap params; // Additional parameters you want to pass to the API\nAFSDKXPurchaseDetails details = AFSDKXPurchaseDetails(AFXPurchaseType::SUBSCRIPTION, \"\", \"customId\", \"6.99\", \"USD\", \"transactionId\");\n\nAppsFlyerX::validateAndLogInAppPurchase(details, params, [](const AFSDKXValidateAndLogResult\u0026 result) { \n  // Your implementation of the completion/callback block;\n});\n```\n\n**Note:** For Android SDK, the callback block does not return anything for now, it will be supported in the next update; \n\n---\n\n\n##### \u003ca id=\"logAdrevenue\"\u003e **`Log AdRevenue API`**\n\n*Description:*\n\nWhen an impression with revenue occurs, invoke the logAdRevenue method with the revenue details of the impression.\n\n`AFXAdRevenueData` object encapsulates all data related to the AdRevenue event: \n\n| Property                | Type                                        | Description                                       |\n| ----------------------- | ------------------------------------------- | ------------------------------------------------- |\n| monetizationNetwork      | `std::string`                               | The name of the monetization network               |\n| mediationNetwork         | `AppsFlyerXAdRevenueMediationNetworkType`   | The type of mediation network being used           |\n| currencyIso4217Code      | `std::string`                               | Currency code according to the ISO format (ISO 4217) |\n| eventRevenue            | `double`                                    | Revenue generated from the ad event                |\n\n\n\n*Example:*\n```cpp\nValueMap params; // Additional parameters you want to pass to the API\nAFXAdRevenueData data = AFXAdRevenueData(\"someVal\", AppsFlyerXAdRevenueMediationNetworkType::ApplovinMax, \"USD\", 7.99);\n\nAppsFlyerX::logAdRevenue(data, params);\n```\n\n\n---\n\n##### \u003ca id=\"logEvent\"\u003e **`trackEvent(eventName, eventValues): void`** (optional)\n\n\n- These in-app events help you track how loyal users discover your app, and attribute them to specific\ncampaigns/media-sources. Please take the time define the event/s you want to measure to allow you\nto track ROI (Return on Investment) and LTV (Lifetime Value).\n- The `logEvent` method allows you to send in-app events to AppsFlyer analytics. This method allows you to add events dynamically by adding them directly to the application code.\n\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `eventName` | `string`                    | custom event name, is presented in your dashboard.  See the Event list [HERE](https://github.com/AppsFlyerSDK/AppsFlyerCocos2dX/blob/dev/RD-8680/Android-docs/Classes/AppsFlyer/AppsFlyerXMacro.h)  |\n| `eventValues` | `cocos2d::ValueMap`                    | event details |\n\n*Example:*\n\n```cpp\n//basic implementation\nAppsFlyerX::logEvent(AFEventPurchase, {{ \"key1\", cocos2d::Value(\"value1\")},\n                                         { \"key2\", cocos2d::Value(\"value2\")}});\n\n//rich in-app-event implementation:\nAppsFlyerX::logEvent(AFEventPurchase, {\n                        { AFEventParamContentId, Value({Value(\"12344\"), Value(\"98844\"), Value(\"39944\")})},\n                        { AFEventParamCurrency, Value({Value(20), Value(11), Value(61)})},\n                        { AFEventParamPrice, Value({Value(25), Value(50), Value(10)})},\n                        { AFEventParamContentType, Value(\"ELECTRONIC\")},\n                        { AFEventParamCurrency, Value(\"USD\")},\n                        {AFEventParamRevenue, cocos2d::Value(\"10.67\")}\n                });\n```\n---\n\n*More info about rich in-app-events you can find* [HERE](https://support.appsflyer.com/hc/en-us/articles/115005544169#multiple-items)\n\n##### \u003ca id=\"getConversionListener\"\u003e **`Attribution Data callback`**\n\nAppsFlyer allows you to access the user attribution data in real-time directly at SDK level. It enables you to customize the landing page a user sees on the very first app open after a fresh app install.\n\nTo access AppsFlyer's conversion data from the Android SDK implement the ConversionDataListener callback:\n\n*Examples:*\n\n```cpp\n\nstatic void onConversionDataReceived(cocos2d::ValueMap installData) {}\n\nstatic void onConversionDataRequestFailure(cocos2d::ValueMap map) {\n/*has signature {\n                 {\"status\": \"failure\"},\n                 {\"data\", \"errorMessage\"}\n                 }*/\n}\n\nstatic void onAppOpenAttribution(cocos2d::ValueMap map) {}\n\nstatic void onAppOpenAttributionFailure(cocos2d::ValueMap map) {\n/*has signature {\n                 {\"status\": \"failure\"},\n                 {\"data\", \"errorMessage\"}\n                 }*/\n}\n\nAppsFlyerX::setOnConversionDataReceived(onConversionDataReceived);\nAppsFlyerX::setOnConversionDataRequestFailure(onConversionDataRequestFailure);\nAppsFlyerX::setOnAppOpenAttribution(onAppOpenAttribution);\nAppsFlyerX::setOnAppOpenAttributionFailure(onAppOpenAttributionFailure);\n```\n---\n\n##### \u003ca id=\"setUserEmails\"\u003e **`setUserEmails(userEmails, type): void`** (optional)\n\nAppsFlyer enables you to report one or more of the device’s associated email addresses. You must collect the email addresses and report it to AppsFlyer according to your required encryption method.\nThe following encryption methods are available: SHA1, MD5, SHA256 and plain.\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `userEmails`| `std::vector\u003cstd::string\u003e`              |   ---     |  list of emails |\n| `type`| `EmailCryptTypeX`              |   ---     |  [crypt type](https://github.com/AppsFlyerSDK/AppsFlyerCocos2dX/blob/dev/RD-8680/Android-docs/Classes/AppsFlyer/EmailCryptTypeX.h): None, sha1, sha256, md5 |\n\n*Examples:*\n\n```cpp\nAppsFlyerX::setUserEmails({\"kinzer.appsf@gmail.com\"}, XEmailCryptTypeSHA256);\n```\n\n---\n\n##### \u003ca id=\"setCustomerUserID\"\u003e **`setCustomerUserID(customerUserId): void`**\n\n\nSetting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs.\n\n**Note:** The ID must be set during the first launch of the app at the SDK initialization. The best practice is to call this API during the `deviceready` event, where possible.\n\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `customerUserId`   | `const std::string\u0026`                      | |\n\n*Example:*\n\n```cpp\nAppsFlyerX::customerUserId(\"\u003cUSER_ID\u003e\");\n```\n---\n\n##### \u003ca id=\"setCurrencyCode\"\u003e **`setCurrencyCode(currencyId): void`**\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `currencyId`| `const std::string\u0026`              |   `USD`     |  [ISO 4217 Currency Codes](http://www.xe.com/iso4217.php)           |\n\n*Examples:*\n\n```cpp\nAppsFlyerX::setCurrencyCode(\"\u003cCURRENCY_ID\u003e\");\n```\n\n---\n##### \u003ca id=\"waitForATTUserAuthorizationWithTimeoutInterval\"\u003e **`waitForATTUserAuthorizationWithTimeoutInterval(double): void`** *(ios only)*\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `timeoutInterval`| `double`         |             |  See additional info [HERE](https://support.appsflyer.com/hc/en-us/articles/207032066-iOS-SDK-V6-X-integration-guide-for-developers#api-reference-waitforattuserauthorization) |\n\n---\n\n##### \u003ca id=\"disableAdvertiserIdentifier\"\u003e **`disableAdvertiserIdentifier(bool): void`**\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `flag`| `bool`              |   `false`     | disables AdvertiserIdentifier|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::disableAdvertiserIdentifier(true);\n```\n\n---\n\n##### \u003ca id=\"setShouldCollectDeviceName\"\u003e **`setShouldCollectDeviceName(bool): void`** *(ios only)*\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `flag`| `bool`              |   `false`     | enables/disables device name tracking|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::setShouldCollectDeviceName(true);\n```\n\n---\n\n##### \u003ca id=\"setAppInviteOneLink\"\u003e **`setAppInviteOneLink(string): void`** \n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `appInviteOneLinkID`| `std::string\u0026`              |       | Before calling start in your app, set the OneLink which is invoked according to the OneLink ID. See additional info [HERE](https://support.appsflyer.com/hc/en-us/articles/115004480866-User-Invite-Tracking)|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::setAppInviteOneLink(\"8eOw\");\n```\n\n---\n\n##### \u003ca id=\"anonymizeUser\"\u003e **`deviceTrackingDisabled(bool): void`**  \n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `flag`| `bool`              |   `false`     | AppsFlyer provides you a method to opt-out specific users from AppsFlyer analytics. This method complies with the latest privacy requirements and complies with Facebook data and privacy policies. Default is false. **Warning** Opting out users SEVERELY hurts your attribution information. Use this option ONLY on regions which legally bind you from collecting your users' information.|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::anonymizeUser(true);\n```\n\n---\n\n##### \u003ca id=\"disableCollectASA\"\u003e **`disableIAdTracking(bool): void`** *(ios only)*\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `flag`| `bool`              |   `false`     | enables/disables collect ASA|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::disableCollectASA(true);\n```\n\n---\n\n\n\n##### \u003ca id=\"setUseReceiptValidationSandbox\"\u003e **`setUseReceiptValidationSandbox(bool): void`** *(ios only)*\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `flag`| `bool`              |   `false`     | enables Receipt Validation Sandbox|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::setUseReceiptValidationSandbox(true);\n```\n\n---\n\n##### \u003ca id=\"setUseUninstallSandbox\"\u003e **`setUseUninstallSandbox(bool): void`** *(ios only)*\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `flag`| `bool`              |   `false`     | enables Uninstall Sandbox mode|\n\n*Examples:*\n\n```cpp\nAppsFlyerX::setUseUninstallSandbox(true);\n```\n\n---\n\n##### \u003ca id=\"validateAndLogInAppPurchase\"\u003e **`validateAndTrackInAppPurchase`**\n\n##### \u003ca id=\"validateAndLogInAppPurchase-a)\"\u003e **Android**\n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `publicKey`| `const std::string\u0026`              |        |  |\n| `signature`| `const std::string\u0026`              |        |  |\n| `purchaseData`| `const std::string\u0026`              |       |  |\n| `price`| `const std::string\u0026`              |        |  |\n| `currency`| `const std::string\u0026`              |        |  |\n| `additionalParameters`| `cocos2d::ValueMap`              |      |  |\n\n*Examples:*\n\n```cpp\nValueMap test_map;\ntest_map[\"key1\"] = \"value1\";\nstd::string base64EncodedPublicKey = \"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3dkBTr2pD2YSqSK2ewlEWwH9Llu0iA4PkwgVOyNRxOsHfrOlqi0Cm51qdNS0aqh/SMZkuQTAroqH3pAr9gVFOiejKRw+ymTaL5wB9+5n1mAbdeO2tv2FDsbawDvp7u6fIBejYt7Dtmih+kcu707fEO58HZWqgzx9qSHmrkMZr6yvHCtAhdBLwSBBjyhPHy7RAwKA+PE+HYVV2UNb5urqIZ9eI1dAv3RHX/xxHVHRJcjnTyMAqBmfFM+o31tp8/1CxGIazVN8HpVk8Qi2uqSS5HdKUu6VnIK8VuAHQbXQn4bG6GXx5Tp0SX1fKrejo7hupNUCgOlqsYHFYxsRkEOi0QIDAQAB\";\nstd::string signature = \"OaIdwQOcmrJrMKUx+URVy1I6aeKYiYzflkk1zIKVSs+dDv691neCbR+jlDDzVi3jfSkfirxQISxo7Pe1uzoYbpq9wBk/pMgVjjSbpvCojhA4d/Mwsf4mtAH2LJcVNjhMQdSWvGJlzva3OSt+KQ+9/pRJ15aYT2gFn3SpGSPxNxJmHPIOlM1Lr74MejVu9rnbcSjCB/oI0W4O58p9UWSt5MgmlpqlrK5YqTi1a1VnttY9r1IXFeltwZvmPbcWcYwRHFvemwYGX86huSOFBOYRfaYo9f+DinpoUoXKQEo0JrvKD2/dzFkbUTto1d2OPo1ddaYllgsb2UEV5wwFZFnemg==\";\nstd::string purchaseData = \"{\\\"orderId\\\":\\\"\\\",\\\"packageName\\\":\\\"com.appsflyer.testapp\\\",\\\"productId\\\":\\\"consumable\\\",\\\"purchaseTime\\\":1497531638107,\\\"purchaseState\\\":0,\\\"developerPayload\\\":\\\"2497525891514-5765886608164763986\\\",\\\"purchaseToken\\\":\\\"pfkalmpnnimamdllmincaida.AO-J1OymunlPCkDQZTf8bPcesoB0n1_ND3WFynoU91-v_R1Px46m3Q-DdRKNlxMVsP2pCTKpo1et1w1IpNVXQ8-zNpRo6a2nXP7a5fQWiDv2asL1dwJPCV8NghDHbstO084IlKo6xcgy\\\"}\";\n    \nAppsFlyerX::validateAndLogInAppPurchase(base64EncodedPublicKey, \n                                          signature, \n                        \"3.00\",\n                      \"ILS\",\n                      test_map);\n```\n\n---\n\n\n##### \u003ca id=\"validateAndLogInAppPurchase-i)\"\u003e **iOS**\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `productIdentifier`| `const std::string\u0026`              |        |  |\n| `price`| `const std::string\u0026`              |        |  |\n| `currency`| `const std::string\u0026`              |       |  |\n| `tranactionId`| `const std::string\u0026`              |        |  |\n| `params`| `cocos2d::ValueMap`              |        |  |\n| `successBlock`| `std::function\u003cvoid(cocos2d::ValueMap)\u003e`              |      |  |\n| `failureBlock`| `std::function\u003cvoid(cocos2d::ValueMap)\u003e`              |      |  |\n\n*Examples:*\n\n```cpp\nValueMap test_map;\ntest_map[\"key1\"] = \"value1\";\nstd::string productIdentifier = \"com.mycomp.inapppurchase.cons\";\nstd::string tr_id = \"1000000256672208\";\n  \nAppsFlyerX::validateAndLogInAppPurchase(productIdentifier, \n                                          \"1.99\",\n                                          \"USD\",\n                                          tr_id\n                      test_map, \n                      successBlock,\n                      failureBlock);\n```\n\n---\n\n##### \u003ca id=\"getAppsFlyerUID\"\u003e **`getAppsFlyerUID(): string`**\n\n\n*Examples:*\n\n```cpp \nstd::string appsflyerId = AppsFlyerX::getAppsFlyerUID();\n```\n\n---\n\n##### \u003ca id=\"handleOpenURL\"\u003e **`Deep-linking handleOpenURL(): void`** *(ios only)*\n\n- `void AppsFlyerX::handleOpenURL(const std::string\u0026 url, const std::string\u0026 sourceApplication)`\n- `void AppsFlyerX::handleOpenURL(std::string url, std::string sourceApplication, void* annotation)`\n- `void AppsFlyerX::handleOpenURL(std::string url, cocos2d::ValueMap options)`\n\n*Examples:*\n\n```cpp \nTBD\n```\n\n---\n\n##### \u003ca id=\"registerUninstallAndroid\"\u003e **`registerUninstall(const std::string\u0026 token): void`** *(Android only)*\n\n*Examples:*\n\n```cpp\nAppsFlyerX::registerUninstall(\"\u003cTOKEN\u003e\");\n```\n\nFor more Info see the [DOCs](https://support.appsflyer.com/hc/en-us/articles/208004986-Android-Uninstall-Tracking)\n\n\n\n\n\n##### \u003ca id=\"registerUninstallIOS\"\u003e **`registerUninstall(void* deviceToken, unsigned long length): void`** *(ios only)*\n\nYou can use the `registerUninstall(void* deviceToken, unsigned long length)` API.\n\n *or*\n \n As alternative way use directly native API:\nOpen your Xcode project and locate the file `AppController.mm` under the iOS folder inside your project. Add the following code snippet under `didFinishLaunchingWithOptions` :\n\n```cpp \n#import \"AppsFlyerLib.h\"\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n//...\nUIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |\n                                                    UIUserNotificationTypeBadge |\n                                                    UIUserNotificationTypeSound);\n    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes\n                                                                             categories:nil];\n    [application registerUserNotificationSettings:settings];\n    [application registerForRemoteNotifications];\n//..\n}\n\n- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {    \n    [[AppsFlyerLib shared] registerUninstall:deviceToken];\n}\n```\nand method implementation:\n\n```cpp \n- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {    \n    [[AppsFlyerLib shared] registerUninstall:deviceToken];\n}\n```\n\n\n\n---\n\n##### \u003ca id=\"setHost\"\u003e **`setHost(host): void`** \n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `host`| `std::string\u0026`              |       | host name that should override `appsflyer.com`|\n*Examples:*\n\n```cpp\nAppsFlyerX::setHost(\"mynewhost.com\");\n```\n\n---\n\n##### \u003ca id=\"setMinTimeBetweenSessions\"\u003e **`setMinTimeBetweenSessions(long): void`** \n\n\n| parameter   | type                  | Default     | description |\n| ----------- |-----------------------|-------------|-------------|\n| `minTimeBetweenSessions`| `unsigned long`              |       | host name that should override `appsflyer.com`|\n*Examples:*\n\n```cpp\nAppsFlyerX::setMinTimeBetweenSessions(9);\n```\n\n---\n\n\n\n##### \u003ca id=\"updateServerUninstallToken\"\u003e **`updateServerUninstallToken(\"token\"): void`**\n\nAllows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server.\nCan be used for Uninstall measuring.\n\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `token`   | `String`                      | GCM/FCM Token|\n\n\n---\n\n\n\n\n\n\n### \u003ca id=\"deep-linking-tracking\"\u003e Deep linking Tracking\n\n#### \u003ca id=\"dl-android\"\u003e Android\nIn ver. \u003e4.2.5 deeplinking metadata (scheme/host) is sent automatically\nTBD\n\n#### \u003ca id=\"dl-ios\"\u003e iOS URL Types\nTBD\n \n ### \u003ca id=\"ddl\"\u003e Unified deep linking\n```cpp \n#import \"AppsFlyerLib.h\"\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n//...\n AppsFlyerX::setDidResolveDeepLink(didResolveDeepLink);\n//..\n}\nstatic void didResolveDeepLink(AppsFlyerXDeepLinkResult result){\n    CCLOG(\"%s\", \"AppDelegate.cpp got ddl!\");\n    std::string ddl = \"Deep link data is \\n\";\n    switch (result.status) {\n    case NOTFOUND:\n            CCLOG(\"deep link not found\");\n            break;\n        case FOUND:\n            if (!result.deepLink.empty()){\n                if (!result.getMediaSource().empty()) {\n                    CCLOG(\"Media source is %s\", result.getMediaSource().c_str());\n                }\n                for (auto \u0026t : result.deepLink){\n                    CCLOG(\"%s - %s\", t.first.c_str(), t.second.asString().c_str());\n                    ddl.append(t.first.c_str());\n                    ddl.append(\" : \");\n                    ddl.append(t.second.asString().c_str());\n                    ddl.append(\"\\n\");\n                }\n            }\n    }\n    }\n}\n```\n--- \n \n##### \u003ca id=\"partnerData\"\u003e **`setPartnerData(\"partnerId\", data): void`**\n\nPartners and advertisers can add more data in SDK events.\n\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `partnerId`   | `String`                  | partner identifier|\n| `data`        | `cocos2d::ValueMap`       | data to add|\n\n```cpp \n  ValueMap data;\n    data[\"thePartnerId\"] = \"abcd\";\n    data[\"Item_id\"] = 1;\n    data[\"isLegacy\"] = false;\n    AppsFlyerX::setPartnerData(\"partnerID\", data);\n```\n\n---\n\n##### \u003ca id=\"customDomains\"\u003e **`setOneLinkCustomDomain(domains);`**\n Use to get conversion data with Branded links. \n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `domains` | `std::vector\u003cstd::string\u003e`  | list of custom domains\n\n\n*Example:*\n\n```cpp\n  std::vector\u003cstd::string\u003e domains;\n  domains.push_back(\"test.domain.com\");\n  domains.push_back(\"myDomain.com\");\n  AppsFlyerX::setOneLinkCustomDomain(domains);\n```\n\n---\n\n##### \u003ca id=\"currentLang\"\u003e **`setCurrentDeviceLanguage(language);`**\n Use to get conversion data with Branded links. \n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `language` | `std::string`  | Language to set\n\n\n*Example:*\n\n```cpp\n  AppsFlyerX::setCurrentDeviceLanguage(\"English\");\n```\n\n---\n\n##### \u003ca id=\"SharingFilterForPartners\"\u003e **`setSharingFilterForPartners(partners);`**\nUsed by advertisers to set some (one or more) networks/integrated partners to exclude from getting data.\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `partners` | `std::vector\u003cstd::string\u003e`  | partners to exclude from getting data\n\n\n*Example:*\n\n```cpp\n  std::vector\u003cstd::string\u003e partners;\n  partners.push_back(\"partners_1\");\n  AppsFlyerX::setSharingFilterForPartners(partners); // Single partner\n\n  std::vector\u003cstd::string\u003e partners;\n  partners.push_back(\"partners_1\");\n  partners.push_back(\"partners_2\");\n  AppsFlyerX::setSharingFilterForPartners(partners); // Multiple partner\n\n  std::vector\u003cstd::string\u003e partners;\n  partners.push_back(\"all\");\n  AppsFlyerX::setSharingFilterForPartners(partners); // All partners\n\n  std::vector\u003cstd::string\u003e partners;\n  partners.push_back(\"\");\n  AppsFlyerX::setSharingFilterForPartners(partners); // Reset list (default)\n\n  std::vector\u003cstd::string\u003e partners;\n  AppsFlyerX::setSharingFilterForPartners(partners); // Reset list (default)\n\n```\n\n---\n\n##### \u003ca id=\"SharingFilterForPartners\"\u003e **`setSharingFilterForPartners(partners);`**\nUsed by advertisers to set some (one or more) networks/integrated partners to exclude from getting data.\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `partners` | `std::vector\u003cstd::string\u003e`  | partners to exclude from getting data\n\n\n*Example:*\n\n```cpp\n\n```\n\n---\n\n\n\n##### \u003ca id=\"disableNetworkID\"\u003e **`setDisableNetworkData(disable);`**\nUse to opt-out of collecting the network operator name (carrier) and sim operator name from the device.\n\n| parameter   | type                        | description |\n| ----------- |-----------------------------|--------------|\n| `disable` | `bool`  | Defaults to false\n\n\n*Example:*\n\n```cpp\n  AppsFlyerX::setDisableNetworkData(true);\n```\n\n---\n \n ## **Migration Guide to v6**\n[Integration guide](https://support.appsflyer.com//hc/en-us/articles/207032066#introduction)\n[Migration guide](https://support.appsflyer.com/hc/en-us/articles/360011571778)\nIn v6 of AppsFlyer SDK there are some api breaking changes: \n\n|Before v6   | v6  |\n|---|---|\n| trackAppLaunch | start|\n| trackEvent  | logEvent  |\n| trackLocation | logLocation|\n| stopTracking  | stop  |\n| validateAndTrackInAppPurchase  | validateAndLogInAppPurchase  |\n| setDeviceTrackingDisabled | anonymizeUser|\n\n### iOS\non iOS you need to implement IDFA request pop up and add AppTrackTransparency framework in order for the plugin to work\n\n\n## \u003ca id=\"dma_support\"\u003e Send consent for DMA compliance \nFor a general introduction to DMA consent data, see [here](https://dev.appsflyer.com/hc/docs/send-consent-for-dma-compliance).\u003cbe\u003e \nThe SDK offers two alternative methods for gathering consent data:\u003cbr\u003e \n- **Through a Consent Management Platform (CMP)**: If the app uses a CMP that complies with the [Transparency and Consent Framework (TCF) v2.2 protocol](https://iabeurope.eu/tcf-supporting-resources/), the SDK can automatically retrieve the consent details.\u003cbr\u003e \n\u003cbr\u003eOR\u003cbr\u003e\u003cbr\u003e \n- **Through a dedicated SDK API**: Developers can pass Google's required consent data directly to the SDK using a specific API designed for this purpose. \n### Use CMP to collect consent data \nA CMP compatible with TCF v2.2 collects DMA consent data and stores it in \u003ccode\u003eSharedPreferences\u003c/code\u003e(Android) or \u003ccode\u003eNSUserDefaults\u003c/code\u003e(iOS). To enable the SDK to access this data and include it with every event, follow these steps:\u003cbr\u003e \n\u003col\u003e \n  \u003cli\u003e Call \u003ccode\u003eAppsFlyerX::enableTCFDataCollection(true)\u003c/code\u003e to instruct the SDK to collect the TCF data from the device. \n  \u003cli\u003e Set the the adapter to be manual(see (#manual-start)[manual mode]). \u003cbr\u003e This will allow us to delay the Conversion call to provide the SDK with the user consent. \n  \u003cli\u003e Use the CMP to decide if you need the consent dialog in the current session.\n  \u003cli\u003e If needed, show the consent dialog, using the CMP, to capture the user consent decision. Otherwise, go to step 6. \n  \u003cli\u003e Get confirmation from the CMP that the user has made their consent decision, and the data is available in \u003ccode\u003eSharedPreferences\u003c/code\u003e or \u003ccode\u003eNSUserDefaults\u003c/code\u003e.\n  \u003cli\u003e Call start the following way:\n   \n```\n #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n     AppsFlyerX::setManualStart(false);\n #endif\n AppsFlyerX::start();\n```\n\u003c/ol\u003e \n \n #### AppDelegate\n``` cpp\nbool AppDelegate::applicationDidFinishLaunching() {\n\n    AppsFlyerX::stop(false);\n    AppsFlyerX::enableTCFDataCollection(true);\n    AppsFlyerX::setIsDebug(true);\n    AppsFlyerX::setAppsFlyerDevKey(\"devkey\");\n\n#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n    // In case you want to use manual mode. \n    AppsFlyerX::setManualStart(true);\n    // \n    AppsFlyerX::setAppleAppID(\"appleAppId\");\n``` \n#### Scene class\n- after getting CMP results\n```cpp\n #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n     AppsFlyerX::setManualStart(false);\n #endif\n AppsFlyerX::start();\n```\n\n \n### Manually collect consent data \nIf your app does not use a CMP compatible with TCF v2.2, use the SDK API detailed below to provide the consent data directly to the SDK. \n\u003col\u003e \n  \u003cli\u003e Initialize \u003ccode\u003eAppsFlyerX\u003c/code\u003e using manual mode. This will allow us to delay the Conversion call in order to provide the SDK with the user consent. \n  \u003cli\u003e Determine whether the GDPR applies or not to the user.\u003cbr\u003e \n  - If GDPR applies to the user, perform the following:  \n      \u003col\u003e \n        \u003cli\u003e Given that GDPR is applicable to the user, determine whether the consent data is already stored for this session. \n            \u003col\u003e \n              \u003cli\u003e If there is no consent data stored, show the consent dialog to capture the user consent decision. \n              \u003cli\u003e If there is consent data stored continue to the next step. \n            \u003c/ol\u003e \n        \u003cli\u003e To transfer the consent data to the SDK create an object called \u003ccode\u003eAppsFlyerXConsent\u003c/code\u003e using the \u003ccode\u003eforGDPRUser()\u003c/code\u003e method with the following parameters:\u003cbr\u003e \n          - \u003ccode\u003ehasConsentForDataUsage\u003c/code\u003e - Indicates whether the user has consented to use their data for advertising purposes.\u003cbr\u003e\n          - \u003ccode\u003ehasConsentForAdsPersonalization\u003c/code\u003e - Indicates whether the user has consented to use their data for personalized advertising purposes.\n        \u003cli\u003e Call \u003ccode\u003eAppsFlyerX::setConsentData()\u003c/code\u003e with the \u003ccode\u003eAppsFlyerXConsent\u003c/code\u003e object.    \n        \u003cli\u003e Call start:\n\u003ccode\u003e\n#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n  AppsFlyerX::setManualStart(false);\n#endif\nAppsFlyerX::start();\n\u003c/code\u003e\n      \u003c/ol\u003e\u003cbr\u003e \n    - If GDPR doesn’t apply to the user perform the following: \n      \u003col\u003e \n        \u003cli\u003e Create an \u003ccode\u003eAppsFlyerXConsent\u003c/code\u003e object using the \u003ccode\u003eforNonGDPRUser()\u003c/code\u003e method. This method doesn’t accept any parameters.\n        \u003cli\u003e Call \u003ccode\u003eAppsFlyerX::setConsentData()\u003c/code\u003e with the \u003ccode\u003eAppsFlyerXConsent\u003c/code\u003e object.  \n        \u003cli\u003e Call start:\n\u003ccode\u003e\n#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)\n  AppsFlyerX::setManualStart(false);\n#endif\nAppsFlyerX::start();\n\u003c/code\u003e\n      \u003c/ol\u003e \n\u003c/ol\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsflyersdk%2Fappsflyer-cocos2dx-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappsflyersdk%2Fappsflyer-cocos2dx-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsflyersdk%2Fappsflyer-cocos2dx-plugin/lists"}