Skip to content
Permalink
Browse files

Remove Google Analytics

  • Loading branch information...
rafaelgssa committed Sep 28, 2019
1 parent 1187517 commit 704638bc67ba5f06831969d89455ef330654ac00
@@ -16,10 +16,10 @@ jobs:
run: npm ci
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Generate config.json'
run: 'echo "{ \"development\": { \"clientId\": \"${{ secrets.TRAKT_CLIENT_ID }}\", \"clientSecret\": \"${{ secrets.TRAKT_CLIENT_SECRET }}\", \"analyticsId\": \"${{ secrets.GOOGLE_ANALYTICS_ID }}\", \"rollbarToken\": \"${{ secrets.ROLLBAR_TOKEN }}\", \"tmdbApiKey\": \"${{ secrets.TMDB_API_KEY }}\", \"chromeExtensionKey\": \"${{ secrets.CHROME_EXTENSION_KEY }}\", \"firefoxExtensionId\": \"${{ secrets.FIREFOX_EXTENSION_ID }}\" } }" >> ./config.json'
run: 'echo "{ \"development\": { \"clientId\": \"${{ secrets.TRAKT_CLIENT_ID }}\", \"clientSecret\": \"${{ secrets.TRAKT_CLIENT_SECRET }}\", \"rollbarToken\": \"${{ secrets.ROLLBAR_TOKEN }}\", \"tmdbApiKey\": \"${{ secrets.TMDB_API_KEY }}\", \"chromeExtensionKey\": \"${{ secrets.CHROME_EXTENSION_KEY }}\", \"firefoxExtensionId\": \"${{ secrets.FIREFOX_EXTENSION_ID }}\" } }" >> ./config.json'
- if: github.repository != 'rafaelgssa/traktflix'
name: 'Generate empty config.json'
run: 'echo "{ \"development\": { \"clientId\": \"\", \"clientSecret\": \"\", \"analyticsId\": \"\", \"rollbarToken\": \"\", \"tmdbApiKey\": \"\", \"chromeExtensionKey\": \"\", \"firefoxExtensionId\": \"\" } }" >> ./config.json'
run: 'echo "{ \"development\": { \"clientId\": \"\", \"clientSecret\": \"\", \"rollbarToken\": \"\", \"tmdbApiKey\": \"\", \"chromeExtensionKey\": \"\", \"firefoxExtensionId\": \"\" } }" >> ./config.json'
- name: 'Run dev build'
run: npm run build-dev
- name: 'Zip dist'
@@ -16,10 +16,10 @@ jobs:
run: npm ci
- if: github.repository == 'rafaelgssa/traktflix'
name: 'Generate config.json'
run: 'echo "{ \"development\": { \"clientId\": \"${{ secrets.TRAKT_CLIENT_ID }}\", \"clientSecret\": \"${{ secrets.TRAKT_CLIENT_SECRET }}\", \"analyticsId\": \"${{ secrets.GOOGLE_ANALYTICS_ID }}\", \"rollbarToken\": \"${{ secrets.ROLLBAR_TOKEN }}\", \"tmdbApiKey\": \"${{ secrets.TMDB_API_KEY }}\", \"chromeExtensionKey\": \"${{ secrets.CHROME_EXTENSION_KEY }}\", \"firefoxExtensionId\": \"${{ secrets.FIREFOX_EXTENSION_ID }}\" } }" >> ./config.json'
run: 'echo "{ \"development\": { \"clientId\": \"${{ secrets.TRAKT_CLIENT_ID }}\", \"clientSecret\": \"${{ secrets.TRAKT_CLIENT_SECRET }}\", \"rollbarToken\": \"${{ secrets.ROLLBAR_TOKEN }}\", \"tmdbApiKey\": \"${{ secrets.TMDB_API_KEY }}\", \"chromeExtensionKey\": \"${{ secrets.CHROME_EXTENSION_KEY }}\", \"firefoxExtensionId\": \"${{ secrets.FIREFOX_EXTENSION_ID }}\" } }" >> ./config.json'
- if: github.repository != 'rafaelgssa/traktflix'
name: 'Generate empty config.json'
run: 'echo "{ \"development\": { \"clientId\": \"\", \"clientSecret\": \"\", \"analyticsId\": \"\", \"rollbarToken\": \"\", \"tmdbApiKey\": \"\", \"chromeExtensionKey\": \"\", \"firefoxExtensionId\": \"\" } }" >> ./config.json'
run: 'echo "{ \"development\": { \"clientId\": \"\", \"clientSecret\": \"\", \"rollbarToken\": \"\", \"tmdbApiKey\": \"\", \"chromeExtensionKey\": \"\", \"firefoxExtensionId\": \"\" } }" >> ./config.json'
- name: 'Run build'
run: npm run build
- name: 'Zip dist'
@@ -2,14 +2,12 @@
"development": {
"clientId": "{TraktClientId}",
"clientSecret": "{TraktClientSecret}",
"analyticsId": "{GoogleAnalyticsId}",
"rollbarToken": "{RollbarToken}",
"tmdbApiKey": "{TheMovieDatabaseApiKey}"
},
"production": {
"clientId": "{TraktClientId}",
"clientSecret": "{TraktClientSecret}",
"analyticsId": "{GoogleAnalyticsId}",
"rollbarToken": "{RollbarToken}",
"tmdbApiKey": "{TheMovieDatabaseApiKey}",
"chromeExtensionId": "",
@@ -92,12 +92,6 @@
"disableScrobblingDescription": {
"message": "With this option enabled, the extension will not automatically scrobble what you're watching. This is useful if you prefer to sync your history later instead of scrobbling in real time."
},
"allowGoogleAnalyticsName": {
"message": "Allow Google Analytics to collect information about your usage of the extension."
},
"allowGoogleAnalyticsDescription": {
"message": "With this option enabled, information about your usage of the extension will be collected and sent to us, so that we can gather data and improve the extension. This information includes: when you logged in / logged out, when a search for the item you are watching was successful / unsuccessful (along with the title of the item), when a scrobble for the item you are watching was successful / unsuccessful, and your IP address for geographical statistics. This data is not shared with any other service."
},
"allowRollbarName": {
"message": "Allow Rollbar to collect information about bugs."
},
@@ -92,12 +92,6 @@
"disableScrobblingDescription": {
"message": "Com essa opção ativada, a extensão não realizará scrobble automático do que você está assistindo. Isso é útil se você prefere sincronizar o seu histórico mais tarde ao invés de fazer scrobble em tempo real."
},
"allowGoogleAnalyticsName": {
"message": "Permitir que o Google Analytics colete informações sobre o seu uso da extensão."
},
"allowGoogleAnalyticsDescription": {
"message": "Com essa opção ativada, informações sobre o seu uso da extensão serão coletadas e enviadas para nós, para que possamos obter dados e melhorar a extensão.Essas informações incluem: quando você começou / terminou uma sessão, quando uma pesquisa pelo item que você está assistindo foi bem / mal sucedida (junto com o título do item), quando um scrobble para o item que você está assistindo foi bem / mal sucedido, e o seu endereço IP para estatísticas geográficas. Esses dados não são compartilhados com nenhum outro serviço."
},
"allowRollbarName": {
"message": "Permitir que o Rollbar colete informações sobre erros."
},

This file was deleted.

@@ -5,10 +5,10 @@
* @property {Boolean} data.auto_sync
* @property {Object} options
* @property {Boolean} options.disableScrobbling
* @property {Boolean} options.allowGoogleAnalytics
* @property {Boolean} options.allowRollbar
* @property {Boolean} options.showNotifications
* @property {Boolean} options.sendReceiveCorrections
* @property {Boolean} options.grantCookies
*/

class BrowserStorage {
@@ -26,7 +26,7 @@ class BrowserStorage {
return !!browser.storage.sync;
}

async sync() {
async sync() {
if (this.isAvailable()) {
if (this.isSyncAvailable()) {
const storage = await browser.storage.sync.get(null);
@@ -30,25 +30,15 @@ export default class ContentController {
browser.runtime.sendMessage({type: `setInactiveIcon`});
}

sendAnalyticsEvent(options) {
browser.runtime.sendMessage({
type: `sendEvent`, name: options.name, value: options.value
});
}

onScrobbleSuccess() {
this.sendAnalyticsEvent({name: `Scrobble`, value: `onSuccess`});
}
onScrobbleSuccess() {}

onScrobbleError(status, response, options) {
this.sendAnalyticsEvent({name: `Scrobble`, value: `onError`});
console.log(`traktflix: Scrobble error`, status, response, options);
// noinspection JSIgnoredPromiseFromCall
this.reportError(`Scrobble`, status, response, options);
}

onSearchSuccess(response) {
this.sendAnalyticsEvent({name: `onSearchSuccess`, value: this.item.title});
this.scrobble = new Scrobble({
response,
type: this.item.type,
@@ -58,7 +48,6 @@ export default class ContentController {
this.setActiveIcon();
// noinspection JSIgnoredPromiseFromCall
this.scrobble.start();
this.sendAnalyticsEvent({name: `Scrobble`, value: `start`});
}

showErrorNotification(message) {
@@ -96,7 +85,6 @@ export default class ContentController {
}

onSearchError(status, response, options) {
this.sendAnalyticsEvent({name: `onSearchError`, value: `${status} - ${this.item.title}`});
console.log(`traktflix: Search error`, status, response, options, this.item.title);
// noinspection JSIgnoredPromiseFromCall
this.reportError(`Search`, status, response, options);
@@ -122,7 +110,6 @@ export default class ContentController {
this.setActiveIcon();
// noinspection JSIgnoredPromiseFromCall
this.scrobble.start();
this.sendAnalyticsEvent({name: `Scrobble`, value: `start`});
}
}

@@ -131,7 +118,6 @@ export default class ContentController {
this.setInactiveIcon();
// noinspection JSIgnoredPromiseFromCall
this.scrobble.pause();
this.sendAnalyticsEvent({name: `Scrobble`, value: `pause`});
}
}

@@ -140,7 +126,6 @@ export default class ContentController {
this.setInactiveIcon();
// noinspection JSIgnoredPromiseFromCall
this.scrobble.stop();
this.sendAnalyticsEvent({name: `Scrobble`, value: `stop`});
}
this.storeItem(null);
}
@@ -10,12 +10,6 @@ class OptionsUtils {
name: ``,
description: ``,
value: false
}, {
id: `allowGoogleAnalytics`,
name: ``,
description: ``,
value: false,
origins: [`*://google-analytics.com/*`]
}, {
id: `allowRollbar`,
name: ``,
@@ -79,7 +79,6 @@ class App extends React.Component {
}

async logoutClicked() {
browser.runtime.sendMessage({type: `sendEvent`, name: `Logout`, value: false});
await BrowserStorage.remove(`data`, true);
this.setState({logged: false});
this.context.router.history.push(`/login`);
@@ -93,12 +92,10 @@ class App extends React.Component {
const options = JSON.parse(response);
this.setState({loading: false, logged: !!options.access_token});
this.context.router.history.push(`/not-watching`);
browser.runtime.sendMessage({type: `sendEvent`, name: `TokenSuccess`, value: true});
}

onTokenFailed(status, response) {
this.setState({loading: false});
browser.runtime.sendMessage({type: `sendEvent`, name: `TokenFailed`, value: false});
console.log(`traktflix: Get Token failed`, status, response);
Rollbar.init().then(() => Rollbar.warning(`traktflix: Get Token failed`, {status: status, response: response}));
}
@@ -13,7 +13,6 @@ class Info extends React.Component {

render() {
const message = this.getRandomMessage();
browser.runtime.sendMessage({type: `sendAppView`, view: `Info`});

return (
<ErrorBoundary>
@@ -31,8 +31,6 @@ class LoginButton extends React.Component {
}

render() {
browser.runtime.sendMessage({type: `sendAppView`, view: `Login`});

return (
<ErrorBoundary>
<div className='login-wrapper'>
@@ -9,8 +9,6 @@ class Watching extends React.Component {
}

render() {
browser.runtime.sendMessage({type: `sendAppView`, view: `Watching ${this.props.item.title }`});

return (
<TmdbImageContainer>
<TmdbImage className='mdl-card mdl-shadow--2dp watching-card-thumb' item={this.props.item}>
@@ -16,7 +16,6 @@
</main>
</div>
<script type="text/javascript" src="../js/lib/browser-polyfill.js"></script>
<script type="text/javascript" src="../js/vendor.js"></script>
<script type="text/javascript" src="../js/history-sync.js"></script>
</body>
</html>
@@ -16,7 +16,6 @@
</main>
</div>
<script type="text/javascript" src="../js/lib/browser-polyfill.js"></script>
<script type="text/javascript" src="../js/vendor.js"></script>
<script type="text/javascript" src="../js/options.js"></script>
</body>
</html>
@@ -7,7 +7,6 @@
<body>
<div class="app-container"></div>
<script type="text/javascript" src="../js/lib/browser-polyfill.js"></script>
<script type="text/javascript" src="../js/vendor.js"></script>
<script type="text/javascript" src="../js/popup.js"></script>
</body>
</html>
@@ -1,6 +1,3 @@
import '../vendor/google-analytics-bundle';
import Settings from '../../settings';
import Analytics from '../../class/Analytics';
import BrowserStorage from '../../class/BrowserStorage';
import Oauth from '../../class/Oauth';
import Rollbar from '../../class/Rollbar';
@@ -9,32 +6,6 @@ import Shared from '../../class/Shared';

Shared.setBackgroundPage(true);

/* global analytics */
/**
* Google Analytics Object
* @type {Object} analytics
* @property {Function} getService
* @property {Function} service.getTracker
*/
const service = analytics.getService(`traktflix`);
/**
* @property {Function} addCallback
*/
service.getConfig()
.addCallback(
/**
* @param {Object} config
* @property {Function} setTrackingPermitted
*/
async config => {
const storage = await BrowserStorage.get(`options`);
const permitted = !!(storage.options && storage.options.allowGoogleAnalytics && (await browser.permissions.contains({ origins: [`*://google-analytics.com/*`] })));
config.setTrackingPermitted(permitted);
if (permitted) {
const tracker = service.getTracker(Settings.analyticsId);
Analytics.setTracker(tracker);
}
});
// noinspection JSIgnoredPromiseFromCall
Rollbar.init();

@@ -102,12 +73,6 @@ browser.runtime.onMessage.addListener((request, sender) => {
// noinspection JSIgnoredPromiseFromCall
Oauth.authorize(resolve);
return;
case `sendAppView`:
Analytics.sendAppView(request.view);
break;
case `sendEvent`:
Analytics.sendEvent(request.name, request.value);
break;
case `syncStorage`:
BrowserStorage.sync().then(resolve);
return;

0 comments on commit 704638b

Please sign in to comment.
You can’t perform that action at this time.