New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kolkov/ngx-metrika

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

@kolkov/ngx-metrika

A simple Yandex Mertika [tag.js](https://yandex.ru/support/metrika/) package for Angular 6+.

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
decreased by-15.9%
Maintainers
1
Weekly downloads
 
Created
Source

Angular Yandex Metrika

A simple Yandex Mertika tag.js package for Angular 6+.

Install

npm install @kolkov/ngx-metrika --save

Add the package to your app.module.ts. Then add property yaCounterId to the environment constant

import { NgxMetrikaModule } from '@kolkov/ngx-metrika';

@NgModule({
  imports: [
    NgxMetrikaModule.forRoot({id: environment.yaCounterId, trackPageViews: true})
  ]
})

Pageviews

The package will listen to route changes by default, you just need to instantiate service in the root of the project.

export class AppComponent {
  constructor(private ym: NgxMetrikaService) { }
}

NgxMetrika is a service that also allows you to track pageviews manually.

this.ym.hit.emit();

// or with custom params

this.ym.hit.emit({url: '/custom',{
  title: 'Lesson Feed',  
  referer: 'https://angularfirebase.com/lessons'
}});

Target

Target expect an action.

this.ym.reachGoal.emit({'TARGET_NAME'})

You can optionally pass in addtional params.

this.ym.reachGoal.emit({'login', { 
  method: 'Instagram',
  event_category: 'engagemnt',
  event_label: 'New user logged in via OAuth'
}});

Target Directive

Many analytics events are tracked based on user interaction, such as button clicks. Just tell it which DOM event to track.

<button ymTarget trackOn="click">Track Me</button>

This will register a general Target in Yandex Metrika based on the target name.

You can pass optional params to the directive like so:

<div ymTarget
     trackOn="dragstart" 
     action="product_dragged"
     category="ecommerce" 
     [params]="{ event_label: 'Something cool just happened' }">

   Some Product...
   
</div>

The directive will produce the following event on dragstart.

Keywords

FAQs

Package last updated on 12 May 2018

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