Skip to content

Commit 7ea3c6c

Browse files
committed
Added google tracking on opt in
1 parent f2588c5 commit 7ea3c6c

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

packages/test-app/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99

1010
<!-- See https://goo.gl/OOhYW5 -->
1111
<link rel="manifest" href="/manifest.json">
12+
<script src="https://www.googletagmanager.com/gtag/js?id=UA-92445876-2"></script>
13+
<script>
14+
window.dataLayer = window.dataLayer || [];
15+
function gtag(){dataLayer.push(arguments);}
16+
gtag('js', new Date());
1217

18+
gtag('config', 'UA-92445876-2');
19+
</script>
1320
<script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
1421

1522
<script type="module" src="./src/test-app-app/test-app-app.js"></script>

packages/test-app/src/test-app-app/test-app-app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ class TestAppApp extends PolymerElement {
146146
function _createLabel(token, dataset, duration) {
147147
return token.name + ' ' + dataset + ' ' + duration;
148148
}
149+
150+
if (this.sendTelemetry == true) {
151+
ga('send', 'event', 'history', token.name, this.durations[this.duration], {
152+
nonInteraction: false
153+
});
154+
console.log('send', 'event', 'history', token.name, this.durations[this.duration])
155+
}
156+
149157

150158
fetch(url)
151159
.then(function(response) {

packages/test-app/test/test-app-app/test-app-app_test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4+
45
<meta charset="utf-8">
56
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
67

0 commit comments

Comments
 (0)