Skip to content

Notifications analytics #4168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a3b77a9
Merge branch 'develop' into notifications
luizrrodrigues Mar 30, 2020
0234484
#4154: Implement Google Analytics event tracking
luizrrodrigues Mar 31, 2020
fb42ff4
Temp point topcoder-react-lib and navigation-compoment to branch
luizrrodrigues Mar 31, 2020
b1694fc
#4154: Implement Google Analytics to Notifications Events
luizrrodrigues Apr 1, 2020
3715ee9
ci: deploying on test env for QA
sushilshinde Apr 2, 2020
78147df
Added 'unsafe-perm' to Dockerfile
luizrrodrigues Apr 2, 2020
9916642
Deploy to Beta env
luizrrodrigues Apr 3, 2020
f3fdb72
Apply feedback: Events naming
luizrrodrigues Apr 5, 2020
7ab6e17
Notification Analytics - Convert challenge ID to String
luizrrodrigues Apr 5, 2020
d99b776
ci: topcoder-react-lib test release bump up
sushilshinde Apr 16, 2020
ef0c090
#4154: Implement Google Analytics event tracking
luizrrodrigues Mar 31, 2020
6eb8452
Temp point topcoder-react-lib and navigation-compoment to branch
luizrrodrigues Mar 31, 2020
7db9fde
#4154: Implement Google Analytics to Notifications Events
luizrrodrigues Apr 1, 2020
9426e50
Added 'unsafe-perm' to Dockerfile
luizrrodrigues Apr 2, 2020
ad22f4e
Apply feedback: Events naming
luizrrodrigues Apr 5, 2020
9260e5f
Notification Analytics - Convert challenge ID to String
luizrrodrigues Apr 5, 2020
03799c5
ci: topcoder-react-lib test release bump up
sushilshinde Apr 16, 2020
9854e76
Merge branch 'notifications-analytics' of https://github.com/topcoder…
luizrrodrigues Apr 21, 2020
78ba14a
ci: Changing npm package versions
sushilshinde Apr 23, 2020
02b6157
ci: deploying on beta and dev
sushilshinde Apr 23, 2020
25bba8e
Removed 'unsafe-perm' from Dockerfile
luizrrodrigues Apr 24, 2020
b7bce62
with test topcoder-react-lib version 1000.13.5
sushilshinde Apr 27, 2020
6602a41
with test topcoder-react-lib version 1000.13.5
sushilshinde Apr 27, 2020
f440103
fixed snapshots
sushilshinde Apr 27, 2020
01c2abc
Updated postinstall script to remove topcoder-react-lib from navigati…
luizrrodrigues Apr 27, 2020
c8b3d69
Revert snapshot changes
luizrrodrigues Apr 27, 2020
c82a4b9
Added node_modules to dockerFile
luizrrodrigues Apr 27, 2020
fcd5c26
Added unafe-perm to Dockerfile to docker run postinstall script
luizrrodrigues Apr 27, 2020
6874bac
changed topcoder react lib test version
sushilshinde Apr 28, 2020
71833d6
Merge branch 'notifications-analytics' of github.com:topcoder-platfor…
sushilshinde Apr 28, 2020
b70b169
Merge remote-tracking branch 'origin/develop' into notifications-anal…
sushilshinde Apr 28, 2020
3aebaae
ci:automerged
sushilshinde Apr 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ workflows:
branches:
only:
- develop
- notifications-analytics
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand All @@ -189,6 +190,7 @@ workflows:
branches:
only:
- develop
- notifications-analytics
# Production builds are exectuted
# when PR is merged to the master
# Don't change anything in this configuration
Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__coverage__/
.git/
node_modules/
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ ENV CONTENTFUL_EDU_PREVIEW_API_KEY=$CONTENTFUL_EDU_PREVIEW_API_KEY
################################################################################
# Testing and build of the application inside the container.

RUN npm config set unsafe-perm true
RUN npm install
RUN npm test
RUN npm run build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ exports[`Default render 1`] = `
theme="light"
/>
</div>
`;
`;
6,615 changes: 3,188 additions & 3,427 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"lint": "npm run lint:js && npm run lint:scss",
"lint:js": "eslint --ext .js,.jsx .",
"lint:scss": "stylelint **/*.scss --syntax scss",
"update-tests": "npm run jest -- -u",
"start": "cross-env BABEL_ENV=production NODE_ENV=production node ./bin/www",
"test": "npm run lint && npm run jest",
"commitlint": "commitlint -E HUSKY_GIT_PARAMS",
"release:changelog": "npm run conventional-changelog -- -p angular -i CHANGELOG.md -s",
"postinstall": "rimraf node_modules/navigation-component/node_modules/topcoder-react-utils && rimraf node_modules/topcoder-react-ui-kit/node_modules/topcoder-react-utils"
"postinstall": "rimraf node_modules/navigation-component/node_modules/topcoder-react-utils && rimraf node_modules/navigation-component/node_modules/topcoder-react-lib && rimraf node_modules/topcoder-react-ui-kit/node_modules/topcoder-react-utils"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -80,7 +81,7 @@
"moment-timezone": "^0.5.21",
"money": "^0.2.0",
"morgan": "^1.9.0",
"navigation-component": "git+https://github.com/topcoder-platform/navigation-component.git#develop",
"navigation-component": "topcoder-platform/navigation-component#develop",
"node-forge": "^0.7.5",
"nuka-carousel": "^4.5.3",
"postcss": "^6.0.23",
Expand Down Expand Up @@ -132,7 +133,7 @@
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
"tc-ui": "^1.0.12",
"topcoder-react-lib": "0.15.0",
"topcoder-react-lib": "v1000.13.6",
"topcoder-react-ui-kit": "^1.0.11",
"topcoder-react-utils": "0.7.8",
"turndown": "^4.0.2",
Expand Down
10 changes: 10 additions & 0 deletions src/shared/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'lodash';
import React, { useState, useEffect } from 'react';
import PT from 'prop-types';
import { config } from 'topcoder-react-utils';
import { tracking } from 'topcoder-react-lib';
import Logo from 'assets/images/tc-logo.svg';

let TopNavRef;
Expand Down Expand Up @@ -62,6 +63,15 @@ const Header = ({
}, [auth.tokenV3]);
}

/*
* Init Google Analytics
*/
if (auth && auth.user) {
useEffect(() => {
tracking.init(auth.user.handle);
}, [auth.user.handle]);
}

if (TopNavRef) {
return (
<div>
Expand Down
7 changes: 7 additions & 0 deletions src/shared/components/Notifications/TabsPanel/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import { tracking } from 'topcoder-react-lib';
import styles from './style.scss';


Expand Down Expand Up @@ -33,12 +34,14 @@ export default class TabsPanel extends React.Component {
() => {
this.setState({ tab: TABS.ACTIVE });
changeTab(TABS.ACTIVE);
tracking.event('Click', 'Change Tab', 'Active Challenges');
}
}
onKeyPress={
() => {
this.setState({ tab: TABS.ACTIVE });
changeTab(TABS.ACTIVE);
tracking.event('Click', 'Change Tab', 'Active Challenges');
}
}
>CHALLENGES
Expand All @@ -51,12 +54,14 @@ export default class TabsPanel extends React.Component {
() => {
this.setState({ tab: TABS.BROADCAST });
changeTab(TABS.BROADCAST);
tracking.event('Click', 'Change Tab', 'Notifications');
}
}
onKeyPress={
() => {
this.setState({ tab: TABS.BROADCAST });
changeTab(TABS.BROADCAST);
tracking.event('Click', 'Change Tab', 'Notifications');
}
}
>NOTIFICATIONS
Expand All @@ -72,12 +77,14 @@ export default class TabsPanel extends React.Component {
() => {
this.setState({ tab: TABS.COMPLETED });
changeTab(TABS.COMPLETED);
tracking.event('Click', 'Change Tab', 'Completed Challenges');
}
}
onKeyPress={
() => {
this.setState({ tab: TABS.COMPLETED });
changeTab(TABS.COMPLETED);
tracking.event('Click', 'Change Tab', 'Completed Challenges');
}
}
>COMPLETED CHALLENGES
Expand Down
20 changes: 19 additions & 1 deletion src/shared/components/Notifications/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cn from 'classnames';
import _ from 'lodash';
import moment from 'moment';
import { Link } from 'topcoder-react-utils';
import { tracking } from 'topcoder-react-lib';
import IconArrow from 'assets/images/notifications/arrow.svg';
import styles from './style.scss';
import TabsPanel from './TabsPanel';
Expand Down Expand Up @@ -36,7 +37,13 @@ const Item = ({
<Link
to={`/challenges/${item.sourceId}`}
className={styles['noti-item']}
onClick={() => !item.isRead && markNotificationAsRead(item, auth.tokenV3)}
onClick={() => {
if (!item.isRead) {
markNotificationAsRead(item, auth.tokenV3);
tracking.event('Click', 'Mark Notification As Read', 'Details Page');
}
tracking.event('Click', 'Notification Event', String(item.sourceId));
}}
>
{children}
</Link>
Expand Down Expand Up @@ -70,9 +77,11 @@ const Item = ({
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
markNotificationAsRead(item, auth.tokenV3);
tracking.event('Click', 'Mark Notification As Read', 'Details Page');
}}
onKeyPress={() => {
markNotificationAsRead(item, auth.tokenV3);
tracking.event('Press Key', 'Mark Notification As Read', 'Details Page');
}}
tabIndex="0"
/>
Expand Down Expand Up @@ -110,6 +119,11 @@ export default class NotificationList extends React.Component {
};
}

componentDidMount() {
// Report page view
tracking.pageView();
}

componentWillUnmount() {
// mark all notifications as seen when go to another page
const {
Expand All @@ -119,6 +133,7 @@ export default class NotificationList extends React.Component {
const result = _.map(notificationsList, 'id').join('-');
if (result) {
markAllNotificationAsSeen(result, auth.tokenV3);
tracking.event('Auto Action', 'Mark All Notifications As Seen', 'Details Page');
}
}

Expand Down Expand Up @@ -152,6 +167,7 @@ export default class NotificationList extends React.Component {
} = this.props;
const { collapsedChallenges, activeTab } = this.state;
let challengesList = [];

if (activeTab === 'active') {
challengesList = _.filter((notifications || []),
t => eventTypes.PROJECT.ACTIVE.includes(t.eventType));
Expand Down Expand Up @@ -190,11 +206,13 @@ export default class NotificationList extends React.Component {
onClick={() => {
if (challegeId) {
dismissChallengeNotifications(challegeId, auth.tokenV3);
tracking.event('Click', 'Dismiss Challenge', 'Details Page');
}
}}
onKeyPress={() => {
if (challegeId) {
dismissChallengeNotifications(challegeId, auth.tokenV3);
tracking.event('Click', 'Dismiss Challenge', 'Details Page');
}
}}
>&times;
Expand Down