{"id":4761,"url":"https://github.com/wix-incubator/react-native-newrelic","last_synced_at":"2025-08-20T14:32:08.849Z","repository":{"id":48257077,"uuid":"56607139","full_name":"wix-incubator/react-native-newrelic","owner":"wix-incubator","description":"New Relic reporting for React Native","archived":false,"fork":false,"pushed_at":"2023-07-11T01:21:14.000Z","size":317,"stargazers_count":79,"open_issues_count":34,"forks_count":83,"subscribers_count":212,"default_branch":"master","last_synced_at":"2024-04-09T16:17:52.028Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/wix-incubator.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}},"created_at":"2016-04-19T15:06:50.000Z","updated_at":"2023-03-13T08:54:18.000Z","dependencies_parsed_at":"2024-01-02T22:02:35.841Z","dependency_job_id":null,"html_url":"https://github.com/wix-incubator/react-native-newrelic","commit_stats":{"total_commits":36,"total_committers":9,"mean_commits":4.0,"dds":0.4722222222222222,"last_synced_commit":"8d1441d4220ce9ba9d33ebc795e36c21dfb795c2"},"previous_names":["wix/react-native-newrelic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Freact-native-newrelic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Freact-native-newrelic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Freact-native-newrelic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wix-incubator%2Freact-native-newrelic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wix-incubator","download_url":"https://codeload.github.com/wix-incubator/react-native-newrelic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230431103,"owners_count":18224655,"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-01-05T20:17:22.495Z","updated_at":"2024-12-19T12:10:43.708Z","avatar_url":"https://github.com/wix-incubator.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["Integrations"],"readme":"# react-native-newrelic\n\nNew Relic event reporting for react native.\n\n\u003e also check out https://github.com/wix/sentry-monitor\n\n## Features\n* `overrideConsole` will send all console.log, warn and errors to New Relic.\n* `reportUncaughtExceptions` will send uncaught Javascript exceptions to New Relic.\n\nMore to come!\n\n## Installation\n\n### Install react-native-newrelic\n\n```bash\nnpm install react-native-newrelic --save\n```\n## iOS \n#### 1. Install New RelicAgent in your project as a pod\nIn the Podfile for your project, add the following line:\n`pod 'NewRelicAgent'`\nMake sure Xcode is closed and run: `pod install`\n\n#### 2. Add the project to Xcode\nIn the project navigator:\n- Right click Libraries\n- Add Files to [your project's name]\n- Go to node_modules/react-native-newrelic\n- Add the .xcodeproj file\nIn the project navigator, select your project.\n- Add the libRNNewRelic.a to your project's Build Phases ➜ Link Binary With Libraries\n- Click .xcodeproj file you added before in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic').\n\n#### 3. In your AppDelegate.m\nAdd the following:\n\n``` objective-c\n-(void)setupNewRelic{\n  NSString* token;\n  if(isDebug) {\n    token = @\"\u003cyour new relic dev token (optional)\u003e\";\n  } else {\n    token = @\"\u003cyour new relic production token\";\n  }\n  [NewRelicAgent startWithApplicationToken:token];\n}\n```\n\nAnd add the following line to the top of your didFinishLaunchingWithOptions function: \n\n``` objective-c\n  [self setupNewRelic];\n```\n\n#### 4. Add a prefix header to your iOS project\n\nAdd a `PrefixHeader.pch` file as explained [here](https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-installation/ios/adding-prefix-header-ios-project)\nYour file should look like this:\n\n``` objective-c\n#ifdef __OBJC__ \n\n#import \u003cNewRelicAgent/NewRelic.h\u003e\n\n#endif\n```\n\n## Android (gradle only)\n\n#### 1. Add NewRelic agent to your Android project\n\n**[This link](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/install-configure/installing-android-apps-gradle-android-studio) describes how to add the original NewRelic agent to your project. This guide only requires a part of the original steps (some of the steps are already integrated in `react-native-newrelic`:**\n\nIn `MainApplication.java` import Newrelic and override the following method:\n\n``` java\nimport com.newrelic.agent.android.NewRelic;\n\npublic class MainApplication extends Application implements ReactApplication {\n\n...\n\npublic void onCreate() {\n\tsuper.onCreate();\n\tNewRelic.withApplicationToken(\"yourApplicationToken\").start(this);\n}\n\n...\n\n}\n```\n\nCreate `newrelic.properties` in your root android dir:\n\n```\ncom.newrelic.application_token= yourApplicationToken\n```\n\n\u003e Get your application token from newrelic.com\n\n\n \n#### 2. Add the `react-native-newrelic` module to your Android project\n\nIn `settings.gradle`:\n\n``` gradle\ninclude ':react-native-newrelic'\nproject(':react-native-newrelic').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-newrelic/android')\n\n```\nIn your project level `build.gradle`:\n\n```\ndependencies {\n\t...\n\tclasspath \"com.newrelic.agent.android:agent-gradle-plugin:5.11.+\"\n\t...\n }\n\n```\n\n\nIn your app level `build.gradle`:\n\n``` gradle\napply plugin: 'newrelic'\n\n\ndependencies {\n\t...\n\tcompile project(\":react-native-newrelic\")\n\tcompile fileTree(dir: \"node_modules/react-native-newrelic/android/libs\", include: [\"*.jar\"])\n\t...\n}\n```\n\nAdd `new RNNewRelicPackage()` to your list of packages in `getPackages()` in `MainApplication.java` :\n\n``` java\n@Override\npublic List\u003cReactPackage\u003e getPackages() {\n  return Arrays.\u003cReactPackage\u003easList(... new RNNewRelicPackage());\n}\n```\n\n\n## Configuration\n\nAdd the following to your app root (e.g. `app.ios.js` ):\n\n```javascript\nimport {default as newRelic} from 'react-native-newrelic';\nnewRelic.init({\n  overrideConsole: true,\n  reportUncaughtExceptions: true,\n    globalAttributes: {\n      'this-string': 'will be sent with every event that is being reported'\n    }\n});\n```\n\nCredits to [@DanielZlotin](https://github.com/danielzlotin) for the initial version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwix-incubator%2Freact-native-newrelic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwix-incubator%2Freact-native-newrelic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwix-incubator%2Freact-native-newrelic/lists"}