Skip to content

Instantly share code, notes, and snippets.

View a11smiles's full-sized avatar

Joshua Davis a11smiles

View GitHub Profile
choco install sqlite
sqlite3 grafana.db 'PRAGMA journal_mode=wal;'
az login
az storage copy -s .\grafana.db -d https://<storage_account>.file.core.windows.net/<file_share> --subscription <subscription_name>
import { Component, OnInit } from '@angular/core';
import { BasePageComponent } from '../base-page/base-page.component';
@Component({
selector: 'app-first-page',
templateUrl: './first-page.component.html',
styleUrls: ['./first-page.component.scss']
})
export class FirstPageComponent extends BasePageComponent implements OnInit {
private _clickCnt = 0;
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from '../google-analytics.service';
@Component({
template: '',
})
export class BasePageComponent implements OnInit {
constructor(protected $gaService: GoogleAnalyticsService) { }
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;
<button (click)="click()">Click Me!</button>
logEvent(event, category, label, value) {
gtag('event', event, {
event_category: category,
event_label: label,
value: value
});
console.log('gtag event captured...');
}
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from './google-analytics.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'Google Analytics Service';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { GoogleAnalyticsService } from './google-analytics.service';
@NgModule({
declarations: [
import { Injectable } from '@angular/core';
import { Router, RouterEvent, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';
import { environment } from '../environments/environment';
declare var gtag: any;
@Injectable({
providedIn: 'root'
})
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-173474946-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-173474946-1');
</script>