Innblikk 标志

Innblikk

组织
navikt
innblikk

Sett opp Innblikk (Team ResearchOps' nettstatistikk, basert på Umami) i en Nav-app som ikke bruker dekoratøren. Bruk når et team vil telle sidevisninger med sporing.js, trenger samtykke etter ekomloven, CSP for Innblikk, en before-send-hook som holder private sider ute, eller vil sjekke en eksisterende Innblikk-integrasjon. Bruker appen dekoratøren, bruk nav-dekoratoren i stedet.

Add to TypingMind

概览

发布者navikt
代码仓库copilot
技能名称innblikk
星标数
60
复刻数
16
附带文件
1
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 navikt 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Innblikk AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/navikt/copilot/tree/main/skills/innblikk
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/navikt/copilot.git /tmp/copilot
mkdir -p .claude/skills
cp -r /tmp/copilot/skills/innblikk .claude/skills/innblikk
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Innblikk,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Innblikk。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Innblikk 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Innblikk without dekoratøren

Innblikk is Team ResearchOps' web analytics, based on Umami. It was called Umami Start before. Apps that use Nav Dekoratøren already get Innblikk through it, with consent handled. For those, use the nav-dekoratoren skill instead. This skill is for apps that load the script themselves.

Slack: #researchops Worked example: apps/my-copilot in navikt/copilot (ki-utvikling.nav.no)

Step 1: Tracking code and approval

  1. Get a tracking code (website ID) from https://innblikk.ansatt.nav.no/sporingskoder, or ask in #researchops on Slack.
  2. Before prod: fill in the reusable Innblikk etterlevelsesdokument (linked from the "Kom i gang" page on innblikk.ansatt.nav.no) and describe the use on the app's privacy page.

The website ID is public: it ends up in the page HTML. Pass it in as a runtime environment variable, so it can be switched on and off without a rebuild:

yaml
# .nais/app.yaml (Handlebars template, values per environment)
env:
  {{#if innblikk_website_id}}
  - name: INNBLIKK_WEBSITE_ID
    value: "{{innblikk_website_id}}"
  {{/if}}

Render nothing when the variable is unset.

Step 2: The script tag

Use this exact URL: https://cdn.nav.no/team-researchops/sporing/sporing.js.

html
<script
  defer
  src="https://cdn.nav.no/team-researchops/sporing/sporing.js"
  data-website-id="YOUR-WEBSITE-ID"
  data-domains="minapp.nav.no"
  data-exclude-search="true"
  data-do-not-track="true"
  data-before-send="innblikkBeforeSend"
></script>
AttributeEffect in sporing.js
data-website-idThe tracking code. No ID, no sends.
data-domainsComma-separated hostnames. On any other host nothing is sent. Set only the prod host, so dev and preview send nothing.
data-exclude-search="true"Strips the query string from the URL and referrer. The hash is kept.
data-do-not-track="true"Respects the browser's Do Not Track setting.
data-before-sendName of a function on window. It gets (type, payload) before every send. Return the payload to send it, or a falsy value to cancel.

The script also reads data-tag, data-auto-track, data-fetch-credentials (default omit) and data-opt-out-filters. Do not use attributes beyond these. It ignores them.

Behaviour to know before writing the hook:

  • Page views are sent on load, and about 300 ms after a history.pushState/replaceState that changes the URL, so client-side navigation is tracked once the script is loaded. Back and forward (popstate) are not tracked.
  • On navigation, referrer is the previous URL in the app. On first load it is document.referrer, or empty when that is the same origin.
  • The hash stays in url and referrer.
  • Clicks on elements with data-umami-event or data-sporing-event attributes send custom events; every data-umami-event-<key> attribute on the element is sent as event data, and the hook below passes name and data through unchanged. Never put personal data in them, and do not add the attributes at all if the app counts page views only.

The before-send hook

Define it on window before the script loads. sporing.js looks up window[name] at every send, which is why withdrawn consent takes effect without a reload. It must drop private pages, drop private referrers and strip the hash:

ts
export function innblikkBeforeSend(_type: string, payload: { url?: string; referrer?: string }) {
  if (readConsent() !== true) return false; // withdrawn consent stops sends without a reload
  const path = (u: string) => decodePath(new URL(u, location.href).pathname);
  if (!payload.url || isPrivatePath(path(payload.url))) return false;
  const noHash = (u?: string) => u?.split("#")[0];
  const referrer = payload.referrer && !isPrivatePath(path(payload.referrer)) ? noHash(payload.referrer) : undefined;
  return { ...payload, url: noHash(payload.url), referrer };
}
if (typeof window !== "undefined") {
  (window as unknown as Record<string, unknown>).innblikkBeforeSend = innblikkBeforeSend;
}

decodePath is decodeURIComponent with a fallback, so /%61dmin counts as /admin. Use the same private-path list that your access control enforces, so a new protected page is excluded automatically.

Step 3: Consent

Analytics storage and reading on the user's device needs consent under ekomloven § 3-15. This is the reason for the flow below, not legal advice. Ask your privacy contact if in doubt.

  • Load nothing before an explicit yes: no script tag, no request to cdn.nav.no.
  • Show a yes button and a no button with the same size and style.
  • Store the choice locally with a version and a date, for example in localStorage as { analytics: true, version: 1, at: "2026-10-31T09:00:00.000Z" }. Treat an unknown version as no choice.
  • On no or withdrawal, set both umami.disabled and sporing.disabled in localStorage. sporing.js checks both before every send. On yes, remove them.
  • sporing.js also checks the flags once at load. If a flag is set then, it never installs its navigation hooks, so remove the flags before loading the script, as setConsent does.
  • Make withdrawal as easy as consent, for example with the same two buttons on the privacy page.
ts
export function setConsent(analytics: boolean) {
  localStorage.setItem(CONSENT_KEY, JSON.stringify({ analytics, version: 1, at: new Date().toISOString() }));
  for (const flag of ["umami.disabled", "sporing.disabled"]) {
    if (analytics) localStorage.removeItem(flag);
    else localStorage.setItem(flag, "1");
  }
  window.dispatchEvent(new Event(CONSENT_EVENT));
}

The reference (innblikk-consent.ts) wraps the storage calls in try/catch. Do the same: if storage throws, keep the choice in memory for the page load so the banner does not come back on every render.

Step 4: CSP and Referrer-Policy

text
script-src  'self' https://cdn.nav.no/team-researchops/sporing/sporing.js
connect-src 'self' https://reops-event-proxy.nav.no
  • Allow the exact script URL, not all of cdn.nav.no.
  • sporing.js posts to https://reops-event-proxy.nav.no/api/send. On hosts containing .dev.nav.no or .dev.intern.nav.no it posts to https://reops-event-proxy.ekstern.dev.nav.no instead. Add that host to connect-src in dev only if dev should send.
  • Set Referrer-Policy: strict-origin-when-cross-origin, so the full URL with query string is not sent in the Referer header to cdn.nav.no and the event proxy.

Step 5: Data rules

  • Page views only.
  • No personal data in events, page titles or query strings. The title is sent with every page view.
  • Never load the script on logged-in or admin pages, and cancel events from them in the hook.
  • Do not call identify() (window.umami.identify / window.sporing.identify). The id is attached to every later event.
  • Tracking free-text or search content is out of scope here. Ask #researchops and your privacy contact first.

Framework notes

Next.js App Router

  • A client component ("use client") renders the banner or the script with next/script (strategy="afterInteractive").
  • Read the choice with useSyncExternalStore and an undefined server snapshot, so the server HTML has neither the banner nor the script.
  • Read process.env.INNBLIKK_WEBSITE_ID in a server component that renders per request, and pass it as a prop. A NEXT_PUBLIC_ variable would be baked in at build time.
  • Assign window.innblikkBeforeSend at module scope in the client component, so it exists before sporing.js runs. Guard it with typeof window !== "undefined", because the module also runs on the server.
  • Set CSP and Referrer-Policy in headers() in next.config.ts.

Plain HTML and other frameworks

Define window.innblikkBeforeSend first. After a yes, inject the tag:

js
const s = document.createElement("script");
s.src = "https://cdn.nav.no/team-researchops/sporing/sporing.js";
Object.entries({
  websiteId: "YOUR-WEBSITE-ID",
  domains: "minapp.nav.no",
  excludeSearch: "true",
  doNotTrack: "true",
  beforeSend: "innblikkBeforeSend",
}).forEach(([k, v]) => (s.dataset[k] = v));
document.head.appendChild(s);

Step 6: Verify

Headless browser (Playwright or similar) against prod or a host listed in data-domains. Record every request:

CaseExpected
Before a choiceNo request to cdn.nav.no or reops-event-proxy
After yessporing.js returns 200, POST /api/send returns 2xx (201 in a headless check on ki-utvikling.nav.no, 2026-10-31)
After no, then navigateNo new /api/send
Private page, consent givenNo script tag, no /api/send

Unit tests with controls. Every negative test needs a positive control in the same setup, or it passes when nothing renders at all. Examples from my-copilot:

  • No ID renders nothing; control: the same page with an ID renders the script.
  • No sends from a private page; control: a public page passes the hook.
  • No sets the opt-out flags and never loads the script; control: yes loads it.
  • The hook strips the hash; control: a plain URL is unchanged.
  • A private referrer is dropped; control: a public referrer is kept.

Mock next/script as a plain <script> so the render is observable.

Worked example: my-copilot

In navikt/copilot:

  • apps/my-copilot/src/components/innblikk.tsx: script tag, banner, innblikkBeforeSend, the withdrawal control for the privacy page.
  • apps/my-copilot/src/lib/innblikk-consent.ts: consent store and opt-out flags.
  • apps/my-copilot/src/lib/private-paths.ts: the private paths shared with access control.
  • apps/my-copilot/src/components/site-shell.tsx: passes INNBLIKK_WEBSITE_ID at runtime.
  • apps/my-copilot/next.config.ts: CSP and Referrer-Policy.
  • apps/my-copilot/.nais/app.yaml, prod-gcp.yaml, dev-gcp.yaml: how the ID gets in.
  • apps/my-copilot/src/components/innblikk.test.tsx: tests with controls.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Innblikk AI 技能有什么作用?

Sett opp Innblikk (Team ResearchOps' nettstatistikk, basert på Umami) i en Nav-app som ikke bruker dekoratøren. Bruk når et team vil telle sidevisninger med sporing.js, trenger samtykke etter ekomloven, CSP for Innblikk, en before-send-hook som holder private sider ute, eller vil sjekke en eksisterende Innblikk-integrasjon. Bruker appen dekoratøren, bruk nav-dekoratoren i stedet.

为什么在 TypingMind 中使用 Innblikk?

因为您只需安装一次,就能搭配任何模型使用。Innblikk 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Innblikk?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/navikt/copilot/tree/main/skills/innblikk。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Innblikk?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Innblikk 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Innblikk 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Innblikk AI 技能免费吗?

是的。navikt 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇