Skip to content

Commit

Permalink
[SPARK-45428][PYTHON][DOCS] Add Matomo analytics to pyspark docs pages
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
The pr aims to add Matomo analytics to pyspark  docs pages.

### Why are the changes needed?
After [SPARK-45286](https://issues.apache.org/jira/browse/SPARK-45286), We have added `Matomo analytics` functionality to `non pyspark documents`, and now we need to add the same logic to `pyspark documents`.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Manually test.
By comparing the content of HTML documents generated `before` and `after` the patch
<img width="832" alt="image" src="https://github.com/apache/spark/assets/15246973/9db1bbb3-70ca-4014-8685-e8cafc2eb4c2">

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #43454 from panbingkun/SPARK-45428.

Authored-by: panbingkun <pbk1982@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
panbingkun authored and HyukjinKwon committed Oct 20, 2023
1 parent 6953b00 commit 63bfc10
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions python/docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends "!layout.html" %}

{%- block extrahead %}
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="{{ language }}">
{% for favicon in theme_favicons %}
{% if favicon.href[:4] == 'http'%}
<link rel="{{ favicon.rel }}" sizes="{{ favicon.sizes }}" href="{{ favicon.href }}">
{% else %}
<link rel="{{ favicon.rel }}" sizes="{{ favicon.sizes }}" href="{{ pathto('_static/' + favicon.href, 1) }}">
{% endif %}
{% endfor %}

<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '40']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
{% endblock %}

0 comments on commit 63bfc10

Please sign in to comment.