> For the complete documentation index, see [llms.txt](https://docs.revenium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revenium.io/track-and-control-costs/analyze-ai-tooling-spend/gitlab-integration.md).

# GitLab Integration

GitLab is supported for version-control attribution alongside GitHub. Connecting GitLab to Revenium adds output data — the merge requests your developers ship — to your AI coding metrics. Without a version-control integration, the dashboards measure AI assistant activity: sessions, tokens, cost. With GitLab connected, you can cross-reference that spend against what developers actually deliver, attributing merged merge requests to AI-assisted commits per developer.

Teams that host their code on GitLab now get merge-request attribution and per-user coding metrics, the same way GitHub-hosted teams get pull-request attribution.

## What connecting GitLab adds

Once connected, Revenium builds a per-developer GitLab merge-request table. Each row maps a GitLab user to a Revenium user and shows:

| Column              | Description                                                                           |
| ------------------- | ------------------------------------------------------------------------------------- |
| **GitLab User**     | The GitLab username the activity belongs to                                           |
| **MRs Merged**      | Total merge requests merged by this user in the selected period                       |
| **MRs with Claude** | Merge requests where at least one commit matches your AI co-author detection patterns |
| **Mapped Email**    | The Revenium user this GitLab user is mapped to, by commit email                      |

These let you ask: are high-spend developers also shipping the most? Which developers are getting the most delivered per dollar of AI spend?

## Prerequisites

* A GitLab personal access token with `read_api` and `read_user` scopes
* The GitLab group that contains the projects you want to track
* Developer commit emails that map to Revenium users, so per-developer activity can be attributed

## Setting up the integration

Add GitLab from the Integrations page: open the GitLab card and choose to connect, which opens the **Connect GitLab** dialog. The dialog asks for:

* **Name** — a label for the credential (for example, `my-company-gitlab`).
* **GitLab instance URL** — leave the default for gitlab.com, or enter your self-managed instance URL (for example, `https://gitlab.company.com`).
* **Group path** — the GitLab group containing your repositories (for example, `my-company` or `my-company/engineering`).
* **Personal access token** — a token with `read_api` and `read_user` scopes (`glpat-...`). The token is validated against GitLab before being stored, encrypted at rest, and never returned through the API.
* **Allowed projects** (optional) — restrict the integration to specific projects in `group/project` format, one per line. Leave empty to scan all projects in the group. Useful when your token has broad access but you only want merge-request data from selected projects.
* **AI co-author detection patterns** — see below.

## AI co-author detection patterns

Revenium identifies AI-assisted commits by matching patterns against the Co-Authored-By lines in commits. A merge request counts toward **MRs with Claude** when at least one of its commits matches a configured pattern. The default detects the standard Claude Code signature:

```
noreply@anthropic.com
```

Add additional patterns, one per line, if your team uses different signatures.

## Attribution across GitHub and GitLab

Both GitHub and GitLab are supported for version-control attribution. If your developers ship across both, connect each one: GitHub contributes pull-request attribution and GitLab contributes merge-request attribution, each matched to Revenium users by developer commit email.

## Troubleshooting

**No GitLab data appears after connecting:**

* The table reads "No GitLab merge request data available for this period" until a sync completes for the selected period — allow time for the initial sync
* Confirm the token is valid and carries the `read_api` and `read_user` scopes
* Confirm the Group path is correct and the token can read that group's projects

**MRs with Claude count is lower than expected:**

* A merge request counts only if at least one commit matches a Co-Authored-By detection pattern — not all coding-assistant sessions produce these, so check the commits in those merge requests
* If you set Allowed projects, confirm the merge requests you expect are in the listed projects

**A developer isn't attributed:**

* The Mapped Email links a GitLab user to a Revenium user. If a developer's commit email doesn't match a Revenium user, their activity won't be attributed — confirm the email mapping


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.revenium.io/track-and-control-costs/analyze-ai-tooling-spend/gitlab-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
