Skip to content

Commit 338d923

Browse files
authored
feat: disable statistics collection via options
2 parents 752616e + 7f7f445 commit 338d923

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@
4747
## Collect statistics on the use of open source
4848

4949
TOAST UI Calendar applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Calendar is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected and the sole purpose is nothing but to measure statistics on the usage.
50-
To disable GA, include tui-code-snippet.js and then immediately write the options as follows:
50+
51+
To disable GA use the [options](https://nhnent.github.io/tui.calendar/latest/global.html#Options):
5152

5253
```js
53-
tui.usageStatistics = false;
54+
var calendar = new Calendar('#calendar', {
55+
usageStatistics: false
56+
});
5457
```
5558

5659
## 🌏 Browser Support

src/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,10 @@
77

88
var util = require('tui-code-snippet');
99
var Calendar = require('./js/factory/calendar');
10-
var GA_TRACKING_ID = 'UA-129951699-1';
1110

1211
require('./css/main.styl');
1312
require('./js/view/template/helper');
1413

15-
if (util.sendHostname) {
16-
util.sendHostname('calendar', GA_TRACKING_ID);
17-
}
18-
1914
// for jquery
2015
if (global.jQuery) {
2116
global.jQuery.fn.tuiCalendar = function() {

src/js/factory/calendar.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
var GA_TRACKING_ID = 'UA-129951699-1';
8+
79
var util = require('tui-code-snippet'),
810
Handlebars = require('handlebars-template-loader/runtime');
911
var dw = require('../common/dw'),
@@ -422,6 +424,7 @@ var mmin = Math.min;
422424
* @property {boolean} [disableDblClick=false] - Disable double click to create a schedule. The default value is false.
423425
* @property {boolean} [disableClick=false] - Disable click to create a schedule. The default value is false.
424426
* @property {boolean} [isReadOnly=false] - {@link Calendar} is read-only mode and a user can't create and modify any schedule. The default value is false.
427+
* @property {boolean} [usageStatistics=true] - Let us know the hostname. If you don't want to send the hostname, please set to false.
425428
*/
426429

427430
/**
@@ -493,7 +496,13 @@ var mmin = Math.min;
493496
* });
494497
*/
495498
function Calendar(container, options) {
496-
var opt = options;
499+
var opt = util.extend({
500+
usageStatistics: true
501+
}, options);
502+
503+
if (opt.usageStatistics === true && util.sendHostname) {
504+
util.sendHostname('calendar', GA_TRACKING_ID);
505+
}
497506

498507
if (util.isString(container)) {
499508
container = document.querySelector(container);

0 commit comments

Comments
 (0)