{"id":21882390,"url":"https://github.com/essent/nativescript-adobe-marketing-cloud","last_synced_at":"2025-04-15T05:53:21.831Z","repository":{"id":13429591,"uuid":"74347363","full_name":"Essent/nativescript-adobe-marketing-cloud","owner":"Essent","description":"NativeScript plugin for tracking analytics events","archived":false,"fork":false,"pushed_at":"2023-03-07T07:28:18.000Z","size":19329,"stargazers_count":4,"open_issues_count":10,"forks_count":6,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-15T05:53:15.499Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Essent.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}},"created_at":"2016-11-21T09:29:05.000Z","updated_at":"2025-02-05T02:07:57.000Z","dependencies_parsed_at":"2024-11-28T09:40:33.523Z","dependency_job_id":null,"html_url":"https://github.com/Essent/nativescript-adobe-marketing-cloud","commit_stats":{"total_commits":115,"total_committers":18,"mean_commits":6.388888888888889,"dds":0.8347826086956522,"last_synced_commit":"68d4686237304aea52ba9fe3b5810d744b3448ac"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-adobe-marketing-cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-adobe-marketing-cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-adobe-marketing-cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-adobe-marketing-cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Essent","download_url":"https://codeload.github.com/Essent/nativescript-adobe-marketing-cloud/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016319,"owners_count":21198832,"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-28T09:28:49.934Z","updated_at":"2025-04-15T05:53:21.812Z","avatar_url":"https://github.com/Essent.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nativescript plugin for Adobe Experience Cloud Solution\n[![npm version](https://badge.fury.io/js/nativescript-adobe-experience-cloud.svg)](https://badge.fury.io/js/nativescript-adobe-experience-cloud)\n\n```\nnpm install @essent/nativescript-adobe-experience-cloud --save\n```\nThis plugin is based on Nativescript 7 and Adobe Experience Platform solution \n\nhttps://github.com/Adobe-Marketing-Cloud/acp-sdks/releases\nGet the Adobe Experience Platform SDK https://aep-sdks.gitbook.io/docs/getting-started/get-the-sdk\n\n# Setting up the application for usage with this plugin.\n\n## Setup config.ts\n\nCreate a configuration file and place your ENVIRONMENT_ID from Adobe Experience platform.\n\n```ts\nimport { AdobeAnalyticsSettings } from \"@essent/nativescript-adobe-experience-cloud\";\n\nexport const adobeExperienceSettings: AdobeAnalyticsSettings = {\n    environmentId: 'Put your environment id here.',\n    debug: true\n};\n```\n## Initialize SDK\n\n### Android\n\n```ts\nimport { AdobeAnalytics } from '@essent/nativescript-adobe-experience-cloud';\nimport { adobeExperienceSettings } from '~/config'; \n\n@NativeClass()\n@JavaProxy('nl.essent.Application')\nclass Application extends android.app.Application {\n\n    public onCreate(): void {\n        super.onCreate();\n        AdobeAnalytics.getInstance().initSdk(adobeExperienceSettings, this);\n    }\n\n    public attachBaseContext(baseContext: android.content.Context) {\n        super.attachBaseContext(baseContext);\n    }\n}\n```\n\n### IOS\n\n```ts\nimport { AdobeAnalytics } from '@essent/nativescript-adobe-experience-cloud';\nimport { adobeExperienceSettings } from '~/config'; \n\n@NativeClass()\nclass MyDelegate extends UIResponder implements UIApplicationDelegate {\n    public static ObjCProtocols = [UIApplicationDelegate];\n\n    applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary\u003cstring, any\u003e): boolean {\n        AdobeAnalytics.getInstance().initSdk(adobeExperienceSettings, application);\n        return true;\n     }\n }\n    ios.delegate = MyDelegate;\n```\n\n**NOTE** This plugin provides only initial set of extensions registered with Adobe Experience platform. For any additional extension fork this plugin and configure based on Mobile Property installation instructions. \n\n## Enable lifecycle tracking\n\n### Android\n \nWith onResume function start Lifecycle data collection:\n\n```ts\nimport {AdobeAnalytics} from \"@essent/nativescript-adobe-experience-cloud\";\n\npublic onResume() : void {\n        AdobeAnalytics.getInstance().resumeCollectingLifecycleData();\n        super.onResume();\n    }\n}\n```\n\nUse onPause function to pause collection Lifecycle data:\n\n```ts\npublic onPause() : void {\n        AdobeAnalytics.getInstance().pauseCollectingLifecycleData();\n        super.onPause();\n    }\n```\n### IOS\n\nStart collection Lifecycle data is part of plugin implementation called during initialization of SDK.\n\nWhen application is resuming from background state, you need to resume collection of Lifecycle data:\n\n```ts\napplicationWillEnterForeground(application: UIApplication){\n    AdobeAnalytics.getInstance().resumeCollectingLifecycleData();\n }\n```\nWhen the app enters the background, pause collecting Lifecycle data:\n\n```ts\napplicationDidEnterBackground(application: UIApplication): void {\n    AdobeAnalytics.getInstance().pauseCollectingLifecycleData();\n}\n```\n\n## Track states and actions\n\nStates and actions can be traced through method calls that match their native counterparts signature.\n\n## Privacy options\nSee: https://marketing.adobe.com/resources/help/en_US/mobile/ios/privacy.html\n\nSelect a privacy option:\n\nSend Data Until Opt-Out\n```ts\nAdobeAnalytics.getInstance().optIn();\n```\nHold Data Until Opt-In\n```ts\nAdobeAnalytics.getInstance().optOut();\n```\n\n#### \u003ca name='Developmentsetup'\u003e\u003c/a\u003eDevelopment setup\nFor easier development and debugging purposes continue with the following steps:\n\n1. Open a command prompt/terminal, navigate to `src` folder and run `npm run demo.ios` or `npm run demo.android` to run the demo.\n2. Open another command prompt/terminal, navigate to `src` folder and run `npm run plugin.tscwatch` to watch for file changes in your plugin.\n\nNow go and make a change to your plugin. It will be automatically applied to the demo project.\n\nNOTE: If you need to use a native library in your plugin or do some changes in Info.plist/AndroidManifest.xml, these cannot be applied to the demo project only by npm link. In such scenario, you need to use `tns plugin add ../src` from the `demo` so that the native libraries and changes in the above-mentioned files are applied in the demo. Then you can link again the code of your plugin in the demo by using `npm run plugin.link` from the `src`.\n\n### \u003ca name='LinkingtoCocoaPodorAndroidArsenalplugins'\u003e\u003c/a\u003eLinking to CocoaPod or Android Arsenal plugins\n\nYou will want to create these folders and files in the `src` folder in order to use native APIs:\n\n```\nplatforms --\n  ios --\n    Podfile\n  android --\n    include.gradle\n```\n\nDoing so will open up those native apis to your plugin :)\n\nTake a look at these existing plugins for how that can be done very simply:\n\n* [nativescript-cardview](https://github.com/bradmartin/nativescript-cardview/tree/master/platforms)\n* [nativescript-floatingactionbutton](https://github.com/bradmartin/nativescript-floatingactionbutton/tree/master/src/platforms)\n\n### Clean plugin and demo files\n\nSometimes you may need to wipe away the `node_modules` and `demo/platforms` folders to reinstall them fresh.\n\n* Run `npm run clean` to wipe those clean then you can can run `npm i` to install fresh dependencies.\n\nSometimes you just need to wipe out the demo's `platforms` directory only:\n\n* Run `npm run demo.reset` to delete the demo's `platforms` directory only.\n\nSometimes you may need to ensure plugin files are updated in the demo:\n\n* Run `npm run plugin.prepare` will do a fresh build of the plugin then remove itself from the demo and add it back for assurance.\n\n### \u003ca name='Unittesting'\u003e\u003c/a\u003eUnittesting\nThe plugin seed automatically adds Jasmine-based unittest support to your plugin.\nOpen `demo/app/tests/tests.js` and adjust its contents so the tests become meaningful in the context of your plugin and its features.\n\nYou can read more about this topic [here](https://docs.nativescript.org/tooling/testing).\n\nOnce you're ready to test your plugin's API go to `src` folder and execute one of these commands:\n\n```\nnpm run test.ios\nnpm run test.android\n```\n\n### \u003ca name='PublishtoNPM'\u003e\u003c/a\u003ePublish to NPM\n\nWhen you have everything ready to publish:\n\n* Bump the version number in `src/package.json`\n* Go to `publish` and execute `publish.sh` (run `chmod +x *.sh` if the file isn't executable)\n\nIf you just want to create a package, go to `publish` folder and execute `pack.sh`. The package will be created in `publish/package` folder.\n\n**NOTE**: To run bash script on Windows you can install [GIT SCM](https://git-for-windows.github.io/) and use Git Bash.\n\n### \u003ca name='TravisCI'\u003e\u003c/a\u003eTravisCI\n\nThe plugin structure comes with a fully functional .travis.yml file that deploys the testing app on Android emulator and iOS simulator and as a subsequent step runs the tests from [UnitTesting section](#Unittesting). All you have to do, after cloning the repo and implementing your plugin and tests, is to sign up at [https://travis-ci.org/](https://travis-ci.org/). Then enable your plugin's repo on \"https://travis-ci.org/profile/\u003cyour github user\\\u003e\" and that's it. Next time a PR is opened or change is committed to a branch TravisCI will trigger a build testing the code.\n\nTo properly show current build status you will have to edit the badge at the start of the README.md file so it matches your repo, user and branch. \n\n### \u003ca name='ReferringtnscoremodulesinthePlugin'\u003e\u003c/a\u003eReferring tns-core-modules in the Plugin\nWe recommend to use full imports of `tns-core-modules` due to [an issue in Angular CLI](https://github.com/angular/angular-cli/issues/5618#issuecomment-306479219). Read more detailed explanation in [this discussion](https://github.com/NativeScript/nativescript-plugin-seed/pull/32#discussion_r131147787).\n\nUltimately after the issue in Angular CLI is fixed this would not be a restriction, but till then the recommended approach is to import from `tns-core-modules` using full path. Here is an example:\n\n**WRONG**\n\n*tsconfig.json*\n````\n...\n\n\"paths\": {\n  \"*\": [\n    \"./node_modules/*\",\n    \"./node_modules/tns-core-modules/*\"\n  ]\n}\n...\n````\n\n*yourplugin.common.ts*\n````ts\nimport * as app from 'application';\n````\n\n**RIGHT**\n\n*yourplugin.common.ts*\n````ts\nimport * as app from 'tns-core-modules/application';\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessent%2Fnativescript-adobe-marketing-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fessent%2Fnativescript-adobe-marketing-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessent%2Fnativescript-adobe-marketing-cloud/lists"}