Skip to content

Commit 31c2642

Browse files
Added GA/GTM for manifest. Updated release and Terra GA/GTM. Resolves #1138. (#1148)
1 parent 930ed9c commit 31c2642

18 files changed

+280
-49
lines changed

spa/src/app/app.component.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ import { HCAToolbarComponent } from "./site/hca-toolbar/hca-toolbar.component";
3535
import { StickyFooterComponent } from "./site/sticky-footer/sticky-footer.component";
3636
import { LocalStorageService } from "./storage/local-storage.service";
3737
import { ActivatedRouteStub } from "./test/activated-route.stub";
38+
import { CCToolbarNavSubMenuComponent } from "./shared/cc-toolbar-nav-sub-menu/cc-toolbar-nav-sub-menu.component";
39+
import { CCToolbarNavSubMenuItemComponent } from "./shared/cc-toolbar-nav-sub-menu-item/cc-toolbar-nav-sub-menu-item.component";
40+
import { CCToolbarNavDropDownComponent } from "./shared/cc-toolbar-nav-drop-down/cc-toolbar-nav-drop-down.component";
3841

3942

4043
describe("AppComponent:", () => {
@@ -60,6 +63,9 @@ describe("AppComponent:", () => {
6063
AppComponent,
6164
CCToolbarNavComponent,
6265
CCToolbarNavItemComponent,
66+
CCToolbarNavSubMenuComponent,
67+
CCToolbarNavSubMenuItemComponent,
68+
CCToolbarNavDropDownComponent,
6369
DataPolicyFooterComponent,
6470
DesktopFooterComponent,
6571
HCAFooterComponent,

spa/src/app/files/hca-get-data/hca-export-to-terra/hca-export-to-terra.component.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ <h4 class="fontsize-m semi-bold">Select Export File Types</h4>
77
<ng-container *ngIf="getFileTypeSummaries(state.manifestDownloadFileSummary).length > 0">
88
<file-type-summary-list [selectedSearchTermNames]="state.selectedSearchTermNames"
99
[fileTypeSummaries]="getFileTypeSummaries(state.manifestDownloadFileSummary)"></file-type-summary-list>
10-
<button class="button primary" type="button" (click)="onExportToTerra(state.selectedSearchTerms)" [disabled]="!isAnyFileFormatSelected(state.selectedSearchTerms)">Request Export</button>
10+
<button class="button primary"
11+
type="button"
12+
(click)="onExportToTerra(state.selectedSearchTerms)"
13+
[disabled]="!isAnyFileFormatSelected(state.selectedSearchTerms)">Request Export
14+
</button>
1115
</ng-container>
1216
</ng-container>
1317
<ng-container *ngIf="isRequestInProgress(state.exportToTerraStatus)">
@@ -24,10 +28,10 @@ <h4 class="fontsize-m semi-bold">Your Export is Ready</h4>
2428
</hca-get-data-panel>
2529
<div class="download">
2630
<display-data-link [link]="getTerraServiceUrl(state.exportToTerraUrl)"
27-
[targetBlank]="true"
28-
(dataLinkClicked)="onDataLinkClicked(getTerraServiceUrl(state.exportToTerraUrl))"></display-data-link>
31+
[targetBlank]="true"
32+
(dataLinkClicked)="onDataLinkClicked(state.selectedSearchTerms, getTerraServiceUrl(state.exportToTerraUrl))"></display-data-link>
2933
<copy-to-clipboard [copyToClipboardLink]="getTerraServiceUrl(state.exportToTerraUrl)"
30-
(copyClicked)="onDataLinkCopied(getTerraServiceUrl(state.exportToTerraUrl))"></copy-to-clipboard>
34+
(copyClicked)="onDataLinkCopied(state.selectedSearchTerms, getTerraServiceUrl(state.exportToTerraUrl))"></copy-to-clipboard>
3135
</div>
3236
</ng-container>
3337
<ng-container *ngIf="isRequestFailed(state.exportToTerraStatus)">

spa/src/app/files/hca-get-data/hca-export-to-terra/hca-export-to-terra.component.ts

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ import { SearchTerm } from "../../search/search-term.model";
2626
import { ExportToTerraStatus } from "../../shared/export-to-terra-status.model";
2727
import { TerraService } from "../../shared/terra.service";
2828
import { HCAExportToTerraState } from "./hca-export-to-terra.state";
29-
import { SearchTermService } from "../../shared/search-term.service";
30-
import { GTMService } from "../../../shared/gtm/gtm.service";
31-
import { GACategory } from "../../../shared/gtm/ga-category.model";
32-
import { GAAction } from "../../../shared/gtm/ga-action.model";
33-
import { GADimension } from "../../../shared/gtm/ga-dimension.model";
34-
import { ToolName } from "../../shared/tool-name.model";
3529

3630
@Component({
3731
selector: "hca-export-to-terra",
@@ -50,15 +44,11 @@ export class HCAExportToTerraComponent implements OnDestroy, OnInit {
5044
/**
5145
*
5246
* @param {ConfigService} configService
53-
* @param {GTMService} gtmService
54-
* @param {SearchTermService} searchTermService
5547
* @param {TerraService} terraService
5648
* @param {Store<AppState>} store
5749
* @param {Window} window
5850
*/
5951
constructor(private configService: ConfigService,
60-
private gtmService: GTMService,
61-
private searchTermService: SearchTermService,
6252
private terraService: TerraService,
6353
private store: Store<AppState>,
6454
@Inject("Window") window: Window) {
@@ -148,38 +138,33 @@ export class HCAExportToTerraComponent implements OnDestroy, OnInit {
148138
/**
149139
* Track click on Terra data link.
150140
*
141+
* @param {SearchTerm[]} selectedSearchTerms
151142
* @param {string} exportToTerraUrl
152143
*/
153-
public onDataLinkClicked(exportToTerraUrl: string) {
144+
public onDataLinkClicked(selectedSearchTerms: SearchTerm[], exportToTerraUrl: string) {
154145

155-
this.gtmService.trackEvent(GACategory.RESULT_SET, GAAction.DATA_LINK, exportToTerraUrl, {
156-
[GADimension.TOOL_NAME]: ToolName.TERRA
157-
});
146+
this.terraService.trackLaunchTerraLink(selectedSearchTerms, exportToTerraUrl);
158147
}
159148

160149
/**
161150
* Track click on copy of Terra data link.
162151
*
152+
* @param {SearchTerm[]} selectedSearchTerms
163153
* @param {string} exportToTerraUrl
164154
*/
165-
public onDataLinkCopied(exportToTerraUrl: string) {
155+
public onDataLinkCopied(selectedSearchTerms: SearchTerm[], exportToTerraUrl: string) {
166156

167-
this.gtmService.trackEvent(GACategory.RESULT_SET, GAAction.COPY_TO_CLIPBOARD, exportToTerraUrl, {
168-
[GADimension.TOOL_NAME]: ToolName.TERRA
169-
});
157+
this.terraService.trackCopyToClipboardTerraLink(selectedSearchTerms, exportToTerraUrl);
170158
}
171159

172160
/**
173-
* Dispatch action to export to Terra.
161+
* Dispatch action to export to Terra. Also track export action with GA.
174162
*
175163
* @param {SearchTerm[]} selectedSearchTerms
176164
*/
177165
public onExportToTerra(selectedSearchTerms: SearchTerm[]) {
178166

179-
const query = this.searchTermService.marshallSearchTerms(selectedSearchTerms);
180-
this.gtmService.trackEvent(GACategory.RESULT_SET, GAAction.EXPORT, query, {
181-
[GADimension.TOOL_NAME]: ToolName.TERRA
182-
});
167+
this.terraService.trackRequestExportToTerra(selectedSearchTerms);
183168
this.store.dispatch(new ExportToTerraRequestAction());
184169
}
185170

spa/src/app/files/hca-get-data/hca-get-manifest/hca-get-manifest.component.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ <h4 class="fontsize-m semi-bold">Select Manifest File Types</h4>
99
<ng-container *ngIf="!isFileTypeSummariesEmpty(state.fileManifestFileSummary)">
1010
<file-type-summary-list [selectedSearchTermNames]="state.selectedSearchTermNames"
1111
[fileTypeSummaries]="getFileTypeSummaries(state.fileManifestFileSummary)"></file-type-summary-list>
12-
<button class="button primary" type="button" (click)="onRequestManifest()" [disabled]="!isAnyFileFormatSelected(state.selectedSearchTerms)">Prepare Manifest</button>
12+
<button class="button primary"
13+
type="button"
14+
(click)="onRequestManifest(state.selectedSearchTerms)"
15+
[disabled]="!isAnyFileFormatSelected(state.selectedSearchTerms)">Prepare Manifest</button>
1316
</ng-container>
1417
</ng-container>
1518
<ng-container *ngIf="isDownloadInProgress(state.manifestResponse)">
@@ -25,8 +28,10 @@ <h4 class="fontsize-m semi-bold">Your File Manifest is Ready</h4>
2528
<p class="fontsize-m">Select the link below to download your manifest.</p>
2629
<p class="fontsize-m">This link expires in 24 hours.</p>
2730
<div class="download">
28-
<display-data-link [link]="state.manifestResponse.fileUrl"></display-data-link>
29-
<copy-to-clipboard [copyToClipboardLink]="state.manifestResponse.fileUrl"></copy-to-clipboard>
31+
<display-data-link [link]="state.manifestResponse.fileUrl"
32+
(dataLinkClicked)="onDataLinkClicked(state.selectedSearchTerms, state.manifestResponse.fileUrl)"></display-data-link>
33+
<copy-to-clipboard [copyToClipboardLink]="state.manifestResponse.fileUrl"
34+
(copyClicked)="onDataLinkCopied(state.selectedSearchTerms, state.manifestResponse.fileUrl)"></copy-to-clipboard>
3035
</div>
3136
<p class="fontsize-m">Once you have downloaded your manifest, use the HCA Command Line Interface (HCA CLI) to
3237
download the files listed in your

spa/src/app/files/hca-get-data/hca-get-manifest/hca-get-manifest.component.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { TermSortService } from "../../sort/term-sort.service";
2626
import { DisplayDataLinkComponent } from "../display-data-link/display-data-link.component";
2727
import { HCAGetDataPanelComponent } from "../hca-get-data-panel/hca-get-data-panel.component";
2828
import { HCAGetManifestComponent } from "./hca-get-manifest.component";
29+
import { GTMService } from "../../../shared/gtm/gtm.service";
30+
import { FileManifestService } from "../../shared/file-manifest.service";
2931

3032
describe("HCAGetManifestComponent", () => {
3133

@@ -77,6 +79,22 @@ describe("HCAGetManifestComponent", () => {
7779
provide: ConfigService,
7880
useValue: jasmine.createSpyObj("ConfigService", ["getPortalURL"])
7981
},
82+
{
83+
provide: GTMService,
84+
useValue: jasmine.createSpyObj("GTMService", [
85+
"trackEvent"
86+
])
87+
},
88+
{
89+
provide: FileManifestService,
90+
useValue: jasmine.createSpyObj("FileManifestService", [
91+
"trackRequestCohortManifest",
92+
"trackDownloadCohortManifest",
93+
"trackCopyToClipboardCohortManifestLink",
94+
"trackDownloadProjectManifest",
95+
"trackCopyToClipboardProjectManifestLink"
96+
])
97+
},
8098
{
8199
provide: Store,
82100
useValue: testStore

spa/src/app/files/hca-get-data/hca-get-manifest/hca-get-manifest.component.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ import {
2323
import { selectSelectedSearchTerms } from "../../_ngrx/search/search.selectors";
2424
import { FileSummary } from "../../file-summary/file-summary";
2525
import { FileTypeSummary } from "../../file-summary/file-type-summary";
26+
import { HCAGetManifestState } from "./hca-get-manifest.state";
2627
import { SearchTerm } from "../../search/search-term.model";
28+
import { FileManifestService } from "../../shared/file-manifest.service";
29+
import { GTMService } from "../../../shared/gtm/gtm.service";
2730
import { ManifestResponse } from "../../shared/manifest-response.model";
2831
import { ManifestStatus } from "../../shared/manifest-status.model";
29-
import { HCAGetManifestState } from "./hca-get-manifest.state";
3032

3133
@Component({
3234
selector: "hca-get-manifest",
@@ -44,10 +46,14 @@ export class HCAGetManifestComponent implements OnDestroy, OnInit {
4446

4547
/**
4648
* @param {ConfigService} configService
49+
* @param {FileManifestService} fileManifestService
50+
* @param {GTMService} gtmService
4751
* @param {Store<AppState>} store
4852
*/
4953
constructor(
5054
private configService: ConfigService,
55+
private gtmService: GTMService,
56+
private fileManifestService: FileManifestService,
5157
private store: Store<AppState>) {
5258

5359
this.portalURL = this.configService.getPortalURL();
@@ -119,10 +125,33 @@ export class HCAGetManifestComponent implements OnDestroy, OnInit {
119125
}
120126

121127
/**
122-
* Dispatch action to generate manifest summary URL.
128+
* Track click on manifest data link.
129+
*
130+
* @param {SearchTerms[]} selectedSearchTerms
131+
* @param {string} manifestUrl
132+
*/
133+
public onDataLinkClicked(selectedSearchTerms: SearchTerm[], manifestUrl: string) {
134+
135+
this.fileManifestService.trackDownloadCohortManifest(selectedSearchTerms, manifestUrl);
136+
}
137+
138+
/**
139+
* Track click on copy of manifest data link.
140+
*
141+
* @param {SearchTerms[]} selectedSearchTerms
142+
* @param {string} manifestUrl
143+
*/
144+
public onDataLinkCopied(selectedSearchTerms: SearchTerm[], manifestUrl: string) {
145+
146+
this.fileManifestService.trackCopyToClipboardCohortManifestLink(selectedSearchTerms, manifestUrl);
147+
}
148+
149+
/**
150+
* Dispatch action to generate manifest summary URL. Also track export action with GA.
123151
*/
124-
public onRequestManifest() {
152+
public onRequestManifest(selectedSearchTerms: SearchTerm[]) {
125153

154+
this.fileManifestService.trackRequestCohortManifest(selectedSearchTerms);
126155
this.store.dispatch(new FetchFileManifestUrlRequestAction(this.ngDestroy$));
127156
}
128157

spa/src/app/files/project-download-manifest/project-download-manifest.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="downloads">
44
<div class="manifest">
55
<div class="download-progress-indicator">
6-
<div class="download-not-started" (click)="onDownloadMetadata()"
6+
<div class="download-not-started" (click)="onDownloadMetadata(projectTitle)"
77
*ngIf="state.projectTSVUrlNotStarted"></div>
88
<mat-spinner class="hca-spinner"
99
diameter="14"
@@ -14,7 +14,8 @@
1414
<span class="fontsize-s">tsv</span>
1515
<a class="hidden" #download></a>
1616
<copy-to-clipboard *ngIf="state.projectTSVUrlCompleted"
17-
[copyToClipboardLink]="state.projectTSVUrlResponse.fileUrl"></copy-to-clipboard>
17+
[copyToClipboardLink]="state.projectTSVUrlResponse.fileUrl"
18+
(copyClicked)="onDataLinkCopied(projectTitle, state.projectTSVUrlResponse.fileUrl)"></copy-to-clipboard>
1819
</div>
1920
<left-bar>
2021
<data-download-citation></data-download-citation>

spa/src/app/files/project-download-manifest/project-download-manifest.component.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { CopyToClipboardComponent } from "../../shared/copy-to-clipboard/copy-to
1717
import { DataDownloadCitationComponent } from "../data-download-citation/data-download-citation.component";
1818
import { LeftBarComponent } from "../left-bar/left-bar.component";
1919
import { ProjectDownloadManifestComponent } from "./project-download-manifest.component";
20+
import { FileManifestService } from "../shared/file-manifest.service";
2021

2122
describe("ProjectDownloadManifestComponent", () => {
2223

@@ -44,6 +45,16 @@ describe("ProjectDownloadManifestComponent", () => {
4445
{
4546
provide: Store,
4647
useValue: testStore
48+
},
49+
{
50+
provide: FileManifestService,
51+
useValue: jasmine.createSpyObj("FileManifestService", [
52+
"trackRequestCohortManifest",
53+
"trackDownloadCohortManifest",
54+
"trackCopyToClipboardCohortManifestLink",
55+
"trackDownloadProjectManifest",
56+
"trackCopyToClipboardProjectManifestLink"
57+
])
4758
}
4859
]
4960
}).compileComponents();

spa/src/app/files/project-download-manifest/project-download-manifest.component.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { selectProjectTSVUrlsByProjectId } from "../_ngrx/project/project.select
2020
import { ProjectTSVUrlRequestStatus } from "../project/project-tsv-url-request-status.model";
2121
import { ProjectTSVUrlResponse } from "../project/project-tsv-url-response.model";
2222
import { ProjectDownloadManifestState } from "./project-download-manifest.state";
23+
import { SearchTerm } from "../search/search-term.model";
24+
import { FileManifestService } from "../shared/file-manifest.service";
2325

2426
@Component({
2527
selector: "project-download-manifest",
@@ -43,17 +45,31 @@ export class ProjectDownloadManifestComponent implements OnDestroy {
4345
@ViewChild("download" , { static: false }) downloadEl: ElementRef;
4446

4547
/**
48+
* @param {FileManifestService} fileManifestService
4649
* @param {Store<AppState>} store
4750
*/
48-
public constructor(private store: Store<AppState>) {}
51+
public constructor(private fileManifestService: FileManifestService, private store: Store<AppState>) {}
52+
53+
/**
54+
* Track click on copy of manifest data link.
55+
*
56+
* @param {string} projectTitle
57+
* @param {string} manifestUrl
58+
*/
59+
public onDataLinkCopied(projectTitle: string, manifestUrl: string) {
60+
61+
this.fileManifestService.trackCopyToClipboardProjectManifestLink(projectTitle, manifestUrl);
62+
}
4963

5064
/**
5165
* Return the URL to the meta TSV for the specified project.
5266
*
67+
* @param {string} projectTitle
5368
* @returns {string}
5469
*/
55-
public onDownloadMetadata() {
70+
public onDownloadMetadata(projectTitle: string) {
5671

72+
this.fileManifestService.trackDownloadProjectManifest(projectTitle);
5773
this.store.dispatch(new FetchProjectTSVUrlRequestAction(this.projectId, this.projectTitle, this.ngDestroy$));
5874
}
5975

spa/src/app/files/project-metadata/project-metadata.component.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { PROJECT_DETAIL_SINGLE_VALUES } from "../project/hca-project-mapper.mock
2323
import { LeftBarComponent } from "../left-bar/left-bar.component";
2424
import { ProjectDownloadManifestComponent } from "../project-download-manifest/project-download-manifest.component";
2525
import { ProjectMetadataComponent } from "./project-metadata.component";
26+
import { FileManifestService } from "../shared/file-manifest.service";
2627

2728
describe("ProjectMetadataComponent", () => {
2829

@@ -72,6 +73,16 @@ describe("ProjectMetadataComponent", () => {
7273
{
7374
provide: Store,
7475
useValue: testStore
76+
},
77+
{
78+
provide: FileManifestService,
79+
useValue: jasmine.createSpyObj("FileManifestService", [
80+
"trackRequestCohortManifest",
81+
"trackDownloadCohortManifest",
82+
"trackCopyToClipboardCohortManifestLink",
83+
"trackDownloadProjectManifest",
84+
"trackCopyToClipboardProjectManifestLink"
85+
])
7586
}
7687
]
7788
}).compileComponents();

0 commit comments

Comments
 (0)