Note: In order to create a custom insight, you should have a basic knowledge HTML as well as SQL (postgres)

Gtmhub allows you to create custom insights. These can range from keeping a running count of users, keeping track of key results in danger, or just about anything else you could imagine!

Hello World Insight

To begin with, we'll create a simple insight which will only show "hello world" text on InsightBoards. Then, we'll move onto more useful examples.

  • Login to Gtmhub application

  • Your role must include the "ManageData" action to be able to proceed with the steps described below - for example Data and Admin roles

  • Click on the Insights dropdown menu and select Insightboards option

  • Select the Insightboard you would like your custom insight to be in (You can change this later)

  • Click the 3 dots to the right of the Insightboard name and select "Add Insights"

  • Click the arrow next to the "Create New Insight" button and select "Use SQL Expert Editor"

  • Fill out the Title and Description and select "Create Insight"

This is the edit page you will see after creating your insight, while it may looks basic, this is where all the magic happens:

By default, a new insight will contain both the HTML and SQL code to display "Hello World". However you can change the message displayed by changing the SQL code.

For example, the following SQL code:

SELECT 'Hello World' as message

Will display "Hello World"


SELECT 'I am an SQL master' as message

Will display "I am an SQL master".

You can test your code by clicking the blue "Execute" button on the bottom right of the page. This will show you a preview of the insight.

Now, click on the "Save and Leave" button. Congratulations, you've just created your very first insight!

This short video demonstrates how to create and edit a basic Insight in Gtmhub.

You can also try our Offline Insight Editor if you prefer to edit your insights in VS Code.

Creating an actual insight with metrics

Now that we have seen how easy it is to create and edit a basic Insight in Gtmhub, lets create a more useful insight that will use actual data.

For this example, we'll need some data. If you scroll through the entity fields on the right of the Insight Editor, you can see all of the built in entities you can pull data from.

In this tutorial, we are going to create a simple insight that will show us count of all the users in your Gtmhub account.

  • To get started, follow the steps above to create a new insight.

  • Next, since we are counting the number of users in the account, scroll down the list of entities until you find "gtmhubusers".

  • Expand this list by clicking on the plus sign next to it.

  • For this case, it makes the most sense to use the entity "id", since each user is assigned a unique id when their account is created

  • In the SQL code editor paste the following code:

    COUNT(id) AS users_count
    FROM gtmhubusers

  • This will count all id's contained in the gtmhub users set. Since each user has an id, it will give us a count of the total number of users in the account.

  • Now that we have the data, we need to figure how how to display it

  • In the HTML code editor, paste the following code:

    <div class="bigger-150">
    <metric name="Users Count" field-name="users_count">
    {{ data.users_count | number:0 }}
    <div class="mt-3">
    <div class="bigger-120 medium">{{insight.title}}</div>
    <div class="o-5">{{insight.description}}</div>

  • Click "Execute" to verify that your insight works as intended. (You should see a screen with the number of Users with the insight title and description below.)

  • Click "Save and Leave"

  • Congrats! You successfully created your first insight that pulls data from a gtmhub entity

These 2 examples were fairly simple, however the possibilities are endless. If you require assistance with more complex insights, we offer custom insight building for our customers on our Enterprise plan with the Technical Success add on. You can learn more and inquire here:

The Marketplace

Gtmhub offers many prebuilt insights that you can easily install directly to your account. This article goes over the steps on how to utilize the marketplace.

Did this answer your question?