Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-appmetrica

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-appmetrica

Capacitor plugin for Appmetrica

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
increased by18.52%
Maintainers
1
Weekly downloads
 
Created
Source

Capacitor Appmetrica plugin

Currently only works on ios, but android support will be coming soon

Available methods:

  • logEvent
  • setUserProfileID
  • reportUserProfile
  • getDeviceID

Usage example:

  1. Add in capacitor.config.json
{
	"plugins": {
		"Appmetrica": {
			"apiKey": "Your API key"
		}
	}
  1. In your module (e.g. app.module.ts)
...
import { Appmetrica } from 'capacitor-appmetrica'

@NgModule({
	...
	providers: [
		...
		Appmetrica,
	],
})
export class AppModule {}

  1. In your component or service (e.g. analytics.service.ts)
...
import { Appmetrica, UserProfile, ProfileAttribute } from 'capacitor-appmetrica'

@Injectable()
export class AnalyticsService {
	constructor(private appmetrica: Appmetrica) {}

	async logEvent(name: string, params?: Object) {
		await this.appmetrica.logEvent(name, params)
	}

	async setUserProfileID(id: string) {
		return this.appmetrica.setUserProfileID(id)
	}

	async reportUserProfile() {
		const userProfile = new UserProfile()
		userProfile.applyFromArray([
			ProfileAttribute.Name().withValue('Ivan'),
			ProfileAttribute.BirthDate().withBirthDate(new Date()),
			ProfileAttribute.CustomString('born_in').withValueIfUndefined('Moscow'),
		])

		await this.appmetrica.reportUserProfile(userProfile)
	}

	async getDeviceID(): string {
		return this.appmetrica.getDeviceID()
	}
}

Keywords

FAQs

Package last updated on 13 May 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc