@fingerprintjs/fingerprintjs-pro-gtm

中文文档
1.0.0发布于 2023/04/07MITES Module零依赖近 30 天下载 5194

FingerprintJS pro version adapter for Google Tag Manager

原始使用文档
文档目录5 节
  1. Repository content
  2. Usage
  3. Template Fields
  4. Example of usage
  5. Limitations

Fingerprint logo

Build status

Repository content

  1. FingerprintJS Pro Google Tag Manager template
  2. FingerprintJS Pro adapter for Google Tag Manager

:warning: Work in progress: This is a beta version of the library

FingerprintJS Pro Google Tag Manager template

You can find an example of using this integration on our website

Usage

  1. You should have FingerprintJS account
  2. Add FingerprintJS Pro Tag in your GTM admin panel (you can import it from github repo)
  3. Set up the public API key and choose the region
  4. Use FingerprintJSPro.loaded event to get data from dataLayer. You can create trigger for this event.
  5. Use Result custom name field to change the variable name for the result.

Template Fields

You can find more info on the FingerprintJS Pro agent documentation page https://dev.fingerprint.com/docs/js-agent

Public API key - Your public API key that authenticates the agent with the API.

Region - The region of your subscription.

Endpoint - This parameter should only be used with the Custom subdomain. Specify your custom endpoint here.

tag - a customer-provided value or an object that will be saved together with the identification event and will be returned back to you in a webhook message or when you search for the visit in the server API.

linkedId - is a way of linking current identification event with a custom identifier. This will allow you to filter visit information when using the Server API

Extended result - The response object includes a confidence score field representing the probability of accurate identification. The extended response object also includes several fields with useful timestamps related to a visitor. See more information on firstSeenAt/lastSeenAt timestamps here.

Result custom name - you can specify the result field name in dataLayer

FingerprintJS Pro adapter for Google Tag Manager

Since GTM (Google Tag Manager) uses a subset of JavaScript API that doesn't support Promises, we created this adapter for the FingerprintJS Pro JS agent that can be used in a GTM template.

Adapter code hosted on CDN and accessible via the next URL https://opencdn.fpjs.sh/fingerprintjs-pro-gtm/v0/iife.min.js

More information about CDN you can get in CDN repository

Example of usage

In GTM template we can load FingerprintJS Pro this way:

const injectScript = require('injectScript');
const callInWindow = require('callInWindow');
const url = 'https://opencdn.fpjs.sh/fingerprintjs-pro-gtm/v0/iife.min.js';

const onSuccess = () => {
  const onFpJsLoad = (result) => {
    const dataLayerPush = createQueue('dataLayer');
    dataLayerPush({
      event: 'FingerprintJS.loaded',
      visitorId: result.visitorId
    });
    data.gtmOnSuccess();
  };

  callInWindow('FingerprintjsProGTM.load', {apiKey: data.apiKey}, onFpJsLoad);
};

// If the script fails to load, log a message and signal failure
const onFailure = () => {
  data.gtmOnFailure();
};

injectScript(url, onSuccess, onFailure);

Limitations

Some advanced JavaScript agent properties (tlsEndpoint, disableTls, storageKey, and scriptUrlPattern) are not currently supported. If you require to use these features in the GTM, please contact support.

Ad-blocking browser extensions such as AdBlock, uBlock Origin, etc., can block all scripts served by Google Tag Manager, including Fingerprint. If this is a problem for your use case, see Google Tag Manager documentation for Server-side tagging and Custom domain configuration.

版本与发布记录

@fingerprintjs/fingerprintjs-pro-gtm 共发布 5 个版本,首次发布于 2022/03/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0latest2023/04/073 年前
0.3.02022/03/294 年前
0.2.02022/03/234 年前
0.1.12022/03/224 年前
0.1.02022/03/224 年前

关于 @fingerprintjs/fingerprintjs-pro-gtm 的常见问题

@fingerprintjs/fingerprintjs-pro-gtm 是什么?

FingerprintJS pro version adapter for Google Tag Manager

如何安装 @fingerprintjs/fingerprintjs-pro-gtm?

在项目目录运行 npm install @fingerprintjs/fingerprintjs-pro-gtm,或使用 pnpm add / yarn add / bun add。

@fingerprintjs/fingerprintjs-pro-gtm 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fingerprintjs__fingerprintjs-pro-gtm 是否存在。

@fingerprintjs/fingerprintjs-pro-gtm 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fingerprintjs/fingerprintjs-pro-gtm 可以商用吗?

@fingerprintjs/fingerprintjs-pro-gtm 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fingerprintjs/fingerprintjs-pro-gtm 的下载量有多少?

根据 npm 官方下载统计,@fingerprintjs/fingerprintjs-pro-gtm 在 2026/10/15 – 2026/11/13 这 30 天内被下载 5,194 次,日均约 173 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fingerprintjs/fingerprintjs-pro-gtm 还在维护吗?

最新版本 1.0.0 发布于 2023/04/07(3 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/03/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。