Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
capacitor-analytics
Advanced tools
Capacitor plugin to enable features from Firebase Analytics
enable(): Promise<void>
disable(): Promise<void>
instance(): Promise<{ id: string }>
reset(): Promise<void>
setScreen({ name: string; class?: string }): Promise<void>
setUserID({ value: string }): Promise<void>
setUserProp({ key: string; value: string }): Promise<void>
logEvent({ name: string; params?: object }): Promise<void>
For more information check the
definitions
file
import { Analytics } from 'capacitor-analytics';
const analytics = new Analytics();
//
// user id
analytics.setUserID({ value: '1337' });
//
// user attributes
// google don't allow use of sensitive data
// like names, emails, card numbers, etc.
analytics.setUserProp({
key: 'city',
value: 'San Francisco'
});
//
// some event
analytics.logEvent({
name: 'purchase',
params: { items: '[1, 2, 3]', total: 254.5 }
});
Navigate to the project settings page for your app on Firebase.
Download the GoogleService-Info.plist
file. In Xcode right-click on the yellow folder named "App" and select the Add files to "App"
.
Tip: if you drag and drop your file to this location, Xcode may not be able to find it.
Download the google-services.json
file and copy it to android/app/
directory of your capacitor project.
ionic start my-cap-app --capacitor
cd my-cap-app
npm install --save capacitor-analytics
mkdir www && touch www/index.html
sudo gem install cocoapods
(only once)npx cap add ios
npx cap sync ios
(every time you run npm install
)npx cap open ios
GoogleService-Info.plist
to the app folder in xcode-FIRAnalyticsDebugEnabled
Tip: every time you change a native code you may need to clean up the cache (Product > Clean build folder) and then run the app again.
ionic start my-cap-app --capacitor
cd my-cap-app
npm install --save capacitor-analytics
mkdir www && touch www/index.html
npx cap add android
npx cap sync android
(every time you run npm install
)npx cap open android
google-services.json
to your android/app
folder[extra step]
in android case we need to tell Capacitor to initialise the plugin:on your
MainActivity.java
file addimport io.stewan.capacitor.analytics.AnalyticsPlugin;
and then inside the init callbackadd(AnalyticsPlugin.class);
Now you should be set to go. Try to run your client using ionic cap run android --livereload --address=0.0.0.0
.
Tip: every time you change a native code you may need to clean up the cache (Build > Clean Project | Build > Rebuild Project) and then run the app again.
For existing projects you can upgrade all capacitor related packages (including this plugin) with this single command
npx npm-upgrade '*capacitor*' && npm install
https://github.com/stewwan/capacitor-analytics-demo
Cheers 🍻
Follow me @Twitter
MIT
FAQs
Enable Firebase Analytics for Capacitor Apps
The npm package capacitor-analytics receives a total of 4 weekly downloads. As such, capacitor-analytics popularity was classified as not popular.
We found that capacitor-analytics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.