Skip to content

Commit

Permalink
demo: add stackblitz open to analytics events (#2756)
Browse files Browse the repository at this point in the history
Closes #2743
  • Loading branch information
kukac7 authored and pkozlowski-opensource committed Oct 5, 2018
1 parent 7402ef3 commit 2b5e9dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -5,7 +5,7 @@ <h2>
<img src="img/link-symbol.svg" alt="Anchor link to: {{id}}" />
</a>
<span>{{ demoTitle }}</span>
<a role="button" class="stackblitz btn btn-light" target="_blank" href="app/components/{{component}}/demos/{{id}}/stackblitz.html" title="Edit in StackBlitz">
<a role="button" (click)="trackStackBlitzClick()" class="stackblitz btn btn-light" target="_blank" href="app/components/{{component}}/demos/{{id}}/stackblitz.html" title="Edit in StackBlitz">
<img class="stackblitz-icon" src="img/stackblitz-icon.svg" alt="StackBlitz icon"/>
StackBlitz
</a>
Expand Down
@@ -1,4 +1,5 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Analytics } from '../../../shared/analytics/analytics';

@Component({
selector: 'ngbd-widget-demo',
Expand All @@ -11,4 +12,10 @@ export class NgbdWidgetDemoComponent {
@Input() id: string;
@Input() code: string;
@Input() markup: string;

constructor(private _analytics: Analytics) {}

trackStackBlitzClick() {
this._analytics.trackEvent('StackBlitz View', this.component + ' ' + this.id);
}
}

0 comments on commit 2b5e9dc

Please sign in to comment.