Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a11smiles/2df3d91b37a265e89770afbc2b23f05b to your computer and use it in GitHub Desktop.
Save a11smiles/2df3d91b37a265e89770afbc2b23f05b to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from '../google-analytics.service';
@Component({
selector: 'app-first-page',
templateUrl: './first-page.component.html',
styleUrls: ['./first-page.component.scss']
})
export class FirstPageComponent implements OnInit {
private _clickCnt = 0;
constructor(protected $gaService: GoogleAnalyticsService) { }
ngOnInit() {
}
click() {
this.$gaService.logEvent('click', 'Button', 'First Page', ++this._clickCnt);
console.log(`Button clicked ${this._clickCnt} times.`);
console.log('Click for "First Page" sent!');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment