You can import customer information using the Google My Business import integration. With this connector, you can consolidate statistics, including ratings and reviews, of all your locations.

This topic includes:

Prerequisites

Use the TD Console to Create Your Connection

Obtain your Credentials

  1. Get OAuth 2.0 Client credentials from Developers console for your API project.

  2. Create Refresh token for OAuth 2.0 Client.
    You can use your own OAuth 2.0 compliant way to do that or do it go through guide: Google's OAuth playground. Please make sure you use OAuth2 client ID and OAuth2 client secret from API project you created.

Important: API Scope is - https://www.googleapis.com/auth/business.manage

Create a New Connection

When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information.

  1. Open TD Console.

  2. Navigate to Integrations HubCatalog.

  3. Search for and select Google My Business.



  4. The following dialog opens.



  5. Enter the required credentials which you obtained in the Obtain your credentials section. 

  6. Enter a name for your connection and select Done.

Transfer Your Google My Business Account Data to Treasure Data

After creating the authenticated connection, you are automatically taken to the Authentications tab. Look for the connection you created and select New Source.

Connection

  1. Type a name for your Source in the Data Transfer field.

  2. Click Next


Source Table

  1. Edit the following parameters according to your needs:



Parameters

Description

Data Type

  • Accounts - fetch accounts data

  • Locations - fetch all locations data for all accounts

  • Location Reviews - fetch all reviews data for all locations

  • Location Report Insights - fetch report data for all locations.

Metric Type

Required only for Location Report Insights.

  • Basic - A series of Metrics and BreakdownMetrics associated with a Location over a time range.

  • Driving Direction - A location indexed with the regions that people usually come from. This is captured by counting how many driving-direction requests to this location are from each region.

Metrics

Required only for Location Report Insights and Metric type set as Basic.

  • ALL - Shorthand to request all available metrics. Which metrics are included in ALL varies, and depends on the resource for which insights being requested.

  • QUERIES_DIRECT - The number of times the resource was shown when searching for the location directly.

  • QUERIES_INDIRECT - The number of times the resource was shown as a result of a categorical search (for example, restaurant).

  • QUERIES_CHAIN - The number of times a resource was shown as a result of a search for the chain it belongs to, or a brand it sells. For example, Starbucks, Adidas. This is a subset of QUERIES_INDIRECT.

  • VIEWS_MAPS - The number of times the resource was viewed on Google Maps.

  • VIEWS_SEARCH - The number of times the resource was viewed on Google Search.

  • ACTIONS_WEBSITE - The number of times the website was clicked.

  • ACTIONS_PHONE - The number of times the phone number was clicked.

  • ACTIONS_DRIVING_DIRECTIONS - The number of times driving directions were requested.

  • PHOTOS_VIEWS_MERCHANT - The number of views on media items uploaded by the merchant.

  • PHOTOS_VIEWS_CUSTOMERS - The number of views on media items uploaded by customers.

  • PHOTOS_COUNT_MERCHANT - The total number of media items that are currently live that have been uploaded by the merchant.

  • PHOTOS_COUNT_CUSTOMERS - The total number of media items that are currently live that have been uploaded by customers.

  • LOCAL_POST_VIEWS_SEARCH - The number of times the local post was viewed on Google Search.

  • LOCAL_POST_ACTIONS_CALL_TO_ACTION - The number of times the call to action button was clicked on Google.

Options

Optional for Location Report Insights and Metric type set as Basic.
This field is sub-entity of Metrics field.

  • AGGREGATED_TOTAL - Return values aggregated over the entire time frame. This is the default value.

  • AGGREGATED_DAILY - Return daily timestamped values across time range.

  • BREAKDOWN_DAY_OF_WEEK - Values will be returned as a breakdown by day of the week. Only valid for ACTIONS_PHONE metric.

  • BREAKDOWN_HOUR_OF_DAY - Values will be returned as a breakdown by hour of the day. Only valid for ACTIONS_PHONE metric.

Start Time

Optional for Location Report Insights and Metric type set as Basic.
A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23Z".

If empty Start Time will be calculated as current time of actual request to API minus 18 month.
Field doesn’t allow time in more than 18 month in past.

End Time

Optional for Location Report Insights and Metric type set as Basic.
A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23Z".

If empty End Time will be calculated as current time of actual request to API.
Field doesn’t allow time in future.

Incremental Loading

Optional for Location Report Insights and Metric type set as Basic.

It enables incremental report loading with new Start Time and End Time automatic calculation.
Example: if you start incremental loading with Start Time = 2014-10-02T15:01:23Z and End Time = 2014-10-03T15:01:23Z, on the next job run new Start Time will be 2014-10-03T15:01:23Z and End Time = 2014-10-04T15:01:23Z.

Number of Days

Optional only for Location Report Insights and Metric type set as Driving Direction.

  • SEVEN - 7 days. This is the default value if not set.

  • THIRTY - 30 days.

  • NINETY - 90 days.

Language Code

Optional only for Location Report Insights and Metric type set as Driving Direction.
The BCP 47 code for the language. If a language code is not provided, it defaults to English.


Data Settings

  1. Click Next.
    The Data Settings page opens.

  2. Optionally, edit the data settings or skip this page of the dialog.

 Data Preview 

You can see a preview of your data before running the import by selecting Generate Preview. Data preview is optional and you can safely skip to the next page of the dialog if you choose to. 

  1. Click Next. 

The Data Preview page opens. 

  1. If you want to preview your data, select Generate Preview.

  2. Verify the correct data is showing.

 Data Placement

In this dialog, you will specify where your data will be placed and schedule how often it will run this import.

  1.  Click Next

Under Storage you will create a new or select an existing database and create a new or select an existing table for where you want to place the imported data.

  1. Select a Database > Select an existing or Create New Database.

  2. Select a TableSelect an existing or Create New Table.

  3. Choose the Append or Replace method for importing the data.

    • Append (default)-Data import results are appended to the table.
      If the table does not exist, it will be created.

    • Replace-Replaces the entire content of an existing table with the result output of the query.
      If the table does not exist, a new table is created. 

  4. Select the Timestamp-based Partition Key column.
    If you want to set a different partition key seed than the default key, you can specify the long or timestamp column as the partitioning time. As a default time column, it uses upload_time with the add_time filter.

  5. Select the Timezone for your data storage.

 Under Schedule, you can choose when and how often you want to run this query.

  •  Run once:

    1. Select Off.

    2. Select Scheduling Timezone.

    3. Select Create & Run Now.

  • Repeat the query:

    1. Select On.

    2. Select the Schedule. The UI provides these four options: @hourly@daily and @monthly or custom cron.

    3. You can also select Delay Transfer and add a delay of execution time.

    4. Select Scheduling Timezone.

    5. Select Create & Run Now.

After your transfer has run, you can see the results of your transfer in Data Workbench > Databases.


  • No labels