Supermetrics Support Forum

Getting Started - Twitter Public Data Connector

This guide covers the basic functionality of the Supermetrics Twitter Public Data connector for Sheets and Data Studio, and gives examples of how to set up a query in two popular products.


Quick links to sections below:


Basics

The Twitter Public Data connector allows you to collect publicly available data about users and tweets, though the data and fields available are much more limited in this public API version than the full Twitter Analytics. It uses a query selection system for the type of data you would like to collect, which limits which metrics can be used, but prevents user errors from combining invalid field combinations.


Query Types

The Twitter Public Data connector supports 3 type of queries:

  • Twitter tweets by keyword - allows you to pull the latest X tweets that contain certain keywords
  • Twitter user data - gathers data about specific user names, such as Followers count, Tweet count, location of user, etc.
  • Twitter user tweets - gathers data about specific tweets the user made, as well as retweet and reply data.


Query type selection in Google Sheets:

Orange box highlights the "Select query type" option in Google Sheets sidebar


Query type selection in Data Studio:

Blue arrow points to the "Query type" drop-down as seen in the Data Studio connector configuration for the Twitter Public Data source.


Example Query Setup in Google Sheets

Here is a walk-through for setting up a 'Twitter user tweets' query using the Google Sheets Add-on. (The example for Data Studio is below this section.)

  1. With an empty cell selected, launch the sidebar in Google Sheets.
  2. In the Data Source section, scroll down to the Simple Connectors part of the list and then select the connector "Twitter Public Data (beta)"

    The Twitter Public Data connector in Google Sheets, with the blue bird icon.

  3. It will direct you to log into a Twitter account. Note that any valid account will work, it's not pulling data from any specific account. Click Sign In to continue.

    Orange arrow points to blue "Sign In" button to complete the login process to Twitter.

  4. When the login process is complete, it will redirect you back to the sidebar. Click on Report configuration to continue the setup.

    Orange box highlighting the "Report configuration" section of the sidebar, clicking it will expand the options for the query.

  5. In the Select query type drop-down, select "Twitter user tweets".

    "Twitter user tweets" is highlighted in blue with a check mark to show it is selected to use for the query.

  6. In the Twitter usernames: box, add the username you wish to search for. You can add expand the box and add more than one name, one each on a new line.
  7. The Translate to: option lets you get translations of the tweets. This is optional and defaults to "No Translation".
  8. In the # of rows per item: drop-down, select "10". This will pull the most recent 10 tweets for each user name you added. For better performance, avoid higher row values.
  9. In the Include retweets: and Include replies: drop-downs, select "no" to omit data for these.

  10. Open the Select metrics section and click on the box to see what metrics as available. Based on the query type selected, different metrics may be shown. Note that as this is a simple connector, it's field options are more limited.

    Orange box highlights the "Select metrics" section of the sidebar and also shows the drop-down with the available metrics.

  11. Open the Split by section and click on the box in the Split by rows to see what dimensions as available.

  12. You can also apply filters to some fields under Filter, or set "no headers" in the advanced settings under the Options. These are optional though, and not required to make the query work.
  13. At the top of the sidebar, click Get Data to Table to run the query and see the results. In this example, this is the most recent 10 tweets made by Supermetrics and their lifetime like count.

    Example query configuration and results to get basic information about tweets from @supermetrics account

  14. If further adjustments need to be made, click Modify. Note that due to the nature of the "Query type" system, you cannot combine Tweet data with the user data in a single query. If you get errors, see the Common Issues section in this article at the bottom.


Example Query Setup in Data Studio

Here is a walk-through for setting up a 'Twitter user tweets' query using the Data Studio connector.

  1. In Data Studio, add a new data source and search for "Twitter Public Data" in the Partner Connectors section. Click SELECT to add it.

  2. Click AUTHORIZE to start the authorization process for Data Studio. In the resulting pop-up, click your Google account you are using for Data Studio access. Click Allow to continue (else the connector won't function).
  3. Click AUTHORIZE for Twitter Public Data and follow the prompts to log into a Twitter account. Note that any valid Twitter account will work, this is not pulling data from a specific account.

  4. Once the login is complete, the configuration page will show the rest of the settings for the data source.
  5. In the Query type drop-down,  select "Twitter user tweets".

  6. Go down to the ***************** SETTINGS FOR QUERY TYPE: Twitter user tweets ***************** section.
  7. In the Twitter usernames box, add one or more user names, comma separated.
  8. In the Include retweets drop-down, select "no". This will only pull tweets made by the user directly.
  9. In the Include replies drop-down, select "no". This will not pull replies data into the query.
  10. The Translate to drop-down can be set to another language to translate the tweet text. This is optional and defaults to "No translation".
  11. If you want to be allowed to change the above settings in Data Studio's UI directly, you can check one or more of the "Allow X to be modified in reports" boxes next to the setting. This is optional.

    Example configuration in Data Studio for the "Twitter user tweets" query type

  12. You do not need to fill out any other query section as it will not be used. Note that you can only set one query type at a time with this connector. If you need other query types, repeat this process to create a new data source with the different query type selected.
  13. Give the Data Source a meaningful name.

  14. Click CONNECT in the upper right-hand corner to create the data source.
  15. It will take you to a page with all the connector's fields that are available for the "Twitter user tweets" query type. Click ADD TO REPORT to continue.
  16. Create a report element on the report page, selecting your new source as the Data Source. Add the metrics and dimensions available to create your query. In this example, a table is used to show the last ~2000 posts made to the Supermetrics page.

  17. If you need to modify the query, you can do so from the Data bar in the Data Studio UI and it will update automatically to reflect your changes.

Common Issues

"No account objects selected" Errors

More often affects Data Studio. Check that you filled out the proper query section and that there's a valid username name given.


Query Runs Very Slowly

The API being used is not that efficient, so the more accounts you try pull or the more rows, the slower it gets. Try reducing the number of accounts you are trying to get data for to increase performance. If using Sheets, try reducing the # of Rows per item value to under 200.


No Data over Time is Available/I Can't Report Over Time?

Sadly, this version of the API only shows lifetime totals for most metrics and you won't be able to report changes over time unless you use the "Combine new with old" feature in Sheets and run this every day to collect your own historical data (this feature is not available at all in Data Studio). 


No Data for User

Make sure you are using the Twitter user name given in the URL to their Twitter page. This will ensure you are getting data from the correct account.


The Metrics I Wanted Are Not Listed/How Do I Get Twitter Analytics Engagement Data?

Unfortunately the Basic API does not offer these. We are working with Twitter to try to get access to the Enterprise API that has this data, but discussions are ongoing and we cannot provide a timeline for when this better connector will be available.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.