Logo Innblikk

Innblikk

Tổ chức
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

Tổng quan

Nhà phát hànhnavikt
Kho mãcopilot
Tên kỹ nănginnblikk
Sao
60
Bản fork
16
Tệp đi kèm
1
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được navikt công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Innblikk trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/navikt/copilot/tree/main/skills/innblikk
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Innblikk trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Innblikk ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Innblikk với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Innblikk làm được gì?

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.

Vì sao nên dùng Innblikk trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Innblikk là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Innblikk trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/navikt/copilot/tree/main/skills/innblikk. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Innblikk?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Innblikk với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Innblikk với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Innblikk có miễn phí không?

Có. Kỹ năng này được navikt phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇