Skip to content

Commit

Permalink
try to set up google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
mirandachrist committed Jun 19, 2019
1 parent e4c0464 commit 7cc9fb9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@bazel/typescript": "^0.30.2",
"@types/color": "^3.0.0",
"@types/google.visualization": "^0.0.43",
"@types/gtag.js": "^0.0.0",
"@types/jasmine": "~3.3.13",
"@types/pako": "^1.0.1",
"jasmine": "~3.4.0",
Expand Down
1 change: 1 addition & 0 deletions prow/cmd/deck/static/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ts_library(
":api",
":common",
":histogram",
"@npm//@types/gtag.js",
"@npm//moment",
],
)
Expand Down
5 changes: 4 additions & 1 deletion prow/cmd/deck/static/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,16 @@ export namespace tooltip {
}

export namespace icon {
export function create(iconString: string, tip: string = ""): HTMLAnchorElement {
export function create(iconString: string, tip: string = "", onClick?: (this: HTMLElement, ev: MouseEvent) => any): HTMLAnchorElement {
const i = document.createElement("i");
i.classList.add("icon-button", "material-icons");
i.innerHTML = iconString;
if (tip !== "") {
i.title = tip;
}
if (onClick) {
i.addEventListener("click", onClick);
}

const container = document.createElement("a");
container.appendChild(i);
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/deck/static/prow/prow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ function createRerunCell(modal: HTMLElement, rerunElement: HTMLElement, prowjob:

function createViewJobCell(prowjob: string): HTMLTableDataCellElement {
const c = document.createElement("td");
const i = icon.create("pageview", "Show job YAML");
const i = icon.create("pageview", "Show job YAML", () => gtag("event", "view_job_yaml", {event_category: "engagement", transport_type: "beacon"}));
i.href = `https://${window.location.hostname}/prowjob?prowjob=${prowjob}`;
c.classList.add("icon-cell");
c.appendChild(i);
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
version "0.0.43"
resolved "https://registry.yarnpkg.com/@types/google.visualization/-/google.visualization-0.0.43.tgz#d4172f94292b68a49a5666033386ce177f0ead9d"

"@types/gtag.js@^0.0.0":
version "0.0.0"
resolved "https://registry.yarnpkg.com/@types/gtag.js/-/gtag.js-0.0.0.tgz#9ae744b83de4f3f975ef8abf99c979d21ce31fd4"
integrity sha512-CELflfjpDL6pthp74HVpNWn19Uv/qopdPZ6J85hKl1zCxUVJ7fMEaTtr3PTRA3oMvj2hMOQdChbUBH/F4XwLCQ==

"@types/jasmine@~3.3.13":
version "3.3.13"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-3.3.13.tgz#d5daabb0af47bcddee40597acf6e804433bab439"
Expand Down

0 comments on commit 7cc9fb9

Please sign in to comment.