Integrate AppNavi in Tableau
This guide describes how to integrate AppNavi with Tableau through the AppNavi browser extension and associate usage events with the currently signed-in Tableau user.
Both Tableau Cloud and Tableau Server, including on-premises deployments, are supported for browser-based usage monitoring.
No AppNavi loader script, separate Tableau API authentication, or modification of the Tableau application is required.
Integration Overview
The AppNavi browser extension loads AppNavi on Tableau pages configured in the AppNavi Portal.
Application-level Custom Code retrieves the internal Tableau User ID of the currently signed-in user and passes it to AppNavi Insights using customField_1.
The User ID is cached in the browser's session storage to minimize additional requests to Tableau and make the identifier available as early as possible on subsequent page loads.
This enables organizations to combine AppNavi Insights data with Tableau user and license information without transferring usernames or email addresses to AppNavi.
AppNavi Integration Options Overview
| Tableau Environment | Access Method | Supported |
|---|---|---|
| Tableau Cloud | Web Browser | Yes |
| Tableau Server (On-Premises) | Web Browser | Yes |
| Tableau Server (Cloud-hosted) | Web Browser | Yes |
| Tableau Desktop | Native Desktop Application | No |
| Tableau Prep Builder | Native Desktop Application | No |
| Tableau Mobile | Native Mobile Application | No |
AppNavi monitors Tableau usage exclusively within supported web browsers, regardless of the deployment model.
This includes browser-based dashboards, workbooks, web authoring, data preparation, and administrative interfaces, depending on the accessibility of the respective UI elements.
Important: Usage within native desktop and mobile applications cannot be monitored by AppNavi, even if these applications are connected to Tableau Cloud or Tableau Server.
Prerequisites
- AppNavi browser extension installed and configured for the correct AppNavi tenant.
- Tableau accessible through a supported Chromium-based browser.
- Tableau application configured in the AppNavi Portal.
- AppNavi Insights available for the tenant and enabled for the application.
- Expert Mode enabled for the AppNavi tenant.
- Enable Custom Code enabled for the Tableau application.
customField_1available for Tableau user identification.- A Tableau test account for initial validation.
For information about deploying the AppNavi browser extension, see:
Distribute AppNavi Chrome Extension in Enterprises
Tableau Integration (Browser Extension)
1. Configure Tableau in the AppNavi Portal
Navigate to Manage Tenant > Applications > Applications.
- Create a new application or edit the existing Tableau application.
- Configure the Application URL and Pattern according to the Tableau instance used by your organization.
- Enable Insights.
- Enable Custom Code.
- For Code Execution Mode, start with Dynamic and verify compatibility with the Tableau environment's Content Security Policy.
Create a separate AppNavi application for each Tableau instance.
Example:
| Application Name | Application URL |
|---|---|
| Tableau Cloud | https://<instance>.online.tableau.com/ |
| Tableau Server | https://tableau.example.com/ |
| Tableau Server Test | https://tableau-test.example.com/ |
Use the actual Tableau URLs of your organization.
For on-premises deployments, the Tableau instance does not need to be publicly accessible. The user's browser must be able to access both the Tableau instance and the required AppNavi services.
2. Add the Custom Code
In the Tableau application's Custom Code section, add the following JavaScript to the application-level code hook that runs when AppNavi starts.
No individual configuration, credentials, or additional JavaScript libraries are required.
Important: The user identification mechanism relies on Tableau's internal VizPortal interface. Validate the implementation in the target Tableau environment before rolling out user-level analytics.
(async function () {
"use strict";
const CACHE_KEY = "appnavi.tableau.identity.v3";
const LOCK_KEY = "__appnaviTableauIdentityRunning";
const MAX_ATTEMPTS = 4;
const REQUEST_TIMEOUT = 5000;
const API_TIMEOUT = 15000;
const delay = ms =>
new Promise(resolve => setTimeout(resolve, ms));
const isValidUserId = value =>
typeof value === "string" &&
/^[1-9][0-9]{0,31}$/.test(value);
function getContext() {
const cookie = document.cookie
.split(";")
.map(value => value.trim())
.find(value => value.startsWith("XSRF-TOKEN="));
const token = cookie
? decodeURIComponent(
cookie.slice("XSRF-TOKEN=".length)
)
: null;
const route = location.pathname + location.hash;
const match = route.match(/\/(?:site|t)\/([^/?#]+)/);
return {
token,
site: match ? match[1] : "default"
};
}
function isCurrentContext(context) {
const current = getContext();
return current.token === context.token &&
current.site === context.site;
}
async function getFingerprint(token) {
if (!token || !window.crypto?.subtle) {
return null;
}
try {
const hash = await crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode(token)
);
return Array.from(new Uint8Array(hash))
.map(byte => byte.toString(16).padStart(2, "0"))
.join("");
} catch (_) {
return null;
}
}
function clearCache() {
try {
sessionStorage.removeItem(CACHE_KEY);
} catch (_) {}
}
function readCache(fingerprint, site) {
if (!fingerprint) return null;
try {
const cached = JSON.parse(
sessionStorage.getItem(CACHE_KEY)
);
if (
cached &&
isValidUserId(cached.userId) &&
cached.fingerprint === fingerprint &&
cached.site === site
) {
return cached.userId;
}
} catch (_) {}
return null;
}
function writeCache(userId, fingerprint, site) {
if (!isValidUserId(userId) || !fingerprint) {
return;
}
try {
sessionStorage.setItem(
CACHE_KEY,
JSON.stringify({
userId,
fingerprint,
site
})
);
} catch (_) {}
}
async function waitForAnalytics() {
const deadline = Date.now() + API_TIMEOUT;
while (Date.now() < deadline) {
const analytics = window.appnaviApi?.analytics;
if (
typeof analytics?.setCustomFieldValue === "function"
) {
return analytics;
}
await delay(100);
}
return null;
}
async function requestUserId(context) {
const headers = {
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json"
};
if (context.token) {
headers["X-XSRF-TOKEN"] = context.token;
}
const response = await fetch(
"/vizportal/api/web/v1/getSessionInfo",
{
method: "POST",
credentials: "same-origin",
redirect: "error",
cache: "no-store",
headers: headers,
body: JSON.stringify({
method: "getSessionInfo",
params: {}
}),
signal: AbortSignal.timeout(REQUEST_TIMEOUT)
}
);
// Do not retry unsupported or rate-limited requests.
if ([404, 405, 429].includes(response.status)) {
return { stop: true };
}
if (!response.ok) return null;
const data = await response.json();
const session = data?.result;
if (!session?.user || session.errors?.length) {
return null;
}
// Exclude known guest and restricted sessions.
if (
String(session.site?.role).toLowerCase() === "guest" ||
String(session.user.username).toLowerCase() === "guest" ||
session.isRestrictedTrustedTicketSession === true
) {
return { stop: true };
}
const rawId = session.user.id;
const userId =
typeof rawId === "string" ||
Number.isSafeInteger(rawId)
? String(rawId)
: "";
return isValidUserId(userId)
? { userId }
: null;
}
async function resolveIdentity() {
const context = getContext();
const fingerprint = await getFingerprint(context.token);
// Reuse the cached User ID without a Tableau request.
const cachedId = readCache(fingerprint, context.site);
if (cachedId && isCurrentContext(context)) {
return {
userId: cachedId,
context
};
}
clearCache();
// Request the User ID only if no valid cache exists.
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
try {
const currentContext = getContext();
const result = await requestUserId(currentContext);
if (result?.stop) return null;
if (
isValidUserId(result?.userId) &&
isCurrentContext(currentContext)
) {
const fingerprint = await getFingerprint(
currentContext.token
);
if (isCurrentContext(currentContext)) {
writeCache(
result.userId,
fingerprint,
currentContext.site
);
return {
userId: result.userId,
context: currentContext
};
}
}
} catch (_) {
// Retry temporary network or initialization errors.
}
if (attempt < MAX_ATTEMPTS - 1) {
await delay(500 * Math.pow(2, attempt));
}
}
return null;
}
// Prevent concurrent execution within the same page.
if (window[LOCK_KEY]) return;
window[LOCK_KEY] = true;
try {
// Do not reuse cached identities on authentication pages.
const route = location.hash.startsWith("#/")
? location.hash.slice(1)
: location.pathname;
if (/^\/(?:signin|signout|login|logout)(?:[/?#]|$)/i.test(route)) {
clearCache();
return;
}
// Resolve identity and initialize AppNavi in parallel.
const [identity, analytics] = await Promise.all([
resolveIdentity(),
waitForAnalytics()
]);
// Set the Custom Field only if a valid User ID exists.
if (
analytics &&
identity &&
isValidUserId(identity.userId) &&
isCurrentContext(identity.context)
) {
await analytics.setCustomFieldValue({
customField_1: identity.userId
});
}
} catch (_) {
// Never interrupt the Tableau application.
} finally {
delete window[LOCK_KEY];
}
})();Custom Code Behavior
The Custom Code is designed to minimize additional requests to Tableau and reduce the number of events generated before user identification is completed.
- Retrieves the Tableau User ID using the existing authenticated browser session.
- Resolves the User ID and waits for the AppNavi Analytics API in parallel.
- Caches the successfully retrieved User ID in session storage when a session fingerprint can be established.
- Reuses the cached User ID on subsequent page loads without additional Tableau requests.
- Performs up to four request attempts if initial user identification fails.
- Does not perform periodic requests or background polling.
- Invalidates the cached identity when a change in the observed session or site context is detected.
- Sets
customField_1only when a validly formatted Tableau User ID is available. - Does not overwrite Custom Fields 2 and 3.
| Scenario | Additional Tableau Requests |
|---|---|
| Initial successful user identification | 1 |
| Subsequent page load with valid cache | 0 |
| Navigation without AppNavi reinitialization | 0 |
| Detected session or site context change followed by code execution | 1–4 |
| Temporary identification failure | Up to 4 per execution |
The caching mechanism uses a local fingerprint of the Tableau XSRF token together with the site context. No raw authentication token is stored in the cache.
If a session fingerprint cannot be established or session storage is unavailable, the User ID is not cached.
Only the Tableau User ID is passed to AppNavi through this Custom Code. Usernames, email addresses, authentication cookies, and session tokens are not transferred by the script.
Custom Field Mapping
The internal Tableau User ID is a numeric identifier that is converted to a string before being passed to AppNavi.
No additional transformation is required.
| AppNavi Field | Value |
|---|---|
customField_1 | Tableau User ID |
customField_2 | Not used by this integration |
customField_3 | Not used by this integration |
Example:
| Source | User ID |
|---|---|
| Tableau | 123456 |
AppNavi customField_1 | 123456 |
The identifier fits within the AppNavi Custom Field limit of 32 characters.
For additional information, see:
3. Save and Verify the Integration
- Save the application configuration.
- Open Tableau in a browser with the AppNavi browser extension installed.
- Sign in to Tableau and perform several UI interactions.
- Verify that usage events are recorded in AppNavi Insights.
- Verify that
customField_1contains the internal Tableau User ID. - Compare the captured User ID with the corresponding Tableau user export.
Use the browser developer tools to verify that the User ID is cached and that subsequent page loads with an unchanged session context do not generate additional requests to the Tableau session endpoint.
Repeat the validation with different Tableau user accounts, including logout and login within the same browser tab.
If multiple Tableau sites are used, also validate site switching.
Before enabling user-level analytics, verify that:
- The captured User ID matches the exported Tableau User ID.
- Cached identifiers are not reused for different Tableau users.
- Previously assigned AppNavi Custom Field values are not retained incorrectly when user identification fails.
- The session fingerprint remains stable during normal usage and changes when required to prevent incorrect user assignments.
If these conditions cannot be confirmed, do not use the integration for user-level matching.
Matching Tableau Users and Licenses on the Customer Side
The Tableau User ID captured by AppNavi can be used to combine AppNavi Insights usage data with Tableau user and license information.
The matching process can be performed entirely within the customer's environment.
Tableau Cloud
Tableau Cloud provides user and license information through the TS Users data source in the Admin Insights project.
To export the required information:
- Open the Admin Insights project.
- Connect to the TS Users data source.
- Create a tabular view containing the following fields:
| Field | Description |
|---|---|
| User ID | Internal Tableau User ID |
| User Name | Tableau user account |
| User Friendly Name | User display name |
| User License Type | Assigned license category |
| User Site Role | Assigned site role |
| Site Name | Associated Tableau site |
| Site Luid | Unique site identifier |
- Configure User ID as a discrete dimension without aggregation.
- Export the view as CSV using Download > Crosstab.
The User ID field is the intended matching field for AppNavi Insights.
Important: Tableau User ID and Tableau User LUID are different identifiers. This integration uses the internal numeric User ID, not the UUID-based User LUID.
For additional information, see:
Tableau Cloud - TS Users Data Source
Tableau Server
For Tableau Server, including on-premises deployments, user and license-related information can be exported from the Tableau Server repository.
An administrator with appropriate repository access can use the following read-only SQL query:
SELECT
u.id::text AS user_id,
u.name AS user_name,
u.friendly_name AS display_name,
u.licensing_role_name AS license_role,
u.system_user_id,
u.site_id,
s.name AS site_name,
s.url_namespace AS site_url_namespace
FROM public._users u
LEFT JOIN public._sites s
ON u.site_id = s.id
ORDER BY u.site_id, u.id;The query provides the following information:
| Export Field | Description |
|---|---|
| user_id | Internal Tableau User ID |
| user_name | Tableau user account |
| display_name | User display name |
| license_role | Assigned licensing role |
| system_user_id | Server-level user identity |
| site_id | Internal site identifier |
| site_name | Tableau site name |
| site_url_namespace | Tableau site URL identifier |
The exported user_id is the intended matching field for AppNavi Insights.
The server-level system_user_id can additionally be used on the customer side to consolidate user records across multiple Tableau sites.
For role-based licensing, the licensing role can be used to determine the associated license category. The commercial license assignment must be evaluated according to the customer's licensing agreement.
Repository access is only required on the customer side for exporting this information. AppNavi does not require access to the Tableau Server repository.
The repository schema must be checked against the installed Tableau Server version.
For additional information, see:
Match the Exported Data
Use the Tableau User ID as the common identifier between the AppNavi Insights export and the Tableau user export.
Example:
| AppNavi customField_1 | Tableau User ID | Tableau User | License Type |
|---|---|---|---|
| 123456 | 123456 | Example User A | Creator |
| 123457 | 123457 | Example User B | Explorer |
| 123458 | 123458 | Example User C | Viewer |
Both identifiers should be treated as text values during the matching process.
Each AppNavi application represents a specific Tableau instance. Therefore, AppNavi Insights data must be matched with the user export from the corresponding Tableau instance.
If a Tableau instance contains multiple sites, retain the site context when matching records.
For Tableau Cloud, the matching must also distinguish between the respective sites. The site context can be derived from validated site-specific application or page URLs.
If the site context cannot be determined unambiguously, configure site-specific AppNavi applications or exclude ambiguous records from user-level matching.
Usernames and email addresses do not need to be imported into AppNavi.
Data Privacy
The Tableau User ID is a pseudonymous identifier that allows organizations to associate usage data with Tableau user records.
The integration does not require usernames or email addresses to be transferred to AppNavi through the Custom Code.
The association between the Tableau User ID and the actual user can be performed within the customer's own environment.
Organizations should ensure that user-level analytics are configured in accordance with applicable data protection requirements and internal policies.
AppNavi provides compliance documentation and information material to support internal data protection and works council approval processes.
Limitations
- AppNavi monitors Tableau usage exclusively within supported web browsers.
- Native Tableau Desktop, Tableau Prep Builder, and Tableau Mobile application usage cannot be monitored.
- Embedded Tableau dashboards require validation of iframe accessibility.
- User identification relies on Tableau's internal VizPortal interface and may be affected by Tableau updates.
- Cache invalidation relies on observable session and site context changes. The XSRF token is not a documented authentication-session identifier.
- Anonymous and guest access are outside the scope of individual user identification.
- Events generated before successful user identification may not contain a Tableau User ID.
- Account and site changes require renewed identity validation.
- Session caching does not guarantee correct identification after an undetected account change.
For license optimization, usage outside the browser must be considered separately.
The absence of browser-based activity does not necessarily indicate that a Tableau license is unused.
Tableau Cloud Admin Insights provides additional information about Tableau Desktop and Tableau Prep activity under supported login-based license management configurations. This information can be used on the customer side to complement AppNavi's browser-based usage analysis.
Updated about 3 hours ago