Send Telegram notifications using Google Tag Manager Server container

Author
Stape
Published
Jun 1, 2021

Let’s say that you started a new campaign or launched a website and want to receive real-time notifications about new orders. 

Checking conversions inside Google Analytics can be time-consuming. So what is the best way to send information about user activity on your site or orders from specific traffic sources? We created a Telegram tag for the Google Tag Manager Server container that can send notifications about user actions on the website to the Telegram channel. We also have a similar tag for Slack notifications.

The Telegram tag for the Google Tag Manager server container allows receiving real-time Telegram notifications on every conversion and user action on the site.  The notifications can be sent to multiple recipients.  

You can also use the Telegram tag to send notifications about website errors. It’s an easy way to monitor user activity on the site.

How does the Telegram Tag for Google Tag Manager server container work?Copy link to this section

Whenever a conversion takes place, a message gets pushed into the channel. You can send user or order details inside the Telegram notification or add any information you can get using Google Tag Manager. It can be a traffic source, product name, or category. You can also send notifications to different channels depending on what traffic source is responsible for the conversion. You, your developers, SEO managers, PPC managers, or developers can be subscribers.

Telegram tag communicates with telegram API. And the setup is done inside the Google Tag Manager server container. 

How to send Telegram notification using Google Tag Manager server containerCopy link to this section

2. Send required data from Web to Server container. This guide will show how to use the GA4 tag to get data inside the server container. The first step would be to set up GA4 tracking inside the Web container. Add transport URL to the GA4 Configuration tag and set up GA4 event tag that will include required user and event parameters.

Add transport URL to the GA4 Configuration tag
set up GA4 event tag

3. Go to the Server container, add a GA4 client inside the Server container, and create a GA4 tag that will trigger all requests from the GA4 client. 

  add a GA4 client inside the Server container  
 create a GA4 tag

4. Create variables inside the Server container that take the necessary event data. 

variables inside the Server container 
event data ga4

5. Add a Telegram tag to the Server container. You can add it from the Template gallery or by clicking this link

Telegram tag to the Server container

6. Create a new tag inside the Server container -> Tag type Telegram Notification.

7. You will need to add an Access Token to the Telegram tag. Here is a link to a detailed description of how to create an Access token. To create a new bot click this link, it will open the Telegram app -> Click start -> Type command /newbot -> Telegram will ask you to create a bot name -> In the next step, it will ask you to create a username for your bot; it should end with _bot -> You should see the message saying that your bot was created -> Access token for this bot -> Copy access token and add it inside the Telegram tag.

bot api in telegram
token to access the HTTP api in telegram

8. Add the channel name. To create a new channel, click on the hamburger menu on the top left corner. Please note that you need to create a public channel.

channel in telegram

9. Open the channel that you’ve recently created and invite the bot you’ve created in step #7. To do that, click manage users -> Add a bot name -> Click add. 

add users in telegram
telegram tag 

10. Add Notification Text. You can add variables inside the notification text. Add a trigger for the tag. In my case, Telegram notification will trigger after a successful purchase. 

add trigger configuration
add tag configuration

11. Open the preview mode of the web and server container and test the Telegram tag. If everything works correctly, you will see a message in the Telegram channel, and the tag status will be Succeeded. 

telegram tag
telegram google tag manager

Conclusion:Copy link to this section

That’s about it! You’ve just finished setting up e real-time Telegram notifications. It means you will instantly know when a conversion takes place and will have access to all the user and product parameters. You can upgrade the trigger so it will work only for special products, traffic sources, or only when transaction revenue is more than X.

Want to learn how to send Telegram notifications on server?

Find out how much it will cost! Click Get assistance, fill up the form, and we will send you a quote.

Get assistance

Relevant posts

Oct 8, 2021

How much does server GTM cost and why Stape is cheaper than Google Cloud’s App Engine

What cost can you expect for server Google Tag Manager hosted on Google Cloud? Is it a good idea to use a test environment on the productions site. Why stape’s hosting for server GTM is cheaper and how we secure our user’s data.

Jun 24, 2021

How To Prepare Your Facebook Campaigns for the iOS 14 Privacy Update

The latest Apple announcement had many marketers worried about how to prepare their Facebook campaigns for iOS 14. The new mobile operating system limited the ability to use third-party cookies — a significant feature for most marketing and advertising campaigns. That means that marketers will have to find alternative methods for measuring conversions, tracking data, and using good old pixels on the websites. This blog post will explain what advertisers should expect from the iOS 14 update and explore how to prepare Facebook campaigns and set up tracking so that all your efforts are not in vain.

Aug 28, 2021

How to set up TikTok Events API

In 2021, TikTok is the hottest social media app with over 1 billion monthly active users. That is why most marketers decide to bring it into their advertising strategies. People use TikTok on their mobile phones more than anywhere else. For quite a while, only Facebook was talking about Apple’s recent privacy updates. Only this time, new iOS tracking restrictions will also apply to TikTok ads. Because of the iOS restriction, TikTok custom audiences and events do not include people who opted out of tracking in iOS 14.

Host your GTM server at Staperight now!