--- title: "Install Userflow.js with Google Tag Manager" slug: "userflowjs-installation-in-google-tag-manager" description: "Learn how to install Userflow.js in Google Tag Manager and pass user attributes for targeted flows, enhancing user experience effectively." updated: 2026-10-26T16:17:00Z published: 2026-10-26T16:17:00Z canonical: "help.userflow.com/userflowjs-installation-in-google-tag-manager" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://help.userflow.com/llms.txt > Use this file to discover all available pages before exploring further. # Install Userflow.js with Google Tag Manager If your app already uses [Google Tag Manager](https://tagmanager.google.com/) (GTM), you can install Userflow.js as a GTM tag instead of adding code to your app. For other ways to install, see [Userflow.js Installation](https://help.userflow.com/docs/userflowjs-installation). ## What you need before installing Userflow.js with Google Tag Manager Your Google Tag Manager account needs a variable that holds the signed-in user’s ID. You can also use variables for other attributes, such as the user’s name, email, or sign-up date. This guide assumes your user ID variable is named `userId`. If yours has a different name, replace `{{userId}}` in the snippet with your variable’s name. ## Add the Userflow.js tag in Google Tag Manager 1. Sign in to Userflow. 2. Go to **Settings > Environments**. 3. Copy your **Userflow.js Token**. It starts with `ct_`. 4. Sign in to your Google Tag Manager account. 5. Go to **Tags**. 6. Click **New**. 7. Click **Tag Configuration**. 8. Click **Custom HTML**. 9. In the **HTML** field, paste this snippet, and replace `USERFLOW_TOKEN` with the token you copied in step 3: ```plaintext ``` 10. Click **Triggering**. 11. Click **All pages**, or a more specific trigger if you have one. > [!WARNING] > **Only fire this tag for signed-in users.** Every user the tag identifies counts toward your MAU total, whether or not they ever see Userflow content. If you pick the **All pages** trigger and the tag also runs on public pages, such as your marketing site or sign-up page, those visitors can be counted too. Use a trigger that fires only when the `userId` variable has a value, or only on pages inside your app. See [How Userflow Tracks and Bills Monthly Active Users (MAUs)](https://help.userflow.com/docs/how-userflow-tracks-and-bills-monthly-active-users-maus). 12. Click **Save** and give the tag a name, such as “Userflow”. ## Send user attributes from Google Tag Manager You can send any attributes you want to Userflow in the `userflow.identify()` call. Use them to target flows to specific users, for example to show a welcome modal only to users who signed up recently. If your Google Tag Manager account has variables for the user’s name, email, or sign-up date, add them to the second argument of `userflow.identify()`: ```plaintext userflow.identify('{{userId}}', {  name: '{{name}}',  email: '{{email}}',  signed_up_at: '{{signed_up_at}}' }) ``` This example expects the three variables to be named `name`, `email`, and `signed_up_at` in Google Tag Manager. The `signed_up_at` value must be in ISO 8601 format, for example `2021-03-26T12:31:47Z`. ## Related articles - [Userflow.js Installation](https://help.userflow.com/docs/userflowjs-installation) - [How Userflow Tracks and Bills Monthly Active Users (MAUs)](https://help.userflow.com/docs/how-userflow-tracks-and-bills-monthly-active-users-maus) - [Userflow.js installation check](https://help.userflow.com/docs/userflowjs-installation-check) - [Content Security Policy: domains to allow for Userflow.js](https://help.userflow.com/docs/content-security-policy)