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

add corresponding dataset page to download file and outbound click tables #374

Merged
merged 1 commit into from
Dec 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions _data/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ const REPORTS = {
title: "Most Downloaded Dataset Files",
description: "Top 10 downloaded files from dataset pages",
url: "download_requests__last30.[end_date].csv",
columnKeys: ["linkUrl", "eventCount"]
columnKeys: ["linkUrl", "pageTitle", "eventCount"]
},
MOST_CLICKED_OUTBOUND_LINKS: {
title: "Most Clicked Outbound Links",
description: "Top 10 external link clicks from dataset pages",
url: "link_requests__last30.[end_date].csv",
columnKeys: ["linkUrl", "eventCount"]
columnKeys: ["linkUrl", "pageTitle", "eventCount"]
}
}
}
Expand All @@ -64,6 +64,7 @@ const ENUMS = {
"deviceCategory": "Device Category",
"activeUsers": "Users",
"searchTerm": "Search Term",
"pageTitle": "Title",
"eventCount": "Count",
"organization": "Organization",
"count": "Count",
Expand Down
7 changes: 7 additions & 0 deletions pages/metrics/metrics_per-org.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ <h4>{{block.meta.title}}</h4>
<td><a href="{{column}}">{{column}}</a></td>
{%- endif -%}

{%- else -%}
{%- assign pageURL = 5 -%}
{%- if block.data[0][forloop.index0] == "pageTitle" -%}
<td align="right">
<a href="{{row[pageURL]}}" target="_blank">{{column | toLocaleString | replace: " - Catalog", ""}}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this line doing exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the current column in row corresponds to the pageTitle column then add the original catalog page ( row[pageURL] ) the file was clicked on as a hyperlink with some string munging. i created the pageURL var to stand out and describe what the index represents rather than just doing row[5]. I can try to change this to make it more readable. frankly i'm not super familiar with templating languages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i derive the dataset title from the html title using the pageTitle GA dimension which includes " - Catalog" at the end

Copy link
Contributor

Choose a reason for hiding this comment

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

i derive the dataset title from the html title using the pageTitle GA dimension which includes " - Catalog" at the end

the string replace was the part that got me. i guess we do it for every dataset so i expect it's fine.

</td>
{%- else -%}
<td align="right">{{column | toLocaleString}}</td>
{%- endif -%}
{%- endif -%}
{%- endif -%}
{% endfor %}
</tr>
{% endfor %}
Expand Down
Loading