18
18
Include the ** new** universal analytics script in your html as usual, but remove ` ga('send', 'pageview'); `
19
19
20
20
## Enable the ga module
21
+
21
22
``` js
22
23
angular .module (' yourModule' , [' ga' ])
23
24
```
@@ -42,22 +43,26 @@ You can skip the enclosing array '[]' if you start with the single-quote charact
42
43
Of course, you can use angular expressions, as this is evaluated.
43
44
44
45
Both samples are equivalent to calling ` ga('send', 'event', 'player', 'play', video.id) ` on the ` click ` event:
46
+
45
47
``` html
46
48
<a href =" #" ga =" 'send', 'event', 'player', 'play', video.id" ></a >
47
49
<a href =" #" ga =" ['send', 'event', 'player', 'play', video.id]" ></a >
48
50
```
49
51
50
52
You can call ` ga ` several times by passing an array of arrays:
53
+
51
54
``` html
52
55
<a href =" #" ga =" [['set', 'metric1', 10], ['send', 'event', 'player', 'play', video.id]]" ></a >
53
56
```
54
57
55
- You can change the event by providing ` ga-on ` attribute
58
+ You can change the event by providing ` ga-on ` attribute:
59
+
56
60
``` html
57
61
<input type =" text" ga =" 'send', 'event', 'focus'" ga-on =" focus" />
58
62
```
59
63
60
- By using ` ga-on="init" ` you can call ` ga ` as soon as the html is parsed
64
+ By using ` ga-on="init" ` you can call ` ga ` as soon as the html is parsed:
65
+
61
66
``` html
62
67
<div ga =" 'send', 'pageview', {title: 'Hello world!'}" ga-on =" init" />
63
68
```
@@ -66,6 +71,7 @@ By using `ga-on="init"` you can call `ga` as soon as the html is parsed
66
71
67
72
If ` ga ` attribute is empty, the event is guesses from the context. Following examples
68
73
are equivalent:
74
+
69
75
``` html
70
76
<div ga >LABEL</div >
71
77
<div ga =" 'send', 'event', 'button', 'click', 'LABEL'" >LABEL</div >
0 commit comments