Skip to content

Commit 02c6672

Browse files
MillenniumFalconMechanicNoopDog
authored andcommitted
Added tracking to release file URL copy to clipboard. Resolves #1067. (#1151)
1 parent f881465 commit 02c6672

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

spa/src/app/files/releases/release-files-modal/release-files-modal.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ <h4 class="fontsize-l" [ngClass]="{'singleDataset': state.singleDataset}">
3232
</ng-container>
3333
<ng-container matColumnDef="copyLink">
3434
<mat-cell *matCellDef="let element" class="copy-to-clipboard fontsize-xxs">
35-
<copy-to-clipboard [copyToClipboardLink]="getReleaseFileUrl(element.url)"></copy-to-clipboard>
35+
<copy-to-clipboard [copyToClipboardLink]="getReleaseFileUrl(element.url)"
36+
(copyClicked)="trackReleaseFileUrlCopied(state.releaseDataset, element)"></copy-to-clipboard>
3637
</mat-cell>
3738
</ng-container>
3839
<mat-row *matRowDef="let row; columns: columnsToDisplay;"></mat-row>

spa/src/app/files/releases/release-files-modal/release-files-modal.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ export class ReleaseFilesModalComponent implements OnDestroy, OnInit {
136136
});
137137
}
138138

139+
/**
140+
* Track copy to clipboard of release file URL.
141+
*
142+
* @param {string} releaseDatasetView
143+
* @param {ReleaseDatasetView} releaseFile
144+
*/
145+
public trackReleaseFileUrlCopied(releaseDatasetView: ReleaseDatasetView, releaseFile: ReleaseFileView): void {
146+
147+
this.gtmService.trackEvent(GACategory.DATASET, GAAction.COPY_TO_CLIPBOARD, releaseDatasetView.datasetId, {
148+
[GADimension.ENTITY_URL]: this.getReleaseFileUrl(releaseFile.url),
149+
[GADimension.FILE_TYPE]: releaseFile.type,
150+
[GADimension.FILE_FORMAT]: releaseFile.extension,
151+
[GADimension.FILE_NAME]: releaseFile.url,
152+
[GADimension.RELEASE_NAME]: ReleaseName.RELEASE_2020_MAR
153+
});
154+
}
155+
139156
/**
140157
* Create model of dataset to back modal. The specified release is expected to have a single project containing a
141158
* single dataset; the dataset we want to display.

0 commit comments

Comments
 (0)