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: GTM configuration #92

Merged
merged 1 commit into from
Dec 17, 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
2 changes: 2 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:

- name: Build documentation
run: make build
env:
GTM_ID: ${{ secrets.GTM_ID }}

- name: Configure AWS Credentials if S3 deploying is enabled
# Giving this step a name so we can check later if we need to deploy to GitHub Pages instead.
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ extra_javascript:

extra:
homepage: !ENV [SITE_HOME, 'https://developers.eveonline.com/']
analytics:
provider: custom
property: !ENV [GTM_ID, 'GTM-XXXXXXX']

plugins:
- search
Expand Down
20 changes: 20 additions & 0 deletions overrides/partials/integrations/analytics/custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Google Tag Manager -->
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != "dataLayer" ? "&l=" + l : "";
j.async = true;
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
f.parentNode.insertBefore(j, f);
})(
window,
document,
"script",
"dataLayer",
"{{ config.extra.analytics.property }}"
);
</script>
<!-- End Google Tag Manager -->
14 changes: 14 additions & 0 deletions overrides/partials/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "base.html" %}

{% block scripts %} {{ super() }}
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id={{ config.extra.analytics.property }}"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
<!-- End Google Tag Manager (noscript) -->
{% endblock %}
Loading