Skip to content

Commit

Permalink
AdLog analytics event when key parts of the UI are being used
Browse files Browse the repository at this point in the history
  • Loading branch information
louisremi committed Sep 10, 2015
1 parent 3882aa5 commit f775ca3
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 23 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]

# Change these settings to your own preference
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ sudo: false
language: node_js
node_js:
- '0.12'
before_script:
before_install:
- npm install -g uglifyjs
- npm install
after_install:
- npm dedupe
script: gulp build --type=prod
after_script:
Expand Down
2 changes: 2 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script type="text/javascript" src="bundle.js"></script>
<script>
// google analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
Expand All @@ -21,6 +22,7 @@
ga('create', 'UA-41962243-3', 'auto');
ga('send', 'pageview');

// simple error logging
window.addEventListener('error', function(e) {
ga( 'send', 'event', 'js-error', e.message, e.filename + ': ' + e.lineno );
});
Expand Down
14 changes: 8 additions & 6 deletions app/scripts/components/account.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import HoodieApi from '../services/hoodie.services.js';
import WarningMessage from './warning-message.components.jsx';
import LocalClient from '../stores/local-client.stores.jsx';
import Log from '../services/log.services.js';

export default class Account extends React.Component {
constructor(props) {
Expand All @@ -13,7 +14,7 @@ export default class Account extends React.Component {
const password = React.findDOMNode(this.refs.password).value;
if (password.length < 6) {
this.setState({
passwordToShort:true,
passwordTooShort:true,
});

return;
Expand All @@ -35,19 +36,20 @@ export default class Account extends React.Component {
componentWillUnmount() {
this.setState({
passwordChanged:false,
passwordToShort:false,
passwordTooShort:false,
});
}

logout() {
this.client.dispatchAction('/logout');
Log.ui('Account.logout');
}

render() {
let passwordToShort = false;
let passwordTooShort = false;

if (this.state.passwordToShort) {
passwordToShort = `You're password is to short (must be 6 characters long at least)`;
if (this.state.passwordTooShort) {
passwordTooShort = `You're password is too short (must be 6 characters long at least)`;
}

let changePassContent = false;
Expand All @@ -61,7 +63,7 @@ export default class Account extends React.Component {
<input className="account-block-form-input" ref="password" type="password" id="new-password" name="new-password"/>
{((message) => {if (message) {
return <WarningMessage text={message}/>
}})(passwordToShort)}
}})(passwordTooShort)}
<button className="account-block-form-button">Change password</button>
</form>
</div>
Expand Down
9 changes: 6 additions & 3 deletions app/scripts/components/controls-tabs.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import Lifespan from 'lifespan';
import classNames from 'classnames';
import LocalClient from '../stores/local-client.stores.jsx';
import GeminiScrollbar from 'react-gemini-scrollbar';
import Log from '../services/log.services.js';

export class ControlsTabs extends React.Component {
componentWillMount() {
this.client = LocalClient.instance();
}

this.changeTab = (name) => {
this.client.dispatchAction('/change-tab-font',{name});
};
changeTab(name) {
this.client.dispatchAction('/change-tab-font',{name});
Log.ui('ControlsTabs.changeTab', name);
}

render() {
const headers = _.map(this.props.children,({props: {iconId, name}}) => {
const classes = classNames({
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/components/font-selector.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Lifespan from 'lifespan';
import LocalClient from '../stores/local-client.stores.jsx';
import ClassNames from 'classnames';
import Log from '../services/log.services.js';

export default class FontSelector extends React.Component {
componentWillMount() {
Expand All @@ -15,6 +16,7 @@ export default class FontSelector extends React.Component {

changeFont() {
this.client.dispatchAction('/change-font', this.props.font.repo);
Log.ui('FontSelector.changeFont', this.props.font.repo);
}

render() {
Expand Down
9 changes: 6 additions & 3 deletions app/scripts/components/forgotten-password.components.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import React from 'react';
import pleaseWait from 'please-wait';
import HoodieApi from '../services/hoodie.services.js';

import WarningMessage from './warning-message.components.jsx';
import Log from '../services/log.services.js';

export default class ForgottenPassword extends React.Component {
constructor(props) {
super(props);

this.state = {};
}
async resetPassord() {
async resetPassword() {
const email = React.findDOMNode(this.refs.email).value;
if (!(/.+\@.+\..+/.test(email))) {
this.setState({
notAnEmail:true,
});
return;
}

Log.ui('ForgottenPassword.resetPassword', email);

const result = await HoodieApi.askPasswordReset(email);
this.setState({
reset:true,
Expand Down Expand Up @@ -51,7 +54,7 @@ export default class ForgottenPassword extends React.Component {
}}>Cancel</button>
<button className="forgotten-password-button"
onClick={() => {
this.resetPassord()
this.resetPassword()
}}>Reset Password</button>
</div>,
]
Expand Down
5 changes: 4 additions & 1 deletion app/scripts/components/glyph-button.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Lifespan from 'lifespan';
import LocalClient from '../stores/local-client.stores.jsx';
import LocalServer from '../stores/local-server.stores.jsx';
import ClassNames from 'classnames';
import Log from '../services/log.services.js';


export default class GlyphButton extends React.Component {
componentWillMount() {
Expand All @@ -15,7 +17,8 @@ export default class GlyphButton extends React.Component {
}

toggleLockList() {
this.client.dispatchAction('/toggle-lock-list',{});
this.client.dispatchAction('/toggle-lock-list', {});
Log.ui('GlyphButton.toggleLockList');
}

selectTag(tag) {
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/components/prototypo-canvas.components.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ClassNames from 'classnames';
import LocalClient from '../stores/local-client.stores.jsx';
import Log from '../services/log.services.js';
import Lifespan from 'lifespan';

import {ContextualMenu, ContextualMenuItem} from './contextual-menu.components.jsx';
Expand Down Expand Up @@ -112,6 +113,8 @@ export default class PrototypoCanvas extends React.Component {
showContextMenu:true,
contextMenuPos:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},
});

Log.ui('PrototypoCanvas.showContextMenu');
}

hideContextMenu() {
Expand Down
6 changes: 5 additions & 1 deletion app/scripts/components/sidebar.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import LocalServer from '../stores/local-server.stores.jsx';

import {registerToUndoStack} from '../helpers/undo-stack.helpers.js';

import Log from '../services/log.services.js';

import Remutable from 'remutable';
import Lifespan from 'lifespan';

Expand All @@ -34,10 +36,12 @@ export default class Sidebar extends React.Component {
const name = params.name;
const patch = sideBarTab.set('tab',name).commit();
server.dispatchUpdate('/sideBarTab', patch);

Log.ui('Sidebar/change-tab-sidebar', name);
}
}, this.lifespan);

this.client.dispatchAction('/change-tab-sidebar',{name: 'sliders'});
this.client.dispatchAction('/change-tab-sidebar', {name: 'sliders'});

this.setState({
fonts:[{
Expand Down
6 changes: 5 additions & 1 deletion app/scripts/components/topbar.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {TopBarMenu, TopBarMenuDropdown, TopBarMenuDropdownItem, TopBarMenuDropdo
import HoodieApi from '../services/hoodie.services.js';
import LocalClient from '../stores/local-client.stores.jsx';
import Lifespan from 'lifespan';
import Log from '../services/log.services.js';

export default class Topbar extends React.Component {

Expand Down Expand Up @@ -48,10 +49,12 @@ export default class Topbar extends React.Component {

exportOTF() {
fontInstance.download();
Log.ui('Topbar.exportOTF');
}

exportGlyphr() {
fontInstance.openInGlyphr();
Log.ui('Topbar.exportGlyphr');
}

resetAllParams() {
Expand All @@ -69,7 +72,7 @@ export default class Topbar extends React.Component {

this.client.dispatchAction('/change-param',{values:defaultParams, force:true});
});

}

componentWillUnmount() {
Expand All @@ -78,6 +81,7 @@ export default class Topbar extends React.Component {

logout() {
this.client.dispatchAction('/logout');
Log.ui('Topbar.logout');
}

toggleView(name) {
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/services/values.services.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PouchDB from 'pouchdb';
import HoodieApi from './hoodie.services.js';
import PouchDB from 'pouchdb';
import HoodieApi from './hoodie.services.js';


function values(prefix) {
Expand Down

0 comments on commit f775ca3

Please sign in to comment.