Skip to main content
Google Tag Manager Pixel Installation

Learn how to setup Google Tag Manager pixel installation.

Updated over a month ago

Step 1: Create a Google Tag Manager Web Container

  1. Navigate to the Google Tag Manager website.

  2. Click Start for free.

  3. Sign in with your Google account.

  4. After signing in, you'll be directed to the GTM Account Setup page. Here, you'll need to provide an account name (usually your business name) and select your country.

  5. Click Continue.

  6. Next, you'll need to set up a container. Usually, you'll want to create a container for each separate web domain you have.

  7. Enter the name for your container. This could be the name of your website.

  8. Choose "Web" container.

  9. Click "Create."

Step 2: Add GTM Code to Your Website

  1. You will see a pop-up window with two blocks of code. The first block should be added as close as possible to the opening <head> tag. The second block should be added immediately after the opening <body> tag. This code should be added to every page of your website.

  2. After you've added the code to your website, click "OK."

Step 3: Create Cometly Base Code Tags

Important: Ensure that you do not have the Cometly base code pixel hard coded on your site and in GTM. This will cause the pixel to be added on your website twice and will cause tracking issues. If you are setting up with Google Tag Manager, ensure it's only in Google Tag Manager and not hard coded on the site.

In this step you are going to create two tags separating the Cometly base code into two tags. The goal is to have the second tag firing AFTER the first tag fires.

Here is an example Cometly base code below:

(do not use the code below, this is for example purposes)

<script src="https://t.cometlytrack.com/e?uid=EXAMPLE"></script>
<script>
comet('init');
</script>

Your two tags will look like this:

Tag 1 - Cometly Base Code

(do not use the code below, this is for example purposes)

<script src="https://t.cometlytrack.com/e?uid=EXAMPLE"></script>

Tag 2 - Cometly Base Code

<script>
comet('init');
</script>

For Tag 2, navigate to 'Advanced Settings' > Tag Sequencing, and select 'Fire a tag before Tag 2: Cometly Base Code fires'. Choose the Setup tag 'Tag 1: Cometly Base Code'.

Step By Step Instructions:

Tag 1 Setup

In your GTM workspace, click Add a New Tag.

Name your tag 'Tag 1 - Cometly Base Code'

Click on Tag Configuration and choose a custom HTML tag.

Paste the first part of your Cometly base code:
​(do not use the code below, this is for example purposes, use the workspace pixel)

<script src="https://t.cometlytrack.com/e?uid=EXAMPLE"></script>

Set Trigger to 'All Pages'.

Tag 2 Setup

In your GTM workspace, click Add a New Tag.

Name your tag 'Tag 2 - Cometly Base Code'

Click on Tag Configuration and choose a custom HTML tag.

Paste the second part of your Cometly base code:
​(do not use the code below, this is for example purposes, use the workspace pixel)

<script>
comet('init');
</script>

For Tag 2, navigate to 'Advanced Settings' > Tag Sequencing, and select 'Fire a tag before Tag 2: Cometly Base Code fires'. Choose the Setup tag 'Tag 1: Cometly Base Code'.

Set Trigger to 'All Pages'.

Step 4: Send events to Cometly

Server Events (Recommended)

Use a direct integration or Zapier to send server events to Cometly.

Browser Events

In the example below, the setup is for the Lead event in Cometly.

  1. In your GTM workspace, click "Add a New Tag."

  2. Name your tag 'Cometly - Lead'

  3. Click on "Tag Configuration" and choose a custom HTML tag.

  4. Enter the Cometly Lead event:

    1. <script>
      comet('lead_generated');
      </script>

  5. Navigate to 'Advanced Settings' > Tag Sequencing, and select 'Fire a tag before Cometly - Lead fires'. Choose the Setup tag 'Cometly - Base Code Pixel'.

  6. Choose the appropriate trigger to fire depending on your set up. The easiest solution is to create a Page View trigger that fires on a Page URL that contains part of the URL. For example, /thank-you

  7. Your Lead event should look like the example below.

    1. The Trigger can be anything you want that will trigger the event to fire.
      ​

Did this answer your question?