<commit_before>import {Directive, Injectable, Input, ElementRef, AfterContentInit} from '@angular/core';
import {EventManager} from '@angular/platform-browser';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';

import {Angulartics2} from './angulartics2';

@Injectable()
@Directive({
	selector: '[angulartics2On]'
})
export class Angulartics2On implements AfterContentInit {
	@Input('angulartics2On') angulartics2On: string;
	@Input() angularticsEvent: string;
	@Input() angularticsCategory: string;
	@Input() angularticsIf: string;
	@Input() angularticsProperties: any;

	private el: any;

	constructor(
		private elRef: ElementRef,
		private angulartics2: Angulartics2,
		private eventManager: EventManager
	) {
		this.el = elRef.nativeElement;
	}

	ngAfterContentInit() {
		this.eventManager.addEventListener(this.el, this.angulartics2On, (event: any) => this.eventTrack(event));
  }

	eventTrack(event: any) {
		if (this.angularticsIf && !eval(this.angularticsIf)) {
			return; // Cancel this event if we don't pass the angulartics-if condition
		}

		const action = this.angularticsEvent || this.inferEventName();
		let properties: any = {
			eventType: event.type
		};

		if (this.angularticsCategory) {
			properties.category = this.angularticsCategory;
		}<commit_msg>fix(angulartics2On): default listener to 'click'<commit_after>import {Directive, Injectable, Input, ElementRef, AfterContentInit} from '@angular/core';
import {EventManager} from '@angular/platform-browser';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';

import {Angulartics2} from './angulartics2';

@Injectable()
@Directive({
	selector: '[angulartics2On]'
})
export class Angulartics2On implements AfterContentInit {
	@Input('angulartics2On') angulartics2On: string;
	@Input() angularticsEvent: string;
	@Input() angularticsCategory: string;
	@Input() angularticsIf: string;
	@Input() angularticsProperties: any;

	private el: any;

	constructor(
		private elRef: ElementRef,
		private angulartics2: Angulartics2,
		private eventManager: EventManager
	) {
		this.el = elRef.nativeElement;
	}

	ngAfterContentInit() {
		this.eventManager.addEventListener(this.el, this.angulartics2On || 'click', (event: any) => this.eventTrack(event));
  }

	eventTrack(event: any) {
		if (this.angularticsIf && !eval(this.angularticsIf)) {
			return; // Cancel this event if we don't pass the angulartics-if condition
		}

		const action = this.angularticsEvent || this.inferEventName();
		let properties: any = {
			eventType: event.type
		};

		if (this.angularticsCategory) {
			properties.category = this.angularticsCategory;
		}
{'fraction_non_alphanumeric': 0.12537878787878787, 'fraction_numerical': 0.007196969696969697, 'mean_word_length': 5.553349875930521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7361001', 'n_tokens_mistral': 938, 'n_tokens_neox': 884, 'n_words': 193}