Simple Analytics Embed
Go to legacy embed.
Include this code somewhere on your page. This loads the library to show
charts on your website. It looks for elements that you specify in
data-chart-selectors
:
<!-- Privacy-friendly Simple Analytics chart -->
<script
src="https://scripts.simpleanalyticscdn.com/embed.js"
data-chart-selectors="#chart-id,.chart-class"
></script>
In the script above we specify two charts: #chart-id
and
.chart-class
. These selectors are directly passed to
querySelectorAll
.
First chart #chart-id
<div
id="chart-id"
data-hostname="remoteok.com"
></div>
Second chart .chart-class
<script>
function onLoad(ok) {
if (ok) console.log("All charts loaded successfully");
else {
// Hide all elements that show charts
// ...
}
}
</script>
<div
class="chart-class"
style="aspect-ratio: 2/1"
data-hostname="remoteok.com"
data-start="2020-11-11"
data-end="2021-11-11"
data-types="visitors"
data-page-views-selector="#pageviews"
data-visitors-selector=".visitors"
data-y-max="60000"
data-timezone="Europe/Amsterdam"
data-border-width="1"
data-text-color="#ff6600"
data-page-views-color="#ff6600"
data-visitors-color="#cc2200"
data-area-opacity="10"
data-show-logo="true"
></div>
RemoteOK had ... page views and … visitors in the last year.