Skip to content
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

Analytics: some IDs/classes to track clicks on teacher /courses #20826

Merged
merged 2 commits into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/src/templates/studioHomepages/CourseBlocksGradeBands.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class CourseBlocksGradeBands extends Component {
static propTypes = {
cards: PropTypes.arrayOf(
PropTypes.shape({
linkId: PropTypes.string,
linkClass: PropTypes.string,
heading: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
path: PropTypes.string.isRequired
Expand All @@ -21,6 +23,8 @@ class CourseBlocksGradeBands extends Component {
{this.props.cards.map(
(card, cardIndex) => (
<ResourceCard
linkId={card.linkId}
linkClass={card.linkClass}
key={cardIndex}
title={card.heading}
description={card.description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ import i18n from "@cdo/locale";
class CourseBlocksTeacherGradeBands extends Component {
cards = [
{
linkId: 'course-block-grade-band-elementary',
linkClass: 'linktag',
heading: i18n.courseBlocksGradeBandsElementary(),
description: i18n.courseBlocksGradeBandsElementaryDescription(),
path: '/educate/curriculum/elementary-school'
},
{
linkId: 'course-block-grade-band-middle',
linkClass: 'linktag',
heading: i18n.courseBlocksGradeBandsMiddle(),
description: i18n.courseBlocksGradeBandsMiddleDescription(),
path: '/educate/curriculum/middle-school'
},
{
linkId: 'course-block-grade-band-high',
linkClass: 'linktag',
heading: i18n.courseBlocksGradeBandsHigh(),
description: i18n.courseBlocksGradeBandsHighDescription(),
path: '/educate/curriculum/high-school'
Expand Down
8 changes: 6 additions & 2 deletions apps/src/templates/studioHomepages/ResourceCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ class ResourceCard extends Component {
buttonText: PropTypes.string.isRequired,
link: PropTypes.string.isRequired,
isRtl: PropTypes.bool.isRequired,
allowWrap: PropTypes.bool
allowWrap: PropTypes.bool,
linkId: PropTypes.string,
linkClass: PropTypes.string
};

render() {

const { title, description, buttonText, link, isRtl, allowWrap } = this.props;
const { title, description, buttonText, link, isRtl, allowWrap, linkId, linkClass} = this.props;
const localeStyle = isRtl ? styles.rtl : styles.ltr;
let buttonStyles = [styles.button];
let cardStyles = [styles.card, localeStyle];
Expand All @@ -95,6 +97,8 @@ class ResourceCard extends Component {
</div>
<br/>
<Button
id={linkId}
className={linkClass}
href={link}
color={Button.ButtonColor.gray}
text={buttonText}
Expand Down
7 changes: 7 additions & 0 deletions shared/css/course-explorer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ $color_border_invisible: rgba(170, 170, 170, 0);
.title {
font-size: 16px;
font-family: $gotham-regular;
pointer-events: none;
}
.groupname {
font-size: 12px;
Expand Down Expand Up @@ -141,10 +142,16 @@ $color_border_invisible: rgba(170, 170, 170, 0);
}
.left {
float: left;
pointer-events: none;
}
.arrow {
float: right;
margin-top: -12px;
pointer-events: none;

i {
pointer-events: none;
}
}
}
.arrow_box {
Expand Down
23 changes: 14 additions & 9 deletions shared/haml/course_explorer_table.haml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

csp_learn_more_link = CDO.code_org_url('/educate/professional-learning/cs-principles')
courses << {
id: "csp",
name: "CS Principles",
starts: 9,
ends: 12,
Expand All @@ -71,6 +72,7 @@

csd_learn_more_link = CDO.code_org_url('/educate/professional-learning/cs-discoveries')
courses << {
id: "csd",
name: "CS Discoveries",
starts: 6,
ends: 10,
Expand All @@ -93,6 +95,7 @@
}

courses << {
id: "csf",
name: "CS Fundamentals",
starts: 0,
ends: 5,
Expand All @@ -114,6 +117,7 @@
}

courses << {
id: "pre",
name: "Pre-reader Express",
starts: 0,
ends: 2,
Expand All @@ -136,6 +140,7 @@
}

courses << {
id: "exp",
name: "CS Fundamentals: Express",
starts: 3,
ends: 12,
Expand Down Expand Up @@ -167,7 +172,7 @@
.arrow_box_content{style: "overflow: hidden"}
- if course[:img]
.left{style: "float: left; width: 30%"}
%a{href: course[:link] || course[:course_link]}
%a.linktag{id: "image-#{course[:id]}", href: course[:link] || course[:course_link]}
%img.courseimage{src: course[:img]}
.right{style: "float: left; width: 65%"}
.title
Expand All @@ -181,12 +186,12 @@
%br/
=course[:description2]
- if course[:link]
%a{href: course[:link], style: "text-decoration: none"}
%a.linktag{id: "link-#{course[:id]}", href: course[:link], style: "text-decoration: none"}
%button.launch{style: "font-size: 12px"}
Learn more
- if course[:course_link]
&nbsp;
%a{href: course[:course_link]}
%a.linktag{id: "course-link-#{course[:id]}", href: course[:course_link]}
%button.course-explorer-gray-button{style: "font-size: 12px"}
View course
.arrow_box_close{style: "position: absolute; right: 10px; top: 0px; cursor: pointer", data: {courseindex: course[:regular_order]}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cool we can track open/close too! Do we also count clicking 'x' as a close? I don't think we need to distinguish it from clicking the block, but would like to make sure that a close counts either method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I don't track clicking 'x', but at any rate, because this is a toggle, we don't differentiate opening/closing.

Rather, my idea was that by focusing on unique events (rather than total), we could only count the first click on a bar for any category, which would always be the first open for that category.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok! I think that's still fine. So we're basically finding out

  1. Do people know this is clickable?
  2. Do they look at a course and which one?
  3. Do they actually click from the course explorer to learn more?
  4. Or do they go through the grade bands?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

Expand All @@ -199,11 +204,11 @@

- if responsive
.courseexplorer.courses.smallresponsive{style: "margin-left: 0px; margin-top: 30px;"}
.coursebodycontainer{ style: "position: relative; overflow: hidden; clear: both"}
.coursebodycontainer{style: "position: relative; overflow: hidden; clear: both"}
.coursebodymain{style: "width: 100%"}
- courses.sort_by {|i| i[:responsive_small_order]}.each_with_index do |course, course_index|
.course.breakable{class: "course-#{course[:regular_order]}", data: {courseindex: course[:regular_order]}}
.courserow{style: "float: left; width: 100%"}
.courserow.clicktag{id: "click-#{course[:id]}", style: "float: left; width: 100%"}
.left
.title
=course[:name]
Expand All @@ -220,7 +225,7 @@
.title
Professional Learning
.right{style: 'float:right; margin-top: -26px;'}
%a{:href => CDO.code_org_url('/educate/professional-learning')}
%a.linktag#professional-learning{:href => CDO.code_org_url('/educate/professional-learning')}
.course-explorer-gray-button.professional-learning-button.mobile-button
Learn more
.cleardiv{style: "clear: both"}
Expand Down Expand Up @@ -257,9 +262,9 @@
- unless course[:starts] == 0 || course_index == (index_course_first_same_line + 1)
%div{class: "bar-#{course[:starts]}"}
&nbsp;
- courserow_class = "courserow bar-#{course[:ends] - course[:starts] + 1}"
- courserow_class = "courserow clicktag bar-#{course[:ends] - course[:starts] + 1}"
- courserow_class += " lighter" if course[:lighter]
%div{class: courserow_class}
%div{id: "click-#{course[:id]}", class: courserow_class}
.left
.title
=course[:name]
Expand All @@ -281,7 +286,7 @@
.title
Professional Learning for all grade levels
.right{style: 'float:right; margin-top: -26px;'}
%a{:href => CDO.code_org_url('/educate/professional-learning')}
%a.linktag#professional-learning-nonresponsive{:href => CDO.code_org_url('/educate/professional-learning')}
.course-explorer-gray-button.professional-learning-button
Learn more
.cleardiv{style: "clear: both"}