Category

Analytics

Quick Guide to automate your TikTok Ads report with Google Sheets (with template!)

By AnalyticsNo Comments

There are many tools out there that allow you to pull data easily from your TikTok Ads accounts into a Google Spreadsheet for further processing. However, they usually come at a monthly cost. Therefore, we would like to share a solution to automate this data pulling for free by using our template!

In this article, we will also share what you need in order to use our template, things to look out for, and what the report will look like.

PREREQUISITES BEFORE STARTING

In order to use Tiktok API to pull data, you will first need to register as a developer here and create an app.

For the expected outcome, please refer here to see support dimensions and metrics.

(Keep in mind that there can only be one ID dimension and one time dimension in each request. For example, you can only have campaign_id with stat_time_day but not with the adgroup_id or ad_id ID dimensions)

Wait until your app is approved

After the app is approved, you will see your app id and secret.

The next thing you should get from the app is an authorization code (auth code).
Here is how you can get the auth code:

  1. First, go to https://ads.tiktok.com/marketing_api/apps/
  2. Choose your app

    Click on Marketyze Business Manager
  3. Now you will see app information including app id and secret
  4. Then you will need to copy the URL from Advertiser authorization URL

    Click on Copy

  5. You will need to open the copied URL in a new browser’s tab. It will redirect you to permissions page and you will need to go through verification process
  6. Once you’ve verified, you will again be redirected to whatever you had entered as the app’s Advertiser Redirect URL

    Here you will be able to see your auth code in the URL. See our Marketyze example below!

Please keep in mind that the auth code is for a one time use only. If you need to generate a new auth code, you will need to generate a new token as well.

Now you’re ready to get your TikTok Ads data!

STAGE 1: Generate your access token!

  1. Make a copy of this Google Sheet

     

  2. In the tab name “(1) Generate Token”, fill in your app id, auth code, and app secret.

    Click on application

  3. Then click on the “Generate Token” button

  4. Once it’s done, you will see the access token with run status and time

Click on application

STAGE 2: Get your report!

  1. In the tab name “(2) Configure”, fill in your report name, ad account id, data level, dimensions, metrics, and date range.

    Click on application
  2. Click on the “Run Report” button. This might take a long while, perhaps around 3-5 minutes

    Click on Drawing

  3. Once done, you will see the run status and the new tab created with a Tiktok_ prefix along with your defined report name

    Your report is ready! Below an example

Untitled step

If you want to run the report again, go back to the sheet and click the “Run report” button in the sheet “(2) Configure.” There is no need to recreate the token. Please keep in mind however, that re-running the report will override — and not merge — the previous data.

We’d love to hear from you if, and how you are using this template. If you need any help, please feel free to contact us via email: analytics@marketyze.io

How-to: Bulk set up tracking for link clicks on your website using Google Tag Manager

By AnalyticsNo Comments

Sometimes there might be a lot of similar links on your websites that you’d like to track as a “Click” event and see reported in Google Analytics. Examples of these are clicks on your Social Media buttons, clicks on your contact forms, or any group of similar link clicks. However, if you have a lot of buttons under one category and have to create tags for each of those events, it will get tedious creating tags one by one. We’d like to show you how to save time by using Google Tag Manager’s (or GTM) Lookup Table and RegEx Table variables.

Pre-requisite before starting

All you need to do is ensure that GTM is properly installed on your websites! Then we’ll begin by creating variables, triggers, and tags. You can follow the steps outlined below.

Create variables – Lookup Table

A Lookup Table is a variable that will allow you to pair values from one variable with your desired value. So we can decide which link clicks to track and which value to return here.

1. Click on Variables

Click on Variables

2. Click on New

Click on New

3. Click on Variable Configuration

Click on Variable Configuration…

4. Click on Lookup Table

Click on Lookup Table

5. Select Choose Built-In Variable from Input Variable

6. Click on Click URL

This built-in variable, Click URL, will display the URL of the page where the button was clicked. This is where we indicate which link click to create as an event.

Click on Click URL

7. Click on + Add Row

Click on + Add Row

8. Type your URL of any link clicks you’d like to track into input

Type your URL of any link clicks you'd like to track into input

9. Type “Social Click – Facebook” into Output

Here, I like to set my naming convention by categorizing and destination which the separator will be a dash symbol (-). For example, I name click to my Facebook page as “Social Click – Facebook.” The category is “Social Click” and the destination is “Facebook”

Type

10. Click on + Add Row

If you have several link clicks to other websites, you can fill in more by clicking Add Row

Click on + Add Row

11. Name your variables and click “Save” – Here I name it as “GA – Lookup Table”

Name your variables and click “Save” - Here I name it as “GA - Lookup Table”

Create variables – RegEx Table

In GTM, a RegEx Table is used to determine whether or not an input pattern matches and, if so, to return the corresponding output value.

1. Click on New

Click on New

2. Click on Variable Configuration

Click on Variable Configuration…

3. Click on RegEx Table

Click on RegEx Table

4. Click on {{Click URL}} from Input Variable

Click on {{Click URL}} from Input Variable

5. Click on + Add Row

Click on + Add Row

6. Paste “(.*?) – (.*)” into input

This is a regular expression that contains 2 capturing group which are (1) 1st capturing group (.*?) means to match any character until the next delimiter and (2) 2nd capturing group (.*) means to match any character until the end of string, this will ignore the next delimiter. For a dash (-) matches the character (-) literally.

Paste

7. Type “$1”

If you remember from creating Lookup Table, we have defined the naming convention with dash (-) separator. $1 here is equivalent to the text before the separator so this variable will return any value before the dash

Type

8. Name the variable – Here I name it as “GA – Category”

Name the variable

9. Click on Save

Click on Save

10. Again, click on New to create RegEx Table for label

Click on New

11. Click on Variable Configuration

Click on Variable Configuration…

12. Click on RegEx Table

Click on RegEx Table

13. Click on {{Click URL}} from Input Variable

Click on {{Click URL}} from Input Variable

14. Click on + Add Row

Click on + Add Row

15. Paste “(.*?) – (.*)” into input

Paste

16. Type “$2”

$2 here is equivalent to the text after the separator so this variable will return any value after the dash

Type

17. Name the variable – Here I name it as “GA – Label”

Name the variable

18. Click on Save

Click on Save

Create Triggers

1. Click on Triggers

Click on Triggers

2. Click on New

Click on New

3. Click on Trigger Configuration

Click on Trigger Configuration…

4. Click on Just Links

Click on Just Links

5. Click on This trigger fires on Some Link Clicks

Click on This trigger fires on Some Link Clicks

6. Select GA – Lookup Table

Select GA - Lookup Table

7. Type “undefined” – The operator here should be “does not equal”

This means that any link clicks happen their {{Click URL}} are in the Lookup Table will be fired

Type

8. Name the Trigger – Here I name it as Trigger – Link Click

Name the Trigger

9. Click on Save

Click on Save

Create Tags

1. You need to create tag to send link click event to GA by selecting as following:

    1. Tag Type: Google Analytics: Universal Analytics
    2. Track Type: Event
    3. Category: Select from variable {{GA – Category}}
    4. Action: Click (you can define whatever you’d like here)
    5. Label: Select from variable {{GA – Label}}

2. This tag need to be fired on “Trigger – Link Click” so choose this as a trigger of this tag

3. Name your tag and click “Save” – Here I name it as “GA – Link Click

Once you have done your set up, you will be able to see your event on Google Analytics under event report!

Bonus – Another shortcut

Free templates that you can use with just a few changes required from you!

en_USEnglish

Our website uses cookies and other tracking technologies to improve your browsing experience as set in our Privacy policy.

Privacy Preferences

You can turn your cookie settings on and off. Cookies of each type are available on request, except for necessary cookies.

Allow All
Manage Consent Preferences
  • Necessary cookies
    Always Active

    These cookies are strictly necessary for the operation of our website. You cannot disable these cookies.

Save