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

matomo: make configurable (#65) #66

Merged
merged 30 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
928dc99
matomo: make configurable (#65)
mrustl Sep 11, 2020
332f61c
matomo: make configurable (#65)
mrustl Sep 11, 2020
69a7fab
merge
mrustl Sep 11, 2020
1f63247
matomo: make configurable (#65)
mrustl Sep 11, 2020
79f822a
matomo: make configurable (#65)
mrustl Sep 11, 2020
3851376
fix merge
mrustl Sep 11, 2020
89a2f83
matomo: make configurable (#65)
mrustl Sep 11, 2020
2f54345
Merge branch 'matomo' of https://github.com/kwb-r/pubs into matomo
mrustl Sep 11, 2020
1d04be6
matomo: simplify (#65)
mrustl Sep 11, 2020
ee3ba43
matomo: document "use" parameter (#65)
mrustl Sep 11, 2020
af6fdd5
Merge branch 'matomo' of https://github.com/kwb-r/pubs into matomo
mrustl Sep 11, 2020
285f992
matomo: try not to the "domain" (#65)
mrustl Sep 12, 2020
752a625
matomo: only set cookie_domain (#65)
mrustl Sep 12, 2020
5e7aa03
fix merge conflict
mrustl Sep 12, 2020
ca3eacb
matomo: try regexp pattern (#65)
mrustl Sep 12, 2020
83680d0
fix merge
mrustl Sep 12, 2020
2d3a854
matomo: fix typo (#65)
mrustl Sep 12, 2020
b94bb8e
matomo: fix regexp (#65)
mrustl Sep 12, 2020
081706b
matomo: do not use "domain" on "dev" (#65)
mrustl Sep 13, 2020
754fafd
quick fix for ".js-cite-modal" bug (#67)
mrustl Sep 14, 2020
40fe45c
matomo: force links and downloads to be detected
mrustl Sep 14, 2020
0756a5b
cite: try long-term fix (#67)
mrustl Sep 14, 2020
9e74f44
fix typo
mrustl Sep 14, 2020
c281ffc
improve formatting
mrustl Sep 14, 2020
871276e
rollback to bug (#67) as defining css class
mrustl Sep 14, 2020
f1316c4
cite: rollback to simple solution (#67)
mrustl Sep 14, 2020
75de0e8
matomo: track more links
mrustl Sep 14, 2020
f7def82
algolia: improve analytics tracking
mrustl Sep 14, 2020
a4b5842
matomo: add "trackPageView" again
mrustl Sep 14, 2020
6dabcdb
matomo: simplify (remove search count)
mrustl Sep 14, 2020
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
13 changes: 7 additions & 6 deletions assets/js/algolia-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ search.addWidgets([
]);
window._paq.push(['trackPageView']);
},
delay: 5000,
triggerOnUIInteraction: true,
pushPagination: true,
}),
Expand Down Expand Up @@ -238,7 +239,7 @@ search.addWidgets([
const base_url = '';
const abstract_id = 'abstract-' + data.__hitIndex + 1;
const authors_link = data.author.map(
(a) => '<a href="?author=' + a + '">'
(a) => '<a class="piwik_link" href="?author=' + a + '">'
);
const authors_name = data._highlightResult.author.map(
(a) => a.value + '</a>'
Expand All @@ -250,7 +251,7 @@ search.addWidgets([
if (data.project !== null) {
const project_link = data.project.map(
(p) =>
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm" href="?project=' +
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm piwik_link" href="?project=' +
p +
'">' +
data.project_btn +
Expand All @@ -266,16 +267,16 @@ search.addWidgets([
.join(' ');
}
const cite =
'<button class="btn btn-outline-primary my-1 mr-1 btn-sm js-cite-modal" type="button" data-filename="' +
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm matomo_download" href="' +
base_url +
data.cite_link +
'">' +
i18n.btn_cite +
'</button>';
'</a>';
let pdf = '';
if (data.pdf !== '') {
pdf +=
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm" href="' +
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm matomo_download" href="' +
base_url +
data.pdf +
'" target="_blank" rel="noopener">' +
Expand All @@ -285,7 +286,7 @@ search.addWidgets([
let doi = '';
if (data.doi !== null) {
doi +=
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm" href="' +
'<a class="btn btn-outline-primary my-1 mr-1 btn-sm piwik_link" href="' +
'https://doi.org/' +
data.doi +
'" target="_blank" rel="noopener">DOI</a>';
Expand Down
9 changes: 9 additions & 0 deletions config/dev/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@
app_id = "QX11QSLZ03"
api_key = "37359fae126eefbab1d9a39a13baaa95"
index_name = "dev_kwb_en_pubs"

[matomo]
use = 1 # 1: to enable tracking 0: no tracking
url = "https://matomo.datenhelden.com/"
php = "matomo.php"
js = "matomo.js"
site_id = 8
# cookie_domain = ".*kwb.netlify.app"
# domains = "*.kwb.netlify.app"
9 changes: 9 additions & 0 deletions config/production/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@
app_id = "QX11QSLZ03"
api_key = "37359fae126eefbab1d9a39a13baaa95"
index_name = "prod_kwb_en_pubs"

[matomo]
use = 1 # 1: to enable tracking 0: no tracking
url = "//piwik.kompetenzwasser.de/"
php = "piwik.php"
js = "piwik.js"
site_id = 1
cookie_domain = "*.kompetenz-wasser.de"
domains = "*.kompetenz-wasser.de"
27 changes: 21 additions & 6 deletions layouts/partials/custom_head.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
{{ if eq site.Params.matomo.use 1}}
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
{{ if site.Params.matomo.cookie_domain }}
_paq.push(["setCookieDomain", {{site.Params.matomo.cookie_domain}});
{{ end }}
{{ if site.Params.matomo.domains }}
_paq.push(["setDomains", {{site.Params.matomo.domains}}]);
{{ end }}
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://matomo.datenhelden.com/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '8']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
var u="{{site.Params.matomo.url}}";
_paq.push(['setTrackerUrl', u+'{{site.Params.matomo.php}}']);
_paq.push(['setSiteId', '{{site.Params.matomo.site_id}}']);
var d = document
, g = d.createElement('script')
, s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.defer = true;
g.src = u + '{{site.Params.matomo.js}}';
s.parentNode.insertBefore(g, s);
}
)();
</script>
<!-- End Matomo Code -->
{{ end }}
2 changes: 1 addition & 1 deletion layouts/partials/page_author_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{ end }}

<div class="media-body">
<h5 class="card-title"><a href='{{ "publication/" | relLangURL }}?author={{.Params.name}}'>{{.Params.name}}</a></h5>
<h5 class="card-title"><a class="piwik_link" href='{{ "publication/" | relLangURL }}?author={{.Params.name}}'>{{.Params.name}}</a></h5>
{{ with .Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}}
{{ with .Params.bio }}<p class="card-text">{{. | markdownify | emojify}}</p>{{end}}
{{ partial "social_links" . }}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/page_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
{{ end }}

{{ with $pdf }}
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener">
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} matomo_download" href="{{ . }}" target="_blank" rel="noopener">
{{ i18n "btn_pdf" }}
</a>
{{ end }}
{{ $resource := $page.Resources.GetMatch "cite.bib" }}
{{ with $resource }}
<button type="button" class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} js-cite-modal"
<button type="button" class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} js-cite-modal piwik_link"
data-filename="{{ .RelPermalink }}">
{{ i18n "btn_cite" }}
</button>
Expand Down Expand Up @@ -61,7 +61,7 @@
{{ if $page.Params.projects }}
{{ range $page.Params.projects }}
{{ with . }}
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href='{{"publication/"| relLangURL }}?project={{.}}'>
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} piwik_link" href='{{"publication/"| relLangURL }}?project={{.}}'>
{{ i18n "btn_project" }}: {{.}}
</a>
{{ else }}
Expand Down Expand Up @@ -128,7 +128,7 @@
</a>
{{ end }}
{{ with $page.Params.doi }}
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="https://doi.org/{{ . }}" target="_blank" rel="noopener">
<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} piwik_link" href="https://doi.org/{{ . }}" target="_blank" rel="noopener">
DOI
</a>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/page_metadata_authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{- if gt $index 0 }}, {{ end -}}
<span>
{{- if and $profile_page $link_authors -}}
<a href='{{ "publication/" | relLangURL }}?author={{$name}}'>{{$name}}</a>
<a class="piwik_link" href='{{ "publication/" | relLangURL }}?author={{$name}}'>{{$name}}</a>
{{- else -}}
{{$name}}
{{- end -}}
Expand Down
52 changes: 26 additions & 26 deletions layouts/section/publication.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{{- define "main" -}}

<div class="ais-InstantSearch">
<div class="left-panel">
<div id="clear-refinements"></div>
<!-- <button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" >Show abstracts</button>-->
<button type="button" class="btn btn-info" data-toggle="collapse" data-target=".multi-collapse">Abstracts (show/hide)</button>
<br></br>
<h4>{{i18n "publication_type"}}</h4>
<div id="pubs-list"></div>
<h4>{{i18n "year"}}</h4>
<p id="year-list"></p>
<h4>{{i18n "author"}}</h4>
<p id="author-list"></p>
<h4>{{i18n "project"}}</h4>
<p id="project-list"></p>
<div class="ais-InstantSearch">
<div class="left-panel">
<div id="clear-refinements"></div>
<!-- <button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" >Show abstracts</button>-->
<button type="button" class="btn btn-info" data-toggle="collapse" data-target=".multi-collapse">Abstracts (show/hide)</button>
<br></br>
<h4>{{i18n "publication_type"}}</h4>
<div id="pubs-list"></div>
<h4>{{i18n "year"}}</h4>
<p id="year-list"></p>
<h4>{{i18n "author"}}</h4>
<p id="author-list"></p>
<h4>{{i18n "project"}}</h4>
<p id="project-list"></p>
</div>
<div class="right-panel">
<div id="current-refinements"></div>
<div id="searchbox" class="ais-SearchBox"></div>
<div id="search-container-top" class="search-top">
<span id="stats" class="box1"></span>
<span id="powered-by" class="box2"></span>
<span id="hits-per-page" class="box3"></span>
</div>
<div class="right-panel">
<div id="current-refinements"></div>
<div id="searchbox" class="ais-SearchBox"></div>
<div id="search-container-top" class="search-top">
<span id="stats" class="box1"></span>
<span id="powered-by" class="box2"></span>
<span id="hits-per-page" class="box3"></span>
</div>
<div id="hits" class="full-width"></div>
<div id="pagination"></div>
</div>
</div>
<div id="hits" class="full-width"></div>
<div id="pagination"></div>
</div>
</div>

{{- end -}}