Skip to content

Commit

Permalink
Merge branch 'hotfix/19.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescdavis committed Aug 5, 2019
2 parents 2c803a5 + 99ba45a commit b6743d9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [19.7.1] - 2019-08-05
### Changed
- Services
- `analytics` - allow passing through of `nonIteraction` flag to Google Analytics
- Modifiers
- `trackScroll` - set `nonInteraction` flag when calling `analytics.trackFromElement()`
- Routes
- `home` - remove version and shorten analytics scope

## [19.7.0] - 2019-07-31
### Added
- Components
Expand Down Expand Up @@ -1041,7 +1050,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Quick Files

[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/19.7.0...HEAD
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/19.7.1...HEAD
[19.7.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/19.7.1
[19.7.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/19.7.0
[19.6.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/19.6.1
[19.6.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/19.6.0
Expand Down
2 changes: 1 addition & 1 deletion app/home/template.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<main data-analytics-scope='Logged-out homepage - {{this.version}}'>
<main data-analytics-scope='Home'>
<Home::-Components::HeroBanner />
<Home::-Components::SupportSection />
<Home::-Components::Testimonials />
Expand Down
1 change: 1 addition & 0 deletions app/modifiers/track-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TrackScrollModifier extends Modifier {
name,
category: 'page',
action: 'scroll',
nonInteraction: true,
},
);
this.didShow = true;
Expand Down
4 changes: 4 additions & 0 deletions app/services/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ export interface TrackedData {
action?: string;
extra?: string;
label: string;
nonInteraction?: boolean;
}

export interface InitialEventInfo {
name?: string;
category?: string;
action?: string;
extra?: string;
nonInteraction?: boolean;
}

function logEvent(analytics: Analytics, title: string, data: object) {
Expand Down Expand Up @@ -58,6 +60,7 @@ class EventInfo {
category?: string;
action?: string;
extra?: string;
nonInteraction?: boolean;

constructor(targetElement: Element, rootElement: Element, initialInfo?: InitialEventInfo) {
if (initialInfo) {
Expand All @@ -84,6 +87,7 @@ class EventInfo {
action: this.action,
label: [...this.scopes.reverse(), this.name].join(' - '),
extra: this.extra,
nonInteraction: this.nonInteraction,
};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-osf-web",
"version": "19.7.0",
"version": "19.7.1",
"description": "Ember front-end for the Open Science Framework",
"license": "Apache-2.0",
"author": "Center for Open Science <support@cos.io>",
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/analytics-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module('Integration | Analytics handling', hooks => {
action: 'click',
label: 'Scope! - Button!',
extra: undefined,
nonInteraction: undefined,
}],
], 'One click event');
});
Expand All @@ -54,6 +55,7 @@ module('Integration | Analytics handling', hooks => {
action: 'click',
label: 'Scope! - Button!',
extra: 'Foo',
nonInteraction: undefined,
}],
], 'One click event');
});
Expand All @@ -74,11 +76,13 @@ module('Integration | Analytics handling', hooks => {
action: 'click',
label: 'Scope! - Button!',
extra: undefined,
nonInteraction: undefined,
}], [{
category: 'button',
action: 'click',
label: 'Scope! - Button!',
extra: undefined,
nonInteraction: undefined,
}],
], 'Two click events');
});
Expand Down Expand Up @@ -110,6 +114,7 @@ module('Integration | Analytics handling', hooks => {
action: 'click',
label: 'Scope 1 - Scope 2 - Scope 3 - Button!',
extra: undefined,
nonInteraction: undefined,
}],
], 'One click event with nested scopes');
});
Expand All @@ -135,11 +140,13 @@ module('Integration | Analytics handling', hooks => {
action: 'click',
label: 'Scope 1 - Scope 3 - Link!',
extra: undefined,
nonInteraction: undefined,
}], [{
category: 'button',
action: 'click',
label: 'Scope 1 - Scope 2 - Button!',
extra: undefined,
nonInteraction: undefined,
}],
], 'One button, one link');
});
Expand Down Expand Up @@ -172,30 +179,35 @@ module('Integration | Analytics handling', hooks => {
action: 'click',
label: 'Scope! - Button!',
extra: undefined,
nonInteraction: undefined,
}],
[{
category: 'link',
action: 'click',
label: 'Scope! - Link!',
extra: undefined,
nonInteraction: undefined,
}],
[{
category: 'button',
action: 'click',
label: 'Scope! - Button link!',
extra: undefined,
nonInteraction: undefined,
}],
[{
category: 'checkbox',
action: 'click',
label: 'Scope! - Checkbox!',
extra: undefined,
nonInteraction: undefined,
}],
[{
category: 'other',
action: 'click',
label: 'Scope! - Other button!',
extra: undefined,
nonInteraction: undefined,
}],
], 'Correct categories');
});
Expand Down

0 comments on commit b6743d9

Please sign in to comment.