Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 3d138e8

Browse files
committed
Adding several documentation related to data collection.
Privacy notice in the README.md Opt-out instructions. Using GA with the template.
1 parent ad41788 commit 3d138e8

File tree

4 files changed

+79
-4
lines changed

4 files changed

+79
-4
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ Reach out to us with any questions you may have or help you may need, and partic
7474

7575
* [Join the WebVR Slack](https://webvr.rocks/slack) (join the [#unity channel](https://webvr.slack.com/messages/unity))
7676

77+
## Developer Privacy Notice for Data Collection
78+
79+
To help improve the WebVR API and the WebVR Export assets, Mozilla automatically receives technical, interaction, and error data of end users, using [Sentry](https://sentry.io) and [Google Analytics](https://analytics.google.com/analytics/web/). For example, this includes number of times VR device is mounted and worn; number of times VR mode is enabled and time spent; time for webpages to load and time open; and a unique browser identifier.
80+
81+
Developers can turn off this data collection by [modifying the configuration snippet that comes with the VR template](./docs/customization/disabling-telemetry.md).
82+
83+
End users can turn off this data collection by enabling [`Do-Not-Track`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT) in their browsers.
7784

7885
## Credits
7986

docs/customization/adding-ga.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Google Analytics is a popular web analytics service that tracks and reports website traffic. It offers insight about your user behaviour and allows you to make informed decisions regarding the evolution of your site.
44

5-
You will need to modify the [VR template](../../Assets/WebGLTemplates/WebVR/index.html) that comes with the package, so be sure you've already added [the package from the store](https://u3d.as/1476) to your Unity project.
5+
The [VR template](../../Assets/WebGLTemplates/WebVR/index.html) that comes with the [Unity package](https://u3d.as/1476) already includes Analytics as a part of the telemetry library used for [collecting usage data](../data-collection.md) but you'll need to set up a Google Analytics account and get a [tracking Id](https://support.google.com/analytics/answer/7372977) first, before using it.
66

7-
## Set up
7+
## Quick set up
88

99
Start by visiting [Google Analytics](https://analytics.google.com/analytics/web) and sign up for a new account:
1010

@@ -22,9 +22,44 @@ This will redirect you to the configuration page where you find the HTML code yo
2222

2323
![The configuration page includes the instructions for setting up your site](./images/setup-done.png)
2424

25-
Now, in your project, with your favourite code editor, open the file at `Assets/WebGLTemplates/WebVR/index.html` and paste the code provided by Google Analytics inside, preferably at the top of, the `<head>` tag:
25+
**Don't use the snippet above**. Instead, with your favourite code editor, open the file at `Assets/WebGLTemplates/WebVR/index.html` and paste the following code after including the `telemetry.js` library, preferably at the bottom of the `<head>` tag:
2626

27-
![The code provided by GA should be added right after the head tag](./images/add-to-index.png)
27+
```html
28+
<script>
29+
var ga = MozillaResearch.telemetry.ga.create('UA-XXXXXXX-Y');
30+
ga('send', 'pageview');
31+
</script>
32+
```
33+
34+
![The code provided by GA should be added after including the telemetry library](./images/add-to-index.png)
35+
36+
### Template integration of Google Analytics
37+
38+
If you have used Google Analytics before, the previous code should remind you of the familiar Analytics snippet:
39+
40+
```js
41+
ga('create', 'UA-XXXXXX-Y', 'auto');
42+
ga('send', 'pageview');
43+
```
44+
45+
When using Analytics inside the template, use the `create` method of `MozillaReasearch.telemetry.ga` instead of the `create` command. It will return a tracking function which can be used in the same way you would use it in the guide [Sending Data to Google Analytics.](https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers)
46+
47+
```js
48+
var ga = MozillaResearch.telemetry.ga.create('UA-XXXXXX-Y', 'auto');
49+
ga('send', 'pageview');
50+
```
51+
52+
If you want to customize the way you create the tracker, read [Creating Trackers](https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers) and remember that:
53+
54+
```js
55+
ga('create', arg1, arg2, ...);
56+
```
57+
58+
Is equivalent to:
59+
60+
```js
61+
var ga = MozillaResearch.telemetry.ga.create(arg1, arg2, ...);
62+
```
2863

2964
## Using Google Analytics
3065

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Disabling telemetry
2+
3+
The code enabling telemetry data collection is in the VR template that comes with the package. Ensure you've already added [the package from the store](https://u3d.as/1476) to your Unity project and look for the following snippet inside the [`index.html` file](../../Assets/WebGLTemplates/WebVR/index.html) of the template:
4+
5+
```js
6+
MozillaResearch.telemetry.start({
7+
analytics: true,
8+
errorLogging: true,
9+
performance: true
10+
});
11+
```
12+
13+
By default, collecting number of visits, error logs and some performance measurements is enabled by setting the proper options (`analytics`, `errorLogging` and `performance` respectively) to `true`.
14+
15+
To prevent the template from sending such information, set the corresponding options to `false`:
16+
17+
```js
18+
MozillaResearch.telemetry.start({
19+
analytics: false,
20+
errorLogging: true,
21+
performance: false
22+
});
23+
```
24+
25+
Or remove/comment the line completely:
26+
27+
```js
28+
/*MozillaResearch.telemetry.start({
29+
analytics: true,
30+
errorLogging: true,
31+
performance: true
32+
});*/
33+
```
97.2 KB
Loading

0 commit comments

Comments
 (0)