nativescript 9.1.0-alpha.4 → 9.1.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/lib/common/mobile/android/android-emulator-services.js +11 -3
  2. package/lib/services/bundler/bundler-compiler-service.js +3 -3
  3. package/node_modules/debug/LICENSE +20 -0
  4. package/node_modules/debug/README.md +481 -0
  5. package/node_modules/debug/package.json +64 -0
  6. package/node_modules/debug/src/browser.js +272 -0
  7. package/node_modules/debug/src/common.js +292 -0
  8. package/node_modules/debug/src/index.js +10 -0
  9. package/node_modules/debug/src/node.js +263 -0
  10. package/node_modules/ms/index.js +162 -0
  11. package/node_modules/ms/license.md +21 -0
  12. package/node_modules/ms/package.json +38 -0
  13. package/node_modules/ms/readme.md +59 -0
  14. package/node_modules/universal-analytics/.travis.yml +11 -0
  15. package/node_modules/universal-analytics/AcceptableParams.md +757 -0
  16. package/node_modules/universal-analytics/HISTORY.md +170 -0
  17. package/node_modules/universal-analytics/Makefile +5 -0
  18. package/node_modules/universal-analytics/README.md +651 -0
  19. package/node_modules/universal-analytics/index.js +2 -0
  20. package/node_modules/universal-analytics/lib/config.js +171 -0
  21. package/node_modules/universal-analytics/lib/index.js +563 -0
  22. package/node_modules/universal-analytics/lib/request.js +73 -0
  23. package/node_modules/universal-analytics/lib/utils.js +29 -0
  24. package/node_modules/universal-analytics/package.json +33 -0
  25. package/node_modules/universal-analytics/test/_enqueue.js +144 -0
  26. package/node_modules/universal-analytics/test/event.js +346 -0
  27. package/node_modules/universal-analytics/test/exception.js +233 -0
  28. package/node_modules/universal-analytics/test/index.js +141 -0
  29. package/node_modules/universal-analytics/test/item.js +550 -0
  30. package/node_modules/universal-analytics/test/middleware.js +119 -0
  31. package/node_modules/universal-analytics/test/mocha.opts +3 -0
  32. package/node_modules/universal-analytics/test/pageview.js +286 -0
  33. package/node_modules/universal-analytics/test/send.js +232 -0
  34. package/node_modules/universal-analytics/test/set.js +68 -0
  35. package/node_modules/universal-analytics/test/timing.js +363 -0
  36. package/node_modules/universal-analytics/test/transaction.js +371 -0
  37. package/node_modules/uuid/LICENSE.md +9 -0
  38. package/node_modules/uuid/README.md +510 -0
  39. package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
  40. package/node_modules/uuid/dist/cjs/index.js +31 -0
  41. package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
  42. package/node_modules/uuid/dist/cjs/max.js +3 -0
  43. package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
  44. package/node_modules/uuid/dist/cjs/md5.js +13 -0
  45. package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
  46. package/node_modules/uuid/dist/cjs/native.js +4 -0
  47. package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
  48. package/node_modules/uuid/dist/cjs/nil.js +3 -0
  49. package/node_modules/uuid/dist/cjs/package.json +1 -0
  50. package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
  51. package/node_modules/uuid/dist/cjs/parse.js +11 -0
  52. package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
  53. package/node_modules/uuid/dist/cjs/regex.js +3 -0
  54. package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
  55. package/node_modules/uuid/dist/cjs/rng.js +13 -0
  56. package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
  57. package/node_modules/uuid/dist/cjs/sha1.js +13 -0
  58. package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
  59. package/node_modules/uuid/dist/cjs/stringify.js +39 -0
  60. package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
  61. package/node_modules/uuid/dist/cjs/types.js +2 -0
  62. package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
  63. package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
  64. package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
  65. package/node_modules/uuid/dist/cjs/v1.js +87 -0
  66. package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
  67. package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
  68. package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
  69. package/node_modules/uuid/dist/cjs/v3.js +14 -0
  70. package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
  71. package/node_modules/uuid/dist/cjs/v35.js +41 -0
  72. package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
  73. package/node_modules/uuid/dist/cjs/v4.js +29 -0
  74. package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
  75. package/node_modules/uuid/dist/cjs/v5.js +14 -0
  76. package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
  77. package/node_modules/uuid/dist/cjs/v6.js +19 -0
  78. package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
  79. package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
  80. package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
  81. package/node_modules/uuid/dist/cjs/v7.js +69 -0
  82. package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
  83. package/node_modules/uuid/dist/cjs/validate.js +7 -0
  84. package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
  85. package/node_modules/uuid/dist/cjs/version.js +10 -0
  86. package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
  87. package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
  88. package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
  89. package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
  90. package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
  91. package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
  92. package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
  93. package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
  94. package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
  95. package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
  96. package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
  97. package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
  98. package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
  99. package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
  100. package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
  101. package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
  102. package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
  103. package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
  104. package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
  105. package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
  106. package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
  107. package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
  108. package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
  109. package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
  110. package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
  111. package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
  112. package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
  113. package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
  114. package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
  115. package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
  116. package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
  117. package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
  118. package/node_modules/uuid/dist/cjs-browser/v35.js +41 -0
  119. package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
  120. package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
  121. package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
  122. package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
  123. package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
  124. package/node_modules/uuid/dist/cjs-browser/v6.js +19 -0
  125. package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
  126. package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
  127. package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
  128. package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
  129. package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
  130. package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
  131. package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
  132. package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
  133. package/node_modules/uuid/dist/esm/bin/uuid +2 -0
  134. package/node_modules/uuid/dist/esm/index.d.ts +15 -0
  135. package/node_modules/uuid/dist/esm/index.js +14 -0
  136. package/node_modules/uuid/dist/esm/max.d.ts +2 -0
  137. package/node_modules/uuid/dist/esm/max.js +1 -0
  138. package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
  139. package/node_modules/uuid/dist/esm/md5.js +11 -0
  140. package/node_modules/uuid/dist/esm/native.d.ts +6 -0
  141. package/node_modules/uuid/dist/esm/native.js +2 -0
  142. package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
  143. package/node_modules/uuid/dist/esm/nil.js +1 -0
  144. package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
  145. package/node_modules/uuid/dist/esm/parse.js +9 -0
  146. package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
  147. package/node_modules/uuid/dist/esm/regex.js +1 -0
  148. package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
  149. package/node_modules/uuid/dist/esm/rng.js +10 -0
  150. package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
  151. package/node_modules/uuid/dist/esm/sha1.js +11 -0
  152. package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
  153. package/node_modules/uuid/dist/esm/stringify.js +35 -0
  154. package/node_modules/uuid/dist/esm/types.d.ts +21 -0
  155. package/node_modules/uuid/dist/esm/types.js +1 -0
  156. package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
  157. package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
  158. package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
  159. package/node_modules/uuid/dist/esm/v1.js +83 -0
  160. package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
  161. package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
  162. package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
  163. package/node_modules/uuid/dist/esm/v3.js +9 -0
  164. package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
  165. package/node_modules/uuid/dist/esm/v35.js +36 -0
  166. package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
  167. package/node_modules/uuid/dist/esm/v4.js +27 -0
  168. package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
  169. package/node_modules/uuid/dist/esm/v5.js +9 -0
  170. package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
  171. package/node_modules/uuid/dist/esm/v6.js +17 -0
  172. package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
  173. package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
  174. package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
  175. package/node_modules/uuid/dist/esm/v7.js +65 -0
  176. package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
  177. package/node_modules/uuid/dist/esm/validate.js +5 -0
  178. package/node_modules/uuid/dist/esm/version.d.ts +2 -0
  179. package/node_modules/uuid/dist/esm/version.js +8 -0
  180. package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
  181. package/node_modules/uuid/dist/esm-browser/index.js +14 -0
  182. package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
  183. package/node_modules/uuid/dist/esm-browser/max.js +1 -0
  184. package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
  185. package/node_modules/uuid/dist/esm-browser/md5.js +135 -0
  186. package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
  187. package/node_modules/uuid/dist/esm-browser/native.js +2 -0
  188. package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
  189. package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  190. package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
  191. package/node_modules/uuid/dist/esm-browser/parse.js +9 -0
  192. package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
  193. package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  194. package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
  195. package/node_modules/uuid/dist/esm-browser/rng.js +11 -0
  196. package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
  197. package/node_modules/uuid/dist/esm-browser/sha1.js +70 -0
  198. package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
  199. package/node_modules/uuid/dist/esm-browser/stringify.js +35 -0
  200. package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
  201. package/node_modules/uuid/dist/esm-browser/types.js +1 -0
  202. package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
  203. package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
  204. package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
  205. package/node_modules/uuid/dist/esm-browser/v1.js +83 -0
  206. package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
  207. package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
  208. package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
  209. package/node_modules/uuid/dist/esm-browser/v3.js +9 -0
  210. package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
  211. package/node_modules/uuid/dist/esm-browser/v35.js +36 -0
  212. package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
  213. package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
  214. package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
  215. package/node_modules/uuid/dist/esm-browser/v5.js +9 -0
  216. package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
  217. package/node_modules/uuid/dist/esm-browser/v6.js +17 -0
  218. package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
  219. package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
  220. package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
  221. package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
  222. package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
  223. package/node_modules/uuid/dist/esm-browser/validate.js +5 -0
  224. package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
  225. package/node_modules/uuid/dist/esm-browser/version.js +8 -0
  226. package/node_modules/uuid/package.json +132 -0
  227. package/package.json +8 -4
@@ -0,0 +1,651 @@
1
+ universal-analytics
2
+ =======
3
+
4
+ Setting up a new property in Google Analytics? follow these instructions to get your UA-xxxx code.
5
+ https://support.google.com/analytics/answer/9304153#UA
6
+
7
+
8
+ A node module for Google's [Universal Analytics](http://support.google.com/analytics/bin/answer.py?hl=en&hlrm=de&answer=2790010) tracking via the [Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/).
9
+
10
+ This module allows tracking data (or rather, users) from within a Node.js application. Tracking is initiated on the server side and, if required, does not require any more tracking in the browser.
11
+
12
+ [![npm version](https://badge.fury.io/js/universal-analytics.svg)](https://www.npmjs.com/package/universal-analytics) [![Build Status](https://travis-ci.org/peaksandpies/universal-analytics.png?branch=master)](https://travis-ci.org/peaksandpies/universal-analytics)
13
+
14
+
15
+ # Table of Contents
16
+
17
+ - [Getting started](#getting-started)
18
+ - [Tracking](#tracking)
19
+ - [Pageviews](#pageview-tracking)
20
+ - [Screenviews](#screenview-tracking)
21
+ - [Events](#event-tracking)
22
+ - [Exceptions](#exception-tracking)
23
+ - [User timings](#user-timing-tracking)
24
+ - [Transactions](#transaction-tracking)
25
+ - [Transaction items](#transaction-item-tracking)
26
+ - [Daisy-chaining tracking calls](#daisy-chaining-tracking-calls)
27
+ - [Setting persistent parameters](#setting-persistent-parameters)
28
+ - [Filter application tracking data](#filter-application-tracking-data)
29
+ - [Session-based identification](#session-based-identification)
30
+ - [Debug mode](#debug-mode)
31
+ - [Request Options](#request-options)
32
+ - [Shortcuts](#shortcuts)
33
+ - [Tests](#tests)
34
+
35
+
36
+ # Getting started
37
+
38
+ `universal-analytics` is installed and included like any other node module:
39
+
40
+ ```
41
+ $ npm install universal-analytics
42
+ ```
43
+
44
+ ```javascript
45
+ var ua = require('universal-analytics');
46
+
47
+ // Or with ES6 import
48
+ import ua from 'universal-analytics'
49
+ ```
50
+
51
+ Initialization expects at least your Google Analytics account ID:
52
+
53
+ ```javascript
54
+ var visitor = ua('UA-XXXX-XX');
55
+ ```
56
+
57
+ This will create a `universal-analytics` Visitor instance that you can use and keep around to track a specific client (Not to be confused with the Google Analytics User ID, see [Setting persistent parameters](#setting-persistent-parameters) for more information on that). Since no client ID was specified in the constructor's arguments, a random UUID is generated. In case you have a client ID at hand, you can use that to create the visitor:
58
+
59
+ ```javascript
60
+ var visitor = ua('UA-XXXX-XX', '6a14abda-6b12-4578-bf66-43c754eaeda9');
61
+ ```
62
+
63
+ Starting with Universal Analytics, a UUID v4 is the preferred client ID format. It is therefor necessary to provide a UUID of such type to `universal-analytics`. However you can force custom client ID, passing `strictCidFormat: false` in the options:
64
+
65
+ ```javascript
66
+ var visitor = ua('UA-XXXX-XX', 'CUSTOM_CLIENTID_1', { strictCidFormat: false });
67
+ ```
68
+
69
+ If you want to force the HTTP protocol instead of HTTPS, include `http: true` in the options, by default this module will use https:
70
+ ```javascript
71
+ var visitor = ua('UA-XXXX-XX', { http: true });
72
+ ```
73
+
74
+ If you want to set User Id you can add it into options:
75
+ ```javascript
76
+ var visitor = ua('UA-XXXX-XX', { uid: 'as8eknlll'});
77
+ ```
78
+ [see about User Id](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uid)
79
+
80
+
81
+ Tracking a pageview without much else is now very simple:
82
+
83
+ ```javascript
84
+ visitor.pageview("/").send()
85
+ ```
86
+
87
+ The first argument for the pageview method is the path of the page to be tracked. Simply calling `pageview()` will not initiate a tracking request. In order to send off tracking to the Google Analytics servers you have two options:
88
+
89
+ 1. You can append a `send()` call after `pageview()`. The tracking request is sent asynchronously. This means you will not receive any confirmation when and if it was successful.
90
+ 2. You can provide a callback function to `pageview()` as an additional, last argument. This callback will be invoked once the tracking request has finished. Any error that occured during the request will be provided to said callback. In that case `send()` is no longer necessary.
91
+
92
+ An example of the callback approach:
93
+
94
+ ```javascript
95
+ var visitor = ua('UA-XXXX-XX');
96
+ visitor.pageview("/", function (err) {
97
+ // Handle the error if necessary.
98
+ // In case no error is provided you can be sure
99
+ // the request was successfully sent off to Google.
100
+ });
101
+ ```
102
+
103
+
104
+
105
+ # Tracking
106
+
107
+
108
+ ## Pageview tracking
109
+
110
+ The first argument for the pageview tracking call is the page path. Furthermore, pageview tracking can be improved with the additional parameters to provide the page's hostname and title to Google Analytics. The parameters are provided as arguments after the page path.
111
+
112
+ ```javascript
113
+ visitor.pageview("/", "http://peaksandpies.com", "Welcome").send();
114
+ ```
115
+
116
+ The following snippet is the exact same tracking using a callback. It is always the last argument.
117
+
118
+ ```javascript
119
+ visitor.pageview("/", "http://peaksandpies.com", "Welcome", function (err) {
120
+ // …
121
+ });
122
+ ```
123
+
124
+ Depending on how you integrate tracking into your app, you might be more comfortable with providing all the tracking data via a params object to the `pageview()` method:
125
+
126
+ ```javascript
127
+ visitor.pageview({dp: "/", dt: "Welcome", dh: "http://peaksandpies.com"}).send();
128
+ ```
129
+
130
+ This code has the exact same effect as the one above. `dp`, `dt`, and `dh` (as in 'document path', 'document title' and 'document hostname') are the attribute names used by the Measurement Protocol.
131
+
132
+ It's mandatory to specify either the page path (`dp`) or document location (`dl`). Google Analytics can not track a pageview without a path. To avoid such erroneous requests, `universal-analytics` will deny `pageview()` tracking if the required parameters are omitted.
133
+
134
+ ```javascript
135
+ var pagePath = null;
136
+
137
+ visitor.pageview(pagePath, function (err) {
138
+ // This callback will receive an error
139
+ });
140
+ ```
141
+
142
+ The following method signatures are available for the `pageview()` method of the Visitor instance:
143
+
144
+ * `Visitor#pageview(path)`
145
+ * `Visitor#pageview(path, callback)`
146
+ * `Visitor#pageview(params)`
147
+ * `Visitor#pageview(params, callback)`
148
+ * `Visitor#pageview(path, hostname)`
149
+ * `Visitor#pageview(path, hostname, callback)`
150
+ * `Visitor#pageview(path, hostname, title)`
151
+ * `Visitor#pageview(path, hostname, title, callback)`
152
+
153
+ See also: [List of acceptable params](AcceptableParams.md).
154
+
155
+
156
+
157
+
158
+
159
+ ## Screenview tracking
160
+
161
+ Instead of pageviews app will want to track screenviews.
162
+
163
+ ```javascript
164
+ visitor.screenview("Home Screen", "App Name").send()
165
+ ```
166
+
167
+ The following method signatures are available for #screenview:
168
+
169
+ * `Visitor#screenview(screenName, appName)`
170
+ * `Visitor#screenview(screenName, appName, callback)`
171
+ * `Visitor#screenview(screenName, appName, appVersion)`
172
+ * `Visitor#screenview(screenName, appName, appVersion, callback)`
173
+ * `Visitor#screenview(screenName, appName, appVersion, appId)`
174
+ * `Visitor#screenview(screenName, appName, appVersion, appId, callback)`
175
+ * `Visitor#screenview(screenName, appName, appVersion, appId, appInstallerId)`
176
+ * `Visitor#screenview(screenName, appName, appVersion, appId, appInstallerId, callback)`
177
+ * `Visitor#screenview(screenName, appName, appVersion, appId, appInstallerId, params)`
178
+ * `Visitor#screenview(screenName, appName, appVersion, appId, appInstallerId, params, callback)`
179
+ * `Visitor#screenview(params)`
180
+ * `Visitor#screenview(params, callback)`
181
+
182
+ See also: [List of acceptable params](AcceptableParams.md).
183
+
184
+
185
+
186
+
187
+
188
+
189
+ ## Event tracking
190
+
191
+
192
+ Tracking events with `universal-analytics` works like pageview tracking, only you have to provide different arguments:
193
+
194
+ ```javascript
195
+ visitor.event("Event Category", "Event Action").send()
196
+ ```
197
+
198
+ This is the most straightforward way to track an event. The event attributes *label* and *value* are optional and can be provided if necessary:
199
+
200
+ ```javascript
201
+ visitor.event("Event Category", "Event Action", "…and a label", 42).send()
202
+ ```
203
+
204
+ Just like pageview tracking, event tracking supports a callback as the last argument:
205
+
206
+ ```javascript
207
+ visitor.event("Event Category", "Event Action", "…and a label", 42, function (err) {
208
+ // …
209
+ })
210
+ ```
211
+
212
+ An additional attribute for events is the path of the page they should be associated with in Google Analytics. You can provide this path via an additional params object:
213
+
214
+ ```javascript
215
+ visitor.event("Event Category", "Event Action", "…and a label", 42, {p: "/contact"}, function (err) {
216
+ // …
217
+ })
218
+ ```
219
+
220
+ *Notice:* The page path attribute for the event is called `p` which differs from the `dp` attribute used in the pageview tracking example. `universal-analytics` is smart enough to use the `dp` attribute should you provide it instead of `p`.
221
+
222
+ In case this argument list is getting a little long, `event()` also accepts a params object like `pageview()`:
223
+
224
+ ```javascript
225
+ var params = {
226
+ ec: "Event Category",
227
+ ea: "Event Action",
228
+ el: "…and a label",
229
+ ev: 42,
230
+ dp: "/contact"
231
+ }
232
+
233
+ visitor.event(params).send();
234
+ ```
235
+
236
+ The category (`ec`) and the action (`ea`) are mandatory. Google Analytics will not track an event without them. To avoid such erroneous requests, universal-analytics will deny `event()` tracking if either attribute is omitted.
237
+
238
+ ```javascript
239
+ var action = null;
240
+
241
+ visitor.event("Navigation clicks", action, function (err) {
242
+ // This callback will receive an error
243
+ });
244
+ ```
245
+
246
+ The following method signatures are available for #event:
247
+
248
+ * `Visitor#event(category, action)`
249
+ * `Visitor#event(category, action, callback)`
250
+ * `Visitor#event(category, action, label)`
251
+ * `Visitor#event(category, action, label, callback)`
252
+ * `Visitor#event(category, action, label, value)`
253
+ * `Visitor#event(category, action, label, value, callback)`
254
+ * `Visitor#event(category, action, label, value, params, callback)`
255
+ * `Visitor#event(params)`
256
+ * `Visitor#event(params, callback)`
257
+
258
+ See also: [List of acceptable params](AcceptableParams.md).
259
+
260
+
261
+
262
+
263
+
264
+ ## E-commerce tracking
265
+
266
+ E-commerce tracking in general is a bit more complex. It requires a combination of one call to the `transaction()` method and one or more calls to the `item()` method.
267
+
268
+ ```javascript
269
+ visitor
270
+ .transaction("trans-12345", 500) // Create transaction trans-12345 worth 500 total.
271
+ .item(300, 1, "item-54321") // Add 1 unit the item item-54321 worth 300.
272
+ .item(200, 2, "item-41325") // Add 2 units the item item-41325 worth 200.
273
+ .send()
274
+ ```
275
+
276
+ Once again, daisy-chaining simplifies associating the items with the transaction. Officially, nothing but the transaction ID is a requirement for both the transaction and the items. However, providing a minimum set of information (revenue for the transaction, price, quantity and ID for the items) is recommended.
277
+
278
+ It is also possible to provide the params as an object to both methods:
279
+
280
+ ```javascript
281
+ visitor
282
+ .transaction({ti: "trans-12345", tr: 500, ts: 50, tt: 100, ta: "Partner 13"})
283
+ .item({ip: 300, iq: 1, ic: "item-54321", in: "Item 54321", iv: "Blue"})
284
+ .item({ip: 200, iq: 2, ic: "item-41325", in: "Item 41325", iv: "XXL"})
285
+ .send()
286
+ ```
287
+
288
+ In case an additional item has to be added later on or daisy-chaining is not available for another reason, each item can be given an associated transaction ID via the params object as well:
289
+
290
+ visitor.item({ip: 100, iq: 1, ic: "item-41325", in: "Item 41325", iv: "XL", ti: "trans-12345"}).send()
291
+
292
+ The transaction ID (`ti`) is mandatory for both the transaction and the item. Google Analytics will not track e-commerce data without it. To avoid such erroneous requests, universal-analytics will deny `transaction()` and `item()` tracking if it is omitted.
293
+
294
+ ```javascript
295
+ var ti = null;
296
+
297
+ visitor.transaction(ti, function (err) {
298
+ // This callback will receive an error
299
+ });
300
+ ```
301
+
302
+ The following method signatures are available for #transaction:
303
+
304
+ * `Visitor#transaction(id)`
305
+ * `Visitor#transaction(id, callback)`
306
+ * `Visitor#transaction(id, revenue)`
307
+ * `Visitor#transaction(id, revenue, callback)`
308
+ * `Visitor#transaction(id, revenue, shipping)`
309
+ * `Visitor#transaction(id, revenue, shipping, callback)`
310
+ * `Visitor#transaction(id, revenue, shipping, tax)`
311
+ * `Visitor#transaction(id, revenue, shipping, tax, callback)`
312
+ * `Visitor#transaction(id, revenue, shipping, tax, affiliation)`
313
+ * `Visitor#transaction(id, revenue, shipping, tax, affiliation, callback)`
314
+ * `Visitor#transaction(params)`
315
+ * `Visitor#transaction(params, callback)`
316
+
317
+ The following method signatures are available for #item:
318
+
319
+ * `Visitor#item(price)`
320
+ * `Visitor#item(price, callback)`
321
+ * `Visitor#item(price, quantity)`
322
+ * `Visitor#item(price, quantity, callback)`
323
+ * `Visitor#item(price, quantity, sku)`
324
+ * `Visitor#item(price, quantity, sku, callback)`
325
+ * `Visitor#item(price, quantity, sku, name)`
326
+ * `Visitor#item(price, quantity, sku, name, callback)`
327
+ * `Visitor#item(price, quantity, sku, name, variation)`
328
+ * `Visitor#item(price, quantity, sku, name, variation, callback)`
329
+ * `Visitor#item(price, quantity, sku, name, variation, params)`
330
+ * `Visitor#item(price, quantity, sku, name, variation, params, callback)`
331
+ * `Visitor#item(params)`
332
+ * `Visitor#item(params, callback)`
333
+
334
+ See also: [List of acceptable params](AcceptableParams.md).
335
+
336
+
337
+
338
+
339
+
340
+
341
+ ## Exception tracking
342
+
343
+ Exception tracking is a way to keep track of any sort of application errors and bugs with Google Analytics. Using it with this module is a way to capture server-side problems.
344
+
345
+ ```javascript
346
+ visitor.exception("StackOverflow Error").send()
347
+ ```
348
+
349
+ As an additional information, the exception can be flagged as fatal if the error was exceptionally bad.
350
+
351
+ ```javascript
352
+ var fatal = true;
353
+ visitor.exception("StackOverflow Error", fatal, function () {
354
+ // Finish handling this error
355
+ });
356
+ ```
357
+
358
+ The following method signatures are available for #exception:
359
+
360
+ * `Visitor#exception(description)`
361
+ * `Visitor#exception(description, callback)`
362
+ * `Visitor#exception(description, fatal)`
363
+ * `Visitor#exception(description, fatal, callback)`
364
+ * `Visitor#exception(params)`
365
+ * `Visitor#exception(params, callback)`
366
+
367
+ See also: [List of acceptable params](AcceptableParams.md).
368
+
369
+
370
+
371
+
372
+
373
+
374
+ ## User timing tracking
375
+
376
+ Tracking user timings is a way to capture time-based information similar to the page load speed data tracked automatically by Google Analytics. All arguments to this tracking method are optional, but a category, a variable and a time value should be provided. The time value should be provided in milliseconds.
377
+
378
+ ```javascript
379
+ visitor.timing("User interaction", "Time to open login overlay", 12547).send()
380
+ ```
381
+
382
+ The following method signatures are available for #timing:
383
+
384
+ * `Visitor#timing(category)`
385
+ * `Visitor#timing(category, callback)`
386
+ * `Visitor#timing(category, variable)`
387
+ * `Visitor#timing(category, variable, callback)`
388
+ * `Visitor#timing(category, variable, time)`
389
+ * `Visitor#timing(category, variable, time, callback)`
390
+ * `Visitor#timing(category, variable, time, label)`
391
+ * `Visitor#timing(category, variable, time, label, callback)`
392
+ * `Visitor#timing(params)`
393
+ * `Visitor#timing(params, callback)`
394
+
395
+ See also: [List of acceptable params](AcceptableParams.md).
396
+
397
+
398
+
399
+
400
+
401
+ ## Transaction tracking
402
+
403
+ Transactions are the main tracking calls for ecommerce tracking
404
+
405
+ ```javascript
406
+ visitor.transaction("123456", "449.99").send()
407
+ ```
408
+
409
+ The following method signatures are available for #transaction:
410
+
411
+ * `Visitor#transaction(transactionId)`
412
+ * `Visitor#transaction(transactionId, callback)`
413
+ * `Visitor#transaction(transactionId, revenue)`
414
+ * `Visitor#transaction(transactionId, revenue, callback)`
415
+ * `Visitor#transaction(transactionId, revenue, shippingCost)`
416
+ * `Visitor#transaction(transactionId, revenue, shippingCost, callback)`
417
+ * `Visitor#transaction(transactionId, revenue, shippingCost, tax)`
418
+ * `Visitor#transaction(transactionId, revenue, shippingCost, tax, callback)`
419
+ * `Visitor#transaction(transactionId, revenue, shippingCost, tax, affiliation)`
420
+ * `Visitor#transaction(transactionId, revenue, shippingCost, tax, affiliation, callback)`
421
+ * `Visitor#transaction(transactionId, revenue, shippingCost, tax, affiliation, params)`
422
+ * `Visitor#transaction(transactionId, revenue, shippingCost, tax, affiliation, params, callback)`
423
+ * `Visitor#transaction(params)`
424
+ * `Visitor#transaction(params, callback)`
425
+
426
+ See also: [List of acceptable params](AcceptableParams.md).
427
+
428
+
429
+
430
+
431
+
432
+ ### Transaction item tracking
433
+
434
+ Transaction consist of one or more items.
435
+
436
+ ```javascript
437
+ visitor.item(449.99, 1, "ID54321", "T-Shirt", {ti: "123456"}).send()
438
+ ```
439
+
440
+ The following method signatures are available for #item:
441
+
442
+ * `Visitor#item(price)`
443
+ * `Visitor#item(price, callback)`
444
+ * `Visitor#item(price, quantity)`
445
+ * `Visitor#item(price, quantity, callback)`
446
+ * `Visitor#item(price, quantity, sku)`
447
+ * `Visitor#item(price, quantity, sku, callback)`
448
+ * `Visitor#item(price, quantity, sku, name)`
449
+ * `Visitor#item(price, quantity, sku, name, callback)`
450
+ * `Visitor#item(price, quantity, sku, name, variation)`
451
+ * `Visitor#item(price, quantity, sku, name, variation, callback)`
452
+ * `Visitor#item(price, quantity, sku, name, variation, params)`
453
+ * `Visitor#item(price, quantity, sku, name, variation, params, callback)`
454
+ * `Visitor#item(params)`
455
+ * `Visitor#item(params, callback)`
456
+
457
+ See also: [List of acceptable params](AcceptableParams.md).
458
+
459
+
460
+
461
+
462
+
463
+
464
+ # Daisy-chaining tracking calls
465
+
466
+ We have seen basic daisy-chaining above when calling `send()` right after `pageview()` and `event()`:
467
+
468
+ ```javascript
469
+ visitor.pageview("/").send()
470
+ ```
471
+
472
+ Every call of a tracking method returns a visitor instance you can re-use:
473
+
474
+ ```javascript
475
+ visitor.pageview("/").pageview("/contact").send()
476
+ ```
477
+
478
+ Granted, the chance of this example actually happening in practice might be rather low.
479
+
480
+ However, `universal-analytics` is smart when it comes to daisy-chaining certain calls. In many cases, a `pageview()` call is instantly followed by an `event()` call to track some additional information about the current page. `universal-analytics` makes creating the connection between the two easy:
481
+
482
+ ```javascript
483
+ visitor.pageview("/landing-page-1").event("Testing", "Button color", "Blue").send()
484
+ ```
485
+ This is the same as two distinct tracking calls.
486
+
487
+ ```javascript
488
+ visitor.pageview("/landing-page-1").send()
489
+ visitor.event("Testing", "Button color", "Blue", {p: "/landing-page-1"}).send()
490
+ ```
491
+
492
+ Daisy-chaining is context-aware and in this case placing the `event()` call right after the `pageview()` call results in the event being associated with the page path tracking in the `pageview()` call. Even though the attributes (`dp` and `p`) are different internally.
493
+
494
+ It also works when using a callback since the `this` inside the callback will be the `universal-analytics` Visitor instance:
495
+
496
+ ```javascript
497
+ visitor.pageview("/landing-page-1", function (err) {
498
+ if (!err) {
499
+ this.event("Testing", "Button color", "Blue").send()
500
+ }
501
+ });
502
+ ```
503
+
504
+ More generally, the daisy-chaining context keeps all parameters from the previous call around. This means in a situation where similar tracking calls are necessary tracking is simplified:
505
+
506
+ ```javascript
507
+ visitor
508
+ .event({ec: "Mail Server", ea: "New Team Member Notification sent"})
509
+ .event({ea: "Invitation sent"})
510
+ .send();
511
+ ```
512
+
513
+ In this example the event category ("Mail Server") is not repeated in the second tracking call.
514
+
515
+
516
+
517
+
518
+ # Setting persistent parameters
519
+
520
+ Some parameters should be in every tracking call, such as a user ID or custom dimensions that never or hardly change. For such situations a `#set(key, value)` method is available
521
+
522
+ ```javascript
523
+ visitor.set("uid", "123456789");
524
+ ```
525
+
526
+ The uid parameter will be part of every tracking request of that visitor from now on.
527
+
528
+ For custom dimensions, you will not pass `dimension#` rather `cd#`:
529
+
530
+ ```javascript
531
+ visitor.set("cd[1-20]", "123456789"); // [1-20] will be the dimension number
532
+ ```
533
+
534
+ # Filter application tracking data
535
+
536
+ Set a persistent parameter for [`Data Source`](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ds) to `app` in order to mark tracking data as `Application`.
537
+
538
+ ```javascript
539
+ visitor.set("ds", "app"); // Allows filtering by the 'Application?' field in GA
540
+ ```
541
+
542
+ Then create a new view in Google Analytics of type 'Application'. You will then need to filter the data for that view by creating a new filter that either includes or excludes `Application? Yes` (depending on if you want to show(includes) or hide(excludes) application analytics in a given view).
543
+
544
+ ![Google Analytics Setup](https://i.imgur.com/ZDZ3ZPO.png)
545
+
546
+ # Session-based identification
547
+
548
+ In order to make session-based apps easier to work with, `universal-analytics` also provides a middleware that works in an Expressjs-style fashion. It will try to detect a client ID based on the `_ga` cookie used by the analytics.js client-side tracking. Additionally it will store the detected client ID in the current session to recognize the visitor later.
549
+
550
+ ```javascript
551
+ var ua = require("universal-analytics");
552
+ var express = require("express");
553
+
554
+ var app = express()
555
+
556
+ express.use(ua.middleware("UA-XXXX-Y", {cookieName: '_ga'}));
557
+ ```
558
+
559
+ The middleware will attach the `universal analytics` visitor instance to every request with the default name of `req.visitor`. The name of the instance on the `req` object can be overridden to avoid name conflicts by passing in `instanceName` on the `options` object:
560
+ ```javascript
561
+ express.use(ua.middleware("UA-XXXX-Y", {instanceName: 'uaVisitor'}));
562
+ ```
563
+
564
+ Additionally, the module also exposes a `createFromSession` method to create a visitor instance simply based on a session, which is helpful when working with Socket.io, etc. where the middleware is not used.
565
+
566
+ ```javascript
567
+ var visitor = ua.createFromSession(socket.handshake.session);
568
+ ```
569
+
570
+ # Debug mode
571
+
572
+ `universal-analytics` is using the [`debug`](https://www.npmjs.com/package/debug) library. It can be instructed to output information during tracking by setting the `DEBUG` environment variable:
573
+
574
+ ```
575
+ DEBUG=universal-analytics
576
+ ```
577
+
578
+
579
+ # Request Options
580
+
581
+ Due to the removal of the `request` package, request options are no longer available as of 0.5.
582
+
583
+
584
+ # Shortcuts
585
+
586
+ The tracking methods have shortcuts:
587
+
588
+ * `Visitor#pv` as an alias for `Visitor#pageview`
589
+ * `Visitor#e` as an alias for `Visitor#event`
590
+ * `Visitor#t` as an alias for `Visitor#transaction`
591
+ * `Visitor#i` as an alias for `Visitor#item`
592
+
593
+
594
+ # Tests
595
+
596
+ The tests are written with [mocha](https://github.com/visionmedia/mocha) using [should](https://github.com/visionmedia/should.js) and [Sinon.JS](https://github.com/cjohansen/Sinon.JS).
597
+
598
+ Run them by executing the following commands in the `universal-analytics` directory:
599
+
600
+ ```
601
+ $ npm install
602
+ $ make test
603
+ ```
604
+
605
+ # License
606
+
607
+ (The MIT License)
608
+
609
+ Copyright (c) 2017 Peaks & Pies GmbH <hello@peaksandpies.com>
610
+
611
+ Permission is hereby granted, free of charge, to any person obtaining
612
+ a copy of this software and associated documentation files (the
613
+ 'Software'), to deal in the Software without restriction, including
614
+ without limitation the rights to use, copy, modify, merge, publish,
615
+ distribute, sublicense, and/or sell copies of the Software, and to
616
+ permit persons to whom the Software is furnished to do so, subject to
617
+ the following conditions:
618
+
619
+ The above copyright notice and this permission notice shall be
620
+ included in all copies or substantial portions of the Software.
621
+
622
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
623
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
624
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
625
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
626
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
627
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
628
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+
@@ -0,0 +1,2 @@
1
+
2
+ module.exports = require('./lib/index.js');