Capture UTM parameters from Chatbot

If you want to measure your ad performance with real numbers and not just guesswork, then using UTM is worth considering.

1. What is UTM

A UTM is a piece of text added to the end of a URL that allows you to track visits to that URL. This can be hits from posts on Social Networks, Email, CPC, Chatbot - basically anytime you want to know where the traffic is coming from. This is useful when you are testing which advertising methods work best for optimal performance.

utm_source (required): Campaign source (Facebook, Google, SMS, QR-code ...) utm_medium (required): How to approach the campaign (CPC, CPM, email ...) utm_campaign (required): Campaign name (spring_sale, summer_sale ...) utm_term: Customer audience of the campaign (chatbot_owners, fanpage_owners ...). utm_content: Campaign content (logolink, textlink)

Examples of URLs containing UTM:

https://ahachat.com/?utm_source=facebook&utm_medium=cpc&utm_campaign=spring_sale

You can copy the available UTM script from AhaChat to save time:

Basic UTM: https://app.ahachat.com/share-story-to-bot/a9bbe79000edba80cb462b1b025757b6Tykb8M5cdK1279171

UTM for Affiliate: https://app.ahachat.com/share-story-to-bot/c5420060f3255fcf0cf5094bc6722314o8xGdz6tnz1285898

2. Create UTM in Chatbot

UTM is used to measure access to URLs. If you want to apply UTM on your Chatbot, you have to generate a Ref URL containing that UTM. In this article, I will guide you how to create a very simple UTM on AhaChat.

2.1 Go to Growth menu> Messenger Ref URL

2.2 Create Ref URL containing UTM

Ref URL will look like the link below, the parameters are separated by "."

https://m.me/ahachatter?ref=qc.utm_source.facebook.utm_medium.cpc.utm_campaign.spring_sale

Note: At this step, you do not need to select the flow scenario, you can do it in the following step.

3. Save the UTM properties

Before saving UTM you need to know how to decompose parameters like this tutorial.

And when the customer clicks on the link you will easily save the values ​​utm_source, utm_medium, and utm_campaign by decomposing ref based on the "." into 7 components as follows:

qc1utm_sourcefacebookutm_mediumcpcutm_campaignspring_sale
0123456

The split will result in:

{{split (ref, ".") [0]}} = qc
{{split (ref, ".") [1]}} = utm_source
{{split (ref, ".") [2]}} = facebook (to gather info)
{{split (ref, ".") [3]}} = utm_medium
{{split (ref, ".") [4]}} = cpc (to gather info)
{{split (ref, ".") [5]}} = utm_campaign
{{split (ref, ".") [6]}} = spring_sale (to gather info)

Okay, here we are going to start scripting to save the UTM Properties.

3.1 Create properties to save UTM

Create three properties with the Text data. Type utm_source, utm_medium, utm_campaign in the Audience menu.

3.2 Script UTM

Create the first block of ATTRIBUTE type and save the UTM.

Then create another block containing the campaign's content, you can consult our page on how to create a script in AhaChat if you don't know the steps yet.

4. Measurement UTM

Go to the Client menu to filter the conditions according to the utm_source, utm_medium, utm_campaign Attribute.

5. UTM for Collaborator

Okay, let's build a little more advanced measurement scenario together now. Instead of the above scenario we just know the generic campaign is coming from "CPC". Now, if we want to know which contributor the campaign is from, we will generate a Ref URL like this:

https://m.me/ahachatter?ref=qc.utm_source.facebook.utm_medium.cpc.utm_campaign.spring_sale.utm_term.Tu

https://m.me/ahachatter?ref=qc.utm_source.facebook.utm_medium.cpc.utm_campaign.spring_sale.utm_term.Tuan

In the two links above, we use the UTM, utm_term. This can be used to measure the campaign of these two collaborators. But if you assume the number of contributors is more than 100 people, you cannot sit and create 100 links like that. So the solution now is to generate a new Ref URL:

https://m.me/ahachatter?ref=qc.utm_source.facebook.utm_medium.cpc.utm_campaign.spring_sale.utm_term.*

In the above link, we use a new UTM, utm_term. , This "" represents the code or name of any collaborator.

And when the customer clicks on the link, you will easily save the values ​​utm_source, utm_medium, utm_campaign, and utm_term by extracting ref based on the "." into seven components as follows:

qc1utm_sourcefacebookutm_mediumcpcutm_campaignspring_saleutm_term*
012345678
The split will result in:
{{split (ref, ".") [0]}} = qc
{{split (ref, ".") [1]}} = utm_source
{{split (ref, ".") [2]}} = facebook (to gather info)
{{split (ref, ".") [3]}} = utm_medium
{{split (ref, ".") [4]}} = cpc (to gather info)
{{split (ref, ".") [5]}} = utm_campaign
{{split (ref, ".") [6]}} = spring_sale (to gather info)
{{split (ref, ".") [7]}} = utm_term
{{split (ref, ".") [8]}} = * (to gather info)

The steps for saving properties and measurements are the same as the Create UTM instructions above. Also, you can go to link shortening sites like Bitly or Cutt to create more beautiful URLs.

Now you have completed the installation and tracking of the UTM code in a chatbot. If you have more questions, do not hesitate to contact us for the fastest and most effective answer! Enjoy our free chatbot tool without having to pay any costs!