Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
angular-ga
Advanced tools
Google Analytics for your Angular application
$ npm install --save angular-ga
The Google Analytics tracking script is not included in this module. Make sure to add it to your page.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { GoogleAnalyticsModule, GA_TOKEN } from 'angular-ga';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
GoogleAnalyticsModule.forRoot({
provide: GA_TOKEN,
useValue: 'UA-TOKEN-1'
})
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
Inject the GoogleAnalyticsService
into your components or services.
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from 'angular-ga';
@Component({
moduleId: module.id,
templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit {
constructor(
private gaService: GoogleAnalyticsService
) { }
ngOnInit() {
this.gaService.event.emit({
category: 'app',
action: 'bootstrap'
});
}
}
Emit a Google Analytics event.
Type: string
Typically the object that was interacted with (e.g. Video
)
Type: string
The type of interaction (e.g. play
)
Optional
Type: string
Useful for categorizing events (e.g. Fall Campaign
)
Optional
Type: number
A numeric value associated with the event (e.g. 42
)
Emit a Google Analytics page view.
Type: string
The path portion of a URL. This value should start with a slash (/) character.
MIT © Sam Verschueren
FAQs
Google Analytics for your Angular application
The npm package angular-ga receives a total of 153 weekly downloads. As such, angular-ga popularity was classified as not popular.
We found that angular-ga 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
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.