# Integrating Google Tag Manager

[Google Tag Manager (GTM)](https://developers.google.com/tag-platform/tag-manager) is a solution that allows you to manage web scripts without modifying the website's code. By using GTM, you can easily execute scripts without writing code or going through complex development and deployment processes.

It's especially useful because it enables you to link FlareLane events and tags based on various triggers—such as page views, button clicks, and scrolls—on your website with just a few clicks, all without writing any code.

## How to Start

### 1. Download the FlareLane GTM Tag

{% file src="<https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FSnNXo1XQFpC39L7DHHK5%2Ftemplate.tpl?alt=media&token=0c75027b-7aab-462a-9f75-60c9b5a46aa7>" %}

Download the FlareLane GTM tag template file above, then follow the steps below to install it in Google Tag Manager:

1. Go to the **Templates** section in your GTM console.
2. Click **"New"** to create a new template.
3. Select **"Import**," and upload the downloaded file.

This will install the FlareLane tag template into your workspace.

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FjCoXF0jDoFuDrIhYHtrV%2FydVxSktk5WV2g0_Qzrc91_screenshot-2025-03-05-at-31418-pm.png?alt=media&#x26;token=16bbf6a1-cefe-4b5b-a620-e5d6754d769e" alt=""><figcaption></figcaption></figure>

### 2. Configure GTM Tag

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FdphtkUp6RPx6n7vTp5Az%2FnfOts2UPdP5o4kpHba1zF_screenshot-2025-03-05-at-30623-pm.png?alt=media&#x26;token=fe84cb4f-62f9-4fd7-a5a4-265d1b195e73" alt=""><figcaption></figcaption></figure>

With the installed FlareLane GTM tag, you can link customer data—such as [events](https://guide.flarelane.com/data-integration/events), [user profiles, and tags](https://guide.flarelane.com/data-integration/tags)—and also define exposure groups (triggers) for displaying [in-app messages](https://app.gitbook.com/o/MUgsvQeC4AV3DHZtUZIB/s/SJ35x4PFzaneH3SrvcBt/~/changes/103/channels/in-app-message).<br>

For detailed instructions on how to configure each function, please refer to the **Provided Functions** below.

### 3. Testing & Deployment

You can use GTM’s built-in [debugging tools](https://support.google.com/tagmanager/answer/6107056?hl=en) to verify whether the configured tag is working properly.

By enabling **Debug Mode** within the FlareLane tag, browser console logs will be recorded during the tag execution process for easier troubleshooting.

Additionally, you can use the **Network** tab in your browser’s developer tools to inspect the actual network requests being sent and received.

Once all tag settings are complete and working, you can now publish the changes on your website.

***

## Provided Functions

### **Event Triggers**

This triggers a FlareLane[ event](https://guide.flarelane.com/data-integration/events) based on the configured trigger in GTM. Alternatively, you can also attach detailed data as variables along with the event name for more in-depth tracking.

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2Fgel7gs7mB0mBcLK1ju0k%2Ficxefkl4n0Uc1FDdMrh-0_screenshot-2025-03-05-at-22052-pm.png?alt=media&#x26;token=439bb40b-88fe-490e-85ad-54e34fcfa0c3" alt=""><figcaption></figcaption></figure>

### Tag Assignment & Removal

This links a FlareLane [tag](https://guide.flarelane.com/data-integration/tags) based on the configured trigger in GTM. You can either assign a fixed `value` or pass it through a variable. For tag removal, specify the tag to be removed and trigger the dedicated **tag removal function** accordingly.

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FhsyqIh15KkaGO2sCmJCx%2FUZovalhgUPvGw03fklvFH_screenshot-2025-03-05-at-22137-pm.png?alt=media&#x26;token=e20d40ed-f9ae-4131-8cb7-4ae6a6a688a3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2Fo2XJup0zg7kCmVFeeHvu%2FiD3gIuXElY5_-BF8fwD93_screenshot-2025-03-05-at-22225-pm.png?alt=media&#x26;token=b3986750-dd2b-43e3-afd3-5a8114924963" alt=""><figcaption></figcaption></figure>

### In-App Message Display

This displays [in-app messages](https://app.gitbook.com/o/MUgsvQeC4AV3DHZtUZIB/s/SJ35x4PFzaneH3SrvcBt/~/changes/103/channels/in-app-message) based on the configured trigger in GTM. You can define **groups (triggers)**—for example, to show a specific in-app message when a user visits a particular page.

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FRuDuwmOUcDonsIwNistu%2F8q_AyYiJA8scsroDC0bXt_screenshot-2025-03-05-at-22329-pm.png?alt=media&#x26;token=cc6d3600-3c7e-4f01-af84-3ab6bbb6ff6c" alt=""><figcaption></figcaption></figure>

### User ID Assignment & Removal

This assigns a FlareLane [user ID](https://guide.flarelane.com/data-integration/user-id) based on the configured trigger in GTM. If you need to remove the user ID, you can trigger the dedicated **user ID removal function** accordingly.

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2F3YvYqobLYbbDnUq4FefT%2FtBG9MP9CErnwB7EdTDEw-_screenshot-2025-03-05-at-22247-pm.png?alt=media&#x26;token=ba74f65f-6c67-46ff-a25a-00b20c0a07d5" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FTZzFYNFUEnLZkTWkGE93%2FG85JycdN52wX9idsZzQJa_screenshot-2025-03-05-at-22306-pm.png?alt=media&#x26;token=45993ee4-23bc-4798-aa2f-e9a9c8282118" alt=""><figcaption></figcaption></figure>

### FlareLane SDK Initialization

You can initialize the FlareLane SDK through the GTM tag as well. However, since web push notifications require uploading a Service Worker file, we recommend initializing the SDK by directly inserting the code as outlined in the [Web SDK Integration](https://guide.flarelane.com/guide-for-developers/web-sdk-setup) guide for a more complete setup.

<figure><img src="https://4151189289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSJ35x4PFzaneH3SrvcBt%2Fuploads%2FeiLp45fq8sDaDHyFZ3vt%2FvAtG7BKrAYtjT4eXCwGqJ_screenshot-2025-03-05-at-22408-pm.png?alt=media&#x26;token=07e4c494-d776-44de-8ba1-f131d6930ff6" alt=""><figcaption></figcaption></figure>
