How to Track the Conversion Rate of Incoming SMS via a Link Using Google Analytics

March 18, 2019
Written by
Godwin Agedah
Contributor
Opinions expressed by Twilio contributors are their own

twilio-sms-tracking-google-analytics-cover-photo.png

You have succeeded in sending a bulk SMS to all your customers to buy your shiny new product, via a link in an SMS. How do you check how many of your customers interacted with the link? We can do this using Google Analytics. Google Analytics is a web analytics service that tracks and report website traffic.

Technical Requirements

For this tutorial, we will only need a hosted website with a domain.

Creating a Google Analytics account

To create a Google Analytics account go to the URL here and log in with your Google account.

Obtain Tracking ID

The tracking ID is a unique set of characters in the form of UA-134276880-1 that enables tracking for your site. To obtain your unique tracking ID, fill the form as shown below. Click the “Get Tracking ID” button and then accept the terms and conditions as shown in the images below.

GA

gA

GA

After clicking Accept, a tracking ID is created for your website. It will be embedded in a piece of javascript code that can be retrieved under “Tracking info”.

Add Required Code to your Website to be Tracked

In order to get the tracking data for our website, we need to add the tracking code from the Google Analytics page to our website’s code. The code can be obtained here. Copy and paste it in your website's code, under the opening <head> tag.

<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-134276880-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-134276880-1');
</script>
</head>

Note: This code contains your unique tracking ID, Don’t worry about the inner workings of the code.

The steps above provide tracking data for the website alone. How do you know that your users engaged the link through the SMS? This is where campaign tagging is required. Campaign tags are parameters added to URL links that allow Google Analytics to extract information associated with a particular user.

A campaign tag is in the following form:

http://www.example.com/?utm_source=newsletter1&utm_medium=email&utm_campaign=summer-sale&utm_content=toplink

There are five different campaign tags but our focus will be on medium and source which allows us to specify that our traffic is coming from an SMS versus standard web traffic.

A campaign tag can be manually added to a link or created using a URL builder.

How to use Google Campaign URL Builder

To use Google Campaign URL Builder, go to this link and select “Campaign URL Builder” Fill in the various text boxes for each campaign tag you wish to track like shown in the image below.

GA

Note: The tags should be very descriptive, look at the table under the form on the same page for more information.

Filling the form automatically creates the link below like shown below, then you can just copy the link and paste it in the body of your SMS to be sent. I’d recommend that you convert the URL to a Short Link to make the link more legible.

GA

Testing

To test, open an incognito window in your browser and enter the URL created with the campaign tags. Open the URL multiple times and in multiple browser tabs to obtain enough data to work with.

Obtain tracking Data

It takes 24-48 hrs for your campaign data to be available, but you can use the real-time analytics to track how many users are currently engaged with your campaign by navigating to the real-time reports, then click “Traffic Sources”. If your campaign medium and source is specified correctly you should see the data like the image below.

GA

To get tracking data for your campaigns, go to “Acquisition” on the left nav bar, select “All Campaigns” under “Campaigns”. To verify that the campaign was set up correctly, type the name of the campaign into the filter. Then you’ll be able to see an overview of the campaign you tested as shown below:

GA
.

Conclusion and Next Steps

Now that you have completed this tutorial you should be able to set up campaigns for other medium you wish to track your customer’s interaction with. You can set up a campaign for email marketing or even track the users that visited your about page.

You can reach me, Godwin Agedah on the following channels:

Email:agedah99@gmail.com
Twitter:@GodwinAgedah
Github:Godwin9911