diff --git a/assets/js/src/marlin.js b/assets/js/src/marlin.js
new file mode 100644
index 000000000000..7ee4cd7017eb
--- /dev/null
+++ b/assets/js/src/marlin.js
@@ -0,0 +1,19 @@
+import { Marlin, Environment } from "@docker/marlin-sdk-web-public";
+
+const config = window.__marlinConfig;
+
+if (config && config.apiKey && config.endpoint) {
+ try {
+ window.marlin = new Marlin({
+ endpoint: config.endpoint,
+ apiKey: config.apiKey,
+ site: "docs",
+ environment:
+ config.environment === "staging"
+ ? Environment.STAGING
+ : Environment.PROD,
+ });
+ } catch (err) {
+ console.warn("Marlin SDK init failed:", err);
+ }
+}
diff --git a/hugo.yaml b/hugo.yaml
index 7cfa0c7e100f..c84d29fff309 100644
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -142,6 +142,14 @@ params:
google: GTM-WL2QLG5
onetrust: 65425fb0-7b36-4317-9f10-7b3e08039af0
vwo: 723167
+ marlin:
+ # Public-write API keys for the Marlin analytics SDK.
+ apiKey:
+ prod: mrl_2nuEKUo5bzRv8GcDKeYjij4J4U--OLdN
+ stage: mrl_W14SGEQ7nYmBsAyjZPyOM-nlgE53E-vX
+ endpoint:
+ prod: https://marlin-2.docker.com
+ stage: https://marlin-2-stage.docker.com
# Docs repository URL
repo: https://github.com/docker/docs
diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html
index 113151d7a6c8..d6736c2bac90 100644
--- a/layouts/_partials/head.html
+++ b/layouts/_partials/head.html
@@ -67,6 +67,29 @@
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
{{ end }}
+{{- with site.Params.analytics.marlin -}}
+ {{- $apiKey := "" -}}
+ {{- $endpoint := "" -}}
+ {{- $env := "" -}}
+ {{- if hugo.IsProduction -}}
+ {{- $apiKey = .apiKey.prod -}}
+ {{- $endpoint = .endpoint.prod -}}
+ {{- $env = "prod" -}}
+ {{- else if eq hugo.Environment "staging" -}}
+ {{- $apiKey = .apiKey.stage -}}
+ {{- $endpoint = .endpoint.stage -}}
+ {{- $env = "staging" -}}
+ {{- end -}}
+ {{- if and $apiKey $endpoint -}}
+
+ {{- end -}}
+{{- end -}}
{{/* preload Roboto Flex as it's a critical font: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload */}}