Jepto

Pricing

Blog

Sign In

Try For Free

Looker Studio

Transform your Google Business Profile data into actionable insights

Dale McGeorge

Head of Product

circle-4circle-3circle-1circle-2

In today's digital landscape, local businesses and marketers need to harness the power of data to stay competitive. Google Business Profile (GBP) data offers a wealth of information, but extracting actionable insights can be challenging.


This guide will give multiple data visualization examples to demonstrate how Jepto's Data Warehouse feature, combined with Looker Studio's visualization capabilities, can transform your GBP data into a powerful decision-making tool for Local SEO professionals. The article and accompanying report aims to be thought provoking and not used as a template for Client reporting. We encourage you to explore the different ways that the data is shown to find the most relevant one for your use case, business and data story telling objectives.

Business Profile Data Entities

  1. Profiles Overview of essential business details like name, address, and contact info.
  2. Insights Performance and user interactions analytics, including impressions and actions.
  3. Reviews Customer reviews, ratings and replies.
  4. Posts Showcase post updates, offers, and events in your reporting.
  5. Keywords Analyze search terms driving traffic to your profile.
  6. Media View and analyze images and videos across your profiles.
  7. Q&A Share your most FAQs or respond to customer questions.
  8. Profile Audit A comprehensive check of each profile's setup to ensure it's fully optimized.

1. Profiles

This section includes charts that display essential business profile data, such as the business name, address, contact details, and categories. For companies with multiple locations, it offers various tips and tricks to help you efficiently organize your profiles. These strategies include grouping profiles or using custom naming conventions, especially when dealing with locations that have the same or similar names. By implementing these techniques, you can easily differentiate between profiles, ensuring a more streamlined and effective management process.

Profiles plotted on a Map

This chart allows you to display your profiles' locations visually, with options to color-code them by state or any other field. The map and its interactivity can be fully customized, including map themes, zoom levels, satellite imagery, street view, and more. As this is the default Bubble Map in Looker, no custom setup of Google Maps keys is required—it works seamlessly out of the box.

Google Looker Studio - Profiles plotted on a Map
Open in Looker Studio

Profiles with heatmap indicating the volume of Impressions

This chart allows you to combine impression volume with location data to create a heatmap, visually representing the visibility of your profiles. By overlaying impression data onto the map, you can easily identify areas with high or low visibility, helping you to make informed decisions about your marketing and operational strategies.

Google Looker Studio - Profiles with heatmap indicating the volume of Impressions
Open in Looker Studio

Profile Services Areas

Highlight the service areas of different profiles with a custom SQL query that matches the Google Maps Place ID. This can help you to visualise areas of focus across a large amount of profiles and spot overlaps that might cause suspension issues of profiles in your account.

Google Looker Studio - Profile Services Areas
Open in Looker Studio

  -- Profile Services Areas --
  SELECT 
  locationId,
  locationName,
  date,
  JSON_EXTRACT_SCALAR(placeInfo, '$.placeName') AS placeName
FROM 
  `jepto-demo.dataset.jepto_gmb_data`, 
  UNNEST(JSON_EXTRACT_ARRAY(JSON_EXTRACT(serviceArea, '$.places.placeInfos'), '$')) AS placeInfo
WHERE date > '2021-01-01'

Profile Location Breakdown

The address of each profile is in a single field that is hard to read, but using some simple calculated fields this can be extracted to use as filters or dimensions for other charts.

Google Looker Studio - Profile Location Breakdown
Open in Looker Studio

You can copy the report to access all of the formulas used in the demo report, but here are the calculated field formulas used in the above example

Street: REGEXP_EXTRACT(address, '"addressLines":..\"(.*?)\"')
City: 	REGEXP_EXTRACT(address, '"locality": "(.*?)"')
State:	REGEXP_EXTRACT(address, '"administrativeArea":.\"(.*?)\"')
Post Code: REGEXP_EXTRACT(address, '"postalCode": "(.*?)"')
Region:	REGEXP_EXTRACT(address, '"regionCode": "(.*?)"')

Local Search Appearance

Ensure that you set the right first impression for someone viewing your profile with a good profile image and business description. Whilst Google can show a different image than your nominated profile image for contextual relevance to the query, it's best practice to ensure this is set.

Google Looker Studio - Local Search Appearance
Open in Looker Studio

Profile Status and Pending Google Updates

Easily spot which of your profiles has pending updates and whether you have control over the profile.

Google Looker Studio - Profile Links
Open in Looker Studio

Profile Links

Create clickable links to view each profile directly in maps or their review link, which can also be easily copied for sharing on social media or review invitation emails.

Profile Links
Open in Looker Studio

Profile IDs

Extract all the different IDs for each profile to be used for various purposes. Further details on the IDs below the image.

Google Looker Studio - Profile IDs
Open in Looker Studio

Store Code - This can be edited by you and used for filtering, distinguishing between profiles with the same name, or your own internal reporting.

Place ID - The Place ID is a unique identifier assigned by Google to each place in the Google Places database. This includes businesses, landmarks, and other points of interest. Its typically a string of alphanumeric characters, starting with "ChIJ" followed by a mix of letters and numbers.

Once assigned, a Place ID remains constant, even if the business name or address changes. Which is essential for integrating Google Maps and Places API into applications, websites, or for tracking purposes in local SEO.

CID - The Customer ID is used internally by Google to identify and manage business listings within their systems across Search, Ads and Maps. It can be used to directly open the business listing in Google Maps, with the following formula:

https://www.google.com/maps?cid=<YOUR_CID_HERE>

Like the Place ID, the CID remains constant even if business details change. When creating custom maps (e.g., for a multi-location business), you can use CIDs to ensure accurate placement and information for each location.

Profile Category

This table shows the primary category and the first additional category. Unfortunately Looker Studio only supports the first match with Regex so if you need to showcase all categories please see the table below that uses SQL to get all the relevant category and services data.

Google Looker Studio - Profile Category
Open in Looker Studio

Profile Category & Additional Categories

Similar to the table above, this shows the primary and additional categories of each profile. The difference between this and the above is that by using SQL we can extract all of the additional categories, not just the first additional category.

Google Looker Studio - Profile Category via SQL
Open in Looker Studio

  -- Profile Category & Additional Categories --
SELECT
    locationName,
    -- Extract the display name from the primaryCategory field
    JSON_VALUE(primaryCategory, '$.displayName') AS primary_category_name,
    -- Create a comma-separated string of additional category names
    ARRAY_TO_STRING(
        -- Create an array of category display names from additionalCategories
        ARRAY(
            -- Extract the displayName from each additional category
            SELECT JSON_EXTRACT_SCALAR(category, '$.displayName')
            FROM UNNEST(JSON_EXTRACT_ARRAY(additionalCategories, '$')) AS category
        ), 
        ', '
    ) AS additional_category_names
FROM
    `jepto-demo.dataset.jepto_gmb_data`
WHERE 
    -- Filter for the most recent data fetch
	date = '2024-06-30' -- Static date for demo purposes
    -- Enable this for daily updates: DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
ORDER BY 
    locationName ASC

Profile Services

In Google Business Profiles, a service is a subset of a given category. Services can be duplicated across multiple categories and be either system-defined or custom-defined (i.e., set by you). If you are keen to explore the different categories and services that are available, be sure to check out our FREE Discovery Tool, which visualizes this and allows you to find all the relevant categories and services for your profile using AI.

Google Looker Studio - Profile Services
Open in Looker Studio

  -- Profile Services --
  WITH primary_category_services AS (
    SELECT
        locationName,
        JSON_VALUE(primaryCategory, '$.displayName') AS primary_category_name,
        ARRAY_TO_STRING(
            ARRAY(
                SELECT JSON_EXTRACT_SCALAR(serviceType, '$.displayName')
                FROM UNNEST(JSON_EXTRACT_ARRAY(primaryCategory, '$.serviceTypes')) AS serviceType
            ), ', '
        ) AS primary_category_services
    FROM
        `jepto-demo.dataset.jepto_gmb_data`
    WHERE
  		date = '2024-06-30' -- Static date for demo purposes
        -- Enable this for daily updates: DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
),
additional_category_names AS (
    SELECT
        locationName,
        ARRAY_TO_STRING(
            ARRAY(
                SELECT JSON_EXTRACT_SCALAR(category, '$.displayName')
                FROM UNNEST(JSON_EXTRACT_ARRAY(additionalCategories, '$')) AS category
            ), ', '
        ) AS additional_category_names
    FROM
        `jepto-demo.dataset.jepto_gmb_data`
    WHERE
        date = '2024-06-30' -- Static date for demo purposes
        -- Enable this for daily updates: DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
),
exploded_additional_services AS (
    SELECT
        locationName,
        JSON_EXTRACT_ARRAY(category, '$.serviceTypes') AS serviceTypes
    FROM
        `jepto-demo.dataset.jepto_gmb_data`,
        UNNEST(JSON_EXTRACT_ARRAY(additionalCategories, '$')) AS category
    WHERE
        date = '2024-06-30' -- Static date for demo purposes
        -- Enable this for daily updates: DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
),
flattened_additional_services AS (
    SELECT
        locationName,
        JSON_EXTRACT_SCALAR(serviceType, '$.displayName') AS serviceTypeName
    FROM
        exploded_additional_services,
        UNNEST(serviceTypes) AS serviceType
),
aggregated_additional_services AS (
    SELECT
        locationName,
        ARRAY_TO_STRING(
            ARRAY_AGG(serviceTypeName), ', '
        ) AS additional_category_services
    FROM
        flattened_additional_services
    GROUP BY
        locationName
)
SELECT
    pcs.locationName,
    pcs.primary_category_name,
    pcs.primary_category_services,
    acn.additional_category_names,
    aas.additional_category_services
FROM
    primary_category_services pcs
JOIN
    additional_category_names acn
ON
    pcs.locationName = acn.locationName
JOIN
    aggregated_additional_services aas
ON
    pcs.locationName = aas.locationName
ORDER BY
    pcs.locationName ASC

2. Insights

Access valuable analytics on user interactions with your business profile/s. This includes data on impressions, searches, and actions taken by users. Insights help you understand how customers find and engage with your business, enabling data-driven decisions.

It's worth noting that multiple impressions by a unique user within a single day are counted as a single impression in Google Business Profiles as the data is deduplicated. This is in contrast to impressions in Google Search and Google Ads are counted every time the ad or search result is displayed, regardless of whether the same user sees it multiple times.

Profile visibility and actions taken

This chart focuses on visibility (how many times your profile was shown) along with the number of times a consumer took action (Web Clicks, Call Clicks, and Driving Requests).

Google Looker Studio - Profile visibility and actions taken

Profile actions types

This chart showcases the monthly distribution of user interactions with your profile over the past year, helping you visualize engagement trends.

Google Looker Studio - Profile actions types

Profile action breakdown

This chart shows the weekly total of user interactions with your profile/s over the past year, helping you spot fluctuations like the well documented direction request increase in Jan 2024.

Google Looker Studio - Profile action breakdown

Action Performance

Top-level summary of user interactions with comparisons to benchmark performance and sparkling to see any recent fluctuations in performance.

Google Looker Studio - Action Performance

Review influence to Profile visibility and actions taken

This charts helps you explore how the quantity of reviews on a profile influences your visibility and therefore the amount of actions taken (web clicks, call clicks and driving directions). Despite some outliers, it's quite evident that their is a strong relationship between review quantity and an increase of impressions and actions. Each dot represents a profile and its colour is determined by a Review range, which can be fully customised in the calculated field.

Google Looker Studio - Review influence to Profile visibility and actions taken

Actions by Day of the Week

This chart shows the monthly total of user interactions with your profile/s over the past year, helping you spot fluctuations like the well documented direction request increase in Jan 2024.

Google Looker Studio - Actions by Day of the Week

Weekly Seasonality of Behaviour

This chart shows the monthly total of user interactions with your profile/s over the past year, helping you spot fluctuations like the well documented direction request increase in Jan 2024.

Google Looker Studio - Weekly Seasonality of Behaviour

Visibility and Action/Conversion Rate

Increases in visibility should also see a corresponding rise in actions (Web Clicks, Call Clicks, and Driving Directions). This chart allows you to track how well you convert consumers into taking action on your profile as a percentage of the number of times it's shown.

Google Looker Studio - Visibility and Action/Conversion Rate

3. Reviews

Monitor and manage customer reviews for your business. This section provides an analysis of review trends, sentiment, and ratings, helping you maintain a positive online reputation and respond effectively to customer feedback.

Review Overview

Summarise all the high-level stats of each profile's reviews, replies, custom metrics like reply rate, and the average of all profiles.

Google Looker Studio - Review Overview

Reviews per Profile

The growth of reviews over time showcases which profiles are gaining social proof and which ones are stagnating.

Google Looker Studio - Reviews per Profile

Profile Average Rating

This scatter plot shows the relationship between a profile's average review rating and the number of reviews it receives. This chart can easily show outliers and allow you to focus on profiles that need attention. For example, a profile with a high number of reviews and a low average is going to take considerable effort to increase it's rating. This chart is currently showing the data of 150 profiles, across 10 years and still loads fast.

Google Looker Studio - Profile Average Rating

Profile Average Rating

This chart is helpful for understanding the distribution of reviews by their respective star ratings.

Google Looker Studio - Profile Average Rating

Rating Distribution - Vertical

This is the same concept as above, but it is a stacked column chart instead of a stacked bar chart.

Google Looker Studio - Rating Distribution - Vertical

Latest Reviews and Replies

Clean table with reviews, their replies and a search box.The Reviewer icon will show an orange star if the person leaving the review is a Google Local Guide.

Google Looker Studio - Latest Reviews and Replies

Review Callout Examples

These charts use a Community Visualization to show a single review along with the star rating and date.

Google Looker Studio - Reviews Example

Last Review Date

Getting reviews is an important part in increasing Local SEO prominence, so having a clear table of the last review for all of the profiles you manage allows you to see which profiles need some review management attention. This table is created by using a custom SQL data source which you can copy from the Blog Post.

Google Looker Studio - Last Review Date

  -- Last Review Date --
  WITH recent_data SELECT
  locationName,
  MAX(CASE WHEN reviewId IS NOT NULL THEN date END) AS LastReviewDate,
  DATE_DIFF(CURRENT_DATE(), MAX(CASE WHEN reviewId IS NOT NULL THEN date END), DAY) AS DaysSinceLastReview
FROM
 `jepto-demo.dataset.jepto_gmb_data`
WHERE
  date BETWEEN '2020-01-01' AND CURRENT_DATE()
GROUP BY
  locationName
ORDER BY DaysSinceLastReview DESC
LIMIT 100;

Review Rating Moving Average

Monitor your review velocity along with the aggregated average rating. The vertical bars represent the number of reviews for a given week using an ISO week with abbreviation and measured on the left axis, and the line showing average rating which uses the right y-axis. With this combination you should be able to see weeks of increase/decrease of reviews along with the influence they have towards the average rating.

Google Looker Studio - Review Rating Moving Average

4. Posts

Google Business Profile posts are a great feature for including updates, offers, and events within the SERP for branded searches. These charts offer different ways to display the posts you have published on your profies.

The data for the number of views and clicks on a post were removed by Google in Feb 2023. So if you need to track clicks you can do this with UTM parameters or tracking links.

Latest Post

Show the most recent post by combining two tables, one with the image and date and the other with the post content.

Google Looker Studio - Latest Post

Posts Grid

This grid utilises a Community Visualization with calculated fields for the date, along with some custom HTML and CSS to replicate the look of Google Posts.

Google Looker Studio - Posts Grid

Posts Table

If you have a lot of posts you can show them in a table along with the link of the post as a hyperlink which will open in a new tab.

Google Looker Studio - Posts Table

Posts UTM

Ensure that you have consistent tracking with your UTM parameters by extracting them in a table for easy reference.

Google Looker Studio - Posting Frequency

Posting Frequency

Quickly check on the frequency and volume of posts per month, or any other time period that you wish to aggregate by.

Posting Frequency

5. Keywords

The search terms that trigger an impression of your Business Profile on Google are incredibly valuable for understanding how customers are discovering your business. Analyzing this keyword data allows you to gain insights into the exact queries people use when they find your profile, helping you tailor and optimize your content for better visibility and relevance. By understanding customer intent through these search terms, you can enhance your profile to better align with what potential customers are looking for.

This optimization can involve updating your business description, services, and posts to reflect these keywords, ultimately improving your visibility in relevant searches. Additionally, this data can guide you in creating targeted content, such as blog posts or Google Posts, that directly addresses common queries or needs expressed by users, making your profile more relevant and useful. Regular monitoring and updating based on this keyword data not only keeps your profile competitive but also increases the likelihood of converting impressions into actual visits or calls, significantly boosting your business’s performance on Google.

It's important to note that Google imposes a threshold before revealing the actual search volume. This means that only search terms that reach a certain level of impressions will display the search volume metric. For less common or long-tail keywords Google provides a threshold, citing privacy concerns related to the potential for tracking individual users.

Keyword Trend

A clean line chart displays the monthly search volume fluctuations, making it easy to spot trending keywords. Since the search volume data is only available at a monthly level, you can't go down to the weekly or daily time scale.

Google Looker Studio - Keyword Trend

Search Volume over the past 6 months

This pivot table is a great way of to showcase keyword search volume aggregated at both they individual keyword and monthly level.

Google Looker Studio - Search Volume over the past 6 months

Keyword Performance

Search Volume alone lacks context as to whether you are increasing your brand presence, so this table aims to show the relative performance to the last period and the overall reliance of that keyword on driving visibility.

Google Looker Studio - Keyword Performance

Branded Search Queries

Give your report viewers control over whether branded keywords are included in your reporting.

Google Looker Studio - Branded Search Queries

Animated Keyword Movement

This chart uses animation through a Community Visualization so you can see the movement of keywords across each month. It's also great to spot any seasonality and rising/falling keywords requiring further investigation.

Google Looker Studio - Keyword Movement

Branded Search Queries

Give your report viewers control over whether branded keywords are included in your reporting.

Google Looker Studio - Branded Search Queries

6. Media

Images and videos are playing an increasing role within how your business profile is presented in the SERPs. This section has a variety of charts that allow you to easily audit and analyze your visual content. Ensuring that everything is optimized and up-to-date, will enhance your profile’s appeal and providing a better experience for potential customers.

Media List

Media items that have been uploaded to a profile via the GBP dashboard rely on Google to set the category. If you use Jepto to upload the media items you will be able to set the category and provide a text description (We use AI to generate this for you) which is shown with the image in the gallery.

Google Looker Studio - Media List

Media Gallery

This is a community Visualization grid to provide a quick way to scan through all of the media items across your profiles.

Google Looker Studio - Media Gallery

Media Gallery with category

This community visualization combines media items with their category which is used by Google for filtering in the image gallery. The category can be changed in the Jepto Local Listing media feature.

Google Looker Studio - Media Gallery with category

Media Category

Media items can be assigned to a particular category when uploaded, or afterwards (when using Jepto's  Local Listings feature), which is then used by Google to display in different parts of the Business Profile within search and maps. If you you see a large amount of items in 'Additional' this is because Google can't determine the appropriate category for your media items.

Google Looker Studio - Media Category

7. Questions & Answers

Track and respond to questions from users about your business. This section helps you maintain an active and informative presence on your profile by clearly laying out the questions and votes across profiles.

Questions & Answers

An overview table showing the Questions and Answers across your profiles. Note that Questions can have answers by multiple users.

Google Looker Studio - Questions & Answers

Questions & Answers Performance

Top-level summary of user interactions with comparisons to benchmark performance and sparkling to see any recent fluctuations in performance.

Google Looker Studio - Questions & Answers Performance

8. Audit

Conduct a comprehensive audit of your Google Business Profile to ensure all information is accurate and optimized. This section identifies areas for improvement and ensures that your profile adheres to best practices for maximum impact.

Profile Audit

The completeness of a profile has a positive impact on local ranking, so this table gives a high-level overview of which features have been set up and which ones might need attention. By optimizing each element, you can maximize your visibility, attract more local customers, and ultimately boost your business's online presence.

For this audit demonstration we have chosen 19 different checks across various parts of a profile, but can be extended.

Google Looker Studio - Profile Audit

Here is the SQL Query that is used to create this table. You can modify the query and add any other checks that you would like.


  -- Profile Audit --
  -- This query calculates the completeness percentage for Google Buisiness Profiles --

WITH location_data AS (
  -- Combine all CTEs into a single CTE for efficiency
  SELECT
    r.locationId,
    r.has_primary_phone,
    r.has_website_url,
    r.has_attributes,
    r.has_reviews,
    r.has_answers,
    r.has_description,
    r.has_address,
    r.has_service_areas,
    r.has_regular_hours,
    r.has_special_hours,
    r.has_additional_categories,
    COALESCE(m.has_profile_image, FALSE) AS has_profile_image,
    COALESCE(m.has_cover_image, FALSE) AS has_cover_image,
    COALESCE(m.has_logo_image, FALSE) AS has_logo_image,
    COALESCE(m.has_exterior_image, FALSE) AS has_exterior_image,
    COALESCE(m.has_interior_image, FALSE) AS has_interior_image,
    COALESCE(m.has_video, FALSE) AS has_video,
    COALESCE(p.has_post, FALSE) AS has_post,
    COALESCE(q.has_question, FALSE) AS has_question
  FROM
    -- Subquery for recent data
    (SELECT
      locationId,
      MAX(CASE WHEN primaryPhone IS NOT NULL THEN TRUE ELSE FALSE END) AS has_primary_phone,
      MAX(CASE WHEN websiteUrl IS NOT NULL THEN TRUE ELSE FALSE END) AS has_website_url,
      MAX(CASE WHEN attributes IS NOT NULL THEN TRUE ELSE FALSE END) AS has_attributes,
      MAX(CASE WHEN totalReviewCount > 0 THEN TRUE ELSE FALSE END) AS has_reviews,
      MAX(CASE WHEN totalAnswerCount > 0 THEN TRUE ELSE FALSE END) AS has_answers,
      MAX(CASE WHEN profile IS NOT NULL THEN TRUE ELSE FALSE END) AS has_description,
      MAX(CASE WHEN address IS NOT NULL THEN TRUE ELSE FALSE END) AS has_address,
      MAX(CASE WHEN serviceArea IS NOT NULL THEN TRUE ELSE FALSE END) AS has_service_areas,
      MAX(CASE WHEN regularHours IS NOT NULL THEN TRUE ELSE FALSE END) AS has_regular_hours,
      MAX(CASE WHEN specialHours IS NOT NULL THEN TRUE ELSE FALSE END) AS has_special_hours,
      MAX(CASE WHEN additionalCategories IS NOT NULL THEN TRUE ELSE FALSE END) AS has_additional_categories
    FROM `jepto-demo.dataset.jepto_gmb_data`
    WHERE date = '2024-06-30'  
      -- Use DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY) for daily updates
    GROUP BY locationId) r
  LEFT JOIN
    -- Subquery for media data
    (SELECT
      locationId,
      MAX(CASE WHEN REGEXP_EXTRACT(mediaLocationAssociation, r'"category": "(.*?)"') = 'PROFILE' THEN TRUE ELSE FALSE END) AS has_profile_image,
      MAX(CASE WHEN REGEXP_EXTRACT(mediaLocationAssociation, r'"category": "(.*?)"') = 'COVER' THEN TRUE ELSE FALSE END) AS has_cover_image,
      MAX(CASE WHEN REGEXP_EXTRACT(mediaLocationAssociation, r'"category": "(.*?)"') = 'LOGO' THEN TRUE ELSE FALSE END) AS has_logo_image,
      MAX(CASE WHEN REGEXP_EXTRACT(mediaLocationAssociation, r'"category": "(.*?)"') = 'EXTERIOR' THEN TRUE ELSE FALSE END) AS has_exterior_image,
      MAX(CASE WHEN REGEXP_EXTRACT(mediaLocationAssociation, r'"category": "(.*?)"') = 'INTERIOR' THEN TRUE ELSE FALSE END) AS has_interior_image,
      MAX(CASE WHEN mediaFormat = 'VIDEO' THEN TRUE ELSE FALSE END) AS has_video
    FROM `jepto-demo.dataset.jepto_gmb_data`
    WHERE date >= '1970-01-01' AND mediaLocationAssociation IS NOT NULL
    GROUP BY locationId) m ON r.locationId = m.locationId
  LEFT JOIN
    -- Subquery for post data
    (SELECT
      locationId,
      MAX(CASE WHEN postId IS NOT NULL AND date > '2000-01-01' THEN TRUE ELSE FALSE END) AS has_post
    FROM `jepto-demo.dataset.jepto_gmb_data`
    WHERE postId IS NOT NULL AND date > '2000-01-01'
    GROUP BY locationId) p ON r.locationId = p.locationId
  LEFT JOIN
    -- Subquery for question data
    (SELECT
      locationId,
      MAX(CASE WHEN question IS NOT NULL THEN TRUE ELSE FALSE END) AS has_question
    FROM `jepto-demo.dataset.jepto_gmb_data`
    WHERE question IS NOT NULL AND date > '2000-01-01'
    GROUP BY locationId) q ON r.locationId = q.locationId
),
final_data AS (
  -- Calculate completeness percentage
  SELECT
    locationId,
    has_primary_phone,
    has_website_url,
    has_attributes,
    has_reviews,
    has_answers,
    has_description,
    has_address,
    has_service_areas,
    has_regular_hours,
    has_special_hours,
    has_additional_categories,
    has_profile_image,
    has_cover_image,
    has_logo_image,
    has_exterior_image,
    has_interior_image,
    has_video,
    has_post,
    has_question,
    ROUND(
      LEAST(
        (CAST(has_primary_phone AS INT64) + 
         CAST(has_website_url AS INT64) + 
         CAST(has_attributes AS INT64) + 
         CAST(has_reviews AS INT64) + 
         CAST(has_answers AS INT64) +
         CAST(has_description AS INT64) + 
         CAST(has_address AS INT64) + 
         CAST(has_service_areas AS INT64) + 
         CAST(has_regular_hours AS INT64) + 
         CAST(has_special_hours AS INT64) +
         CAST(has_additional_categories AS INT64) + 
         CAST(has_profile_image AS INT64) + 
         CAST(has_cover_image AS INT64) + 
         CAST(has_logo_image AS INT64) +
         CAST(has_exterior_image AS INT64) + 
         CAST(has_interior_image AS INT64) + 
         CAST(has_video AS INT64) + 
         CAST(has_post AS INT64) + 
         CAST(has_question AS INT64)) * 100.0 / 19,
        100
      ),
      2
    ) AS completeness_percentage
  FROM location_data
)
-- Main query to output final results
SELECT
  f.locationId,
  l.locationName,
  f.has_primary_phone,
  f.has_website_url,
  f.has_attributes,
  f.has_reviews,
  f.has_answers,
  f.has_description,
  f.has_address,
  f.has_service_areas,
  f.has_regular_hours,
  f.has_special_hours,
  f.has_additional_categories,
  f.has_profile_image,
  f.has_cover_image,
  f.has_logo_image,
  f.has_exterior_image,
  f.has_interior_image,
  f.has_video,
  f.has_post,
  f.has_question,
  f.completeness_percentage
FROM final_data f
LEFT JOIN (
  SELECT DISTINCT locationId, ANY_VALUE(locationName) AS locationName
  FROM `jepto-demo.dataset.jepto_gmb_data`
  WHERE date = '2024-06-30'
  -- Use DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY) for daily updates
  GROUP BY locationId
) l ON f.locationId = l.locationId
ORDER BY f.completeness_percentage DESC, l.locationName

Was this post useful?
Nice one!

Thanks a lot for your feedback! If you’d like a member of our support team to respond to you, please send a message here

Please try again

Oops! Something went wrong while submitting the form.