GMB API (Google My Business)
-
Upload
supergigas -
Category
Software
-
view
2.173 -
download
3
Transcript of GMB API (Google My Business)
![Page 1: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/1.jpg)
“Google My Business” APIManaging your locations at scale
![Page 2: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/2.jpg)
Agenda
● Introduction
● Google My Business (GMB)
● The GMB API
● GMB locations in AdWords
![Page 3: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/3.jpg)
Introduction
![Page 4: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/4.jpg)
Introduction
Why talk about GMB during AdWords workshops?
![Page 5: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/5.jpg)
Why Talk About GMB?
Your locations
You
I want locations extensions!
AdWords API
Maps API
I want my address / my business showing up in Maps!
I want my address showing up in Search!
Search APII want a Google+ presence for my business! G+ API
![Page 6: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/6.jpg)
Introduction / cont.Client changed address
![Page 7: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/7.jpg)
Location Management in GMBL
● Locations exist once in reality, they should also exist only once in our system
● Central repository: GMB Locations
![Page 8: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/8.jpg)
Consequences for Developers
What does this mean for you?
● Use GMB (API) for creating locations● Migrate locations from AdWords
(feeds / manual location extensions) to GMB
![Page 9: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/9.jpg)
Google My Business
![Page 10: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/10.jpg)
Google My Business
Manage business presence across Google*
● Search● Maps● Google+● AdWords
(location extensions)
* Not available in some countries
![Page 11: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/11.jpg)
GMB Locations
How to create business locations?
● Manual Creation ● Bulk Upload● New: GMB API
![Page 12: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/12.jpg)
GMB Locations / cont.
www.google.com/local/manage
![Page 13: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/13.jpg)
Location Verification
Locations have to be verified for Search, Maps, Google+
● Postcard● Phone (limited)● Instant verification (Webmaster Tools)● Bulk verification (chains)
https://support.google.com/business/answer/2911778
![Page 14: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/14.jpg)
Location Verification / cont.Manual
CreationBulk
UploadGMBAPI
No verification necessary for AdWords!
GMB Locations (unverified) GMB Locations (verified)
Verification(Postcard / Phone /
Instant / Bulk)
![Page 15: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/15.jpg)
The GMB API
![Page 16: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/16.jpg)
Goals
Enable Ads location extensions to source location information from Google My Business instead of a feed
2014 - Upgraded Location Extensions
Enable developers to programmatically create and manage business location information on Google
2015 - GMB API
Move all locations to Google My Business2016 - Sunset of Manual LEs in AdWords
![Page 17: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/17.jpg)
API Capabilities
● RESTful API, resources as JSON
● Client Libraries for Java, C#, PHP
● Create, Read, Update and Delete locations*○ Name, Address, Phone○ Categories, Hours, Website URL○ Service area○ Store code, Labels
* Delete only for un-verified locations
![Page 18: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/18.jpg)
Get Access
● Fill out form @ goo.gl/o87cwB(condition: currently more than 50 manual location extensions)
● Once approved, check outdevelopers.google.com/my-business
![Page 19: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/19.jpg)
Get Started
● Create a Google My Business accountwww.google.com/local/manage
![Page 20: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/20.jpg)
Get Started / cont.
● Create a project on Developers Consoleconsole.developers.google.com○ APIs & Auth → Enable GMB API
![Page 21: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/21.jpg)
Get Started / cont.
● Add new OAuth 2.0 client ID
![Page 22: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/22.jpg)
Get Started / cont.
● Submit project ID(form link in GMB API welcome email)
![Page 23: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/23.jpg)
Working with the GMB API
![Page 24: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/24.jpg)
Testing It Out
developers.google.com/oauthplayground
● Dev Console: Web Application, Authorize playground redirect URL
● Settings → Use own credentials → Enter Client ID
● Scope: https://www.googleapis.com/auth/plus.business.manage
● Request URI: https://mybusiness.googleapis.com/v1/accounts
![Page 25: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/25.jpg)
Testing It Out - Set Credentials● Settings → Use own credentials → Enter Client ID
![Page 26: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/26.jpg)
Testing It Out - Authorize APIs● Scope: https://www.googleapis.com/auth/plus.business.manage
![Page 27: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/27.jpg)
Testing It Out - Retrieve accounts● Request URI: https://mybusiness.googleapis.com/v1/accounts
![Page 28: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/28.jpg)
Testing It Out - Retrieve locations● Request URI: https://mybusiness.googleapis.com/v1/accounts/{id}
/locations
![Page 29: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/29.jpg)
Let’s talk code
![Page 30: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/30.jpg)
1. Initialize GMB
// Initialize GMB.Mybusiness gmb = new Mybusiness.Builder(httpTransport, jsonFactory, credential) .setApplicationName(APPLICATION_NAME) .build();
// Get list of GMB accounts.Mybusiness.Accounts.List listAccounts = gmb.accounts().list();ListAccountsResponse response = listAccounts.execute();List<Account> accounts = response.getAccounts();
// Select account to work with.Account account = selectAccount(accounts);
Your implementation
![Page 31: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/31.jpg)
2. Create Location
// Create the location.Location location = new Location();
// Set location properties.location.setLocationName("My Company");location.setWebsiteUrl("https://www.example.com");...
![Page 32: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/32.jpg)
2. Create Location / cont.
// Create an address.Address address = new Address();
// Set address properties.address.setAddressLines(Collections.singletonList( "1600 Amphitheatre Pkwy"));address.setPostalCode("94043");address.setLocality("Mountain View");...
location.setAddress(address);
![Page 33: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/33.jpg)
2. Create Location / cont.
// Create business hours.BusinessHours businessHours = new BusinessHours();
// Set timings.TimePeriod period = new TimePeriod();period.setOpenDay("Monday"); period.setOpenTime("9:00");period.setCloseDay("Monday"); period.setCloseTime("17:00");businessHours.setPeriods(Collections.singletonList(period));
location.setBusinessHours(businessHours);
![Page 34: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/34.jpg)
3. Apply Labels
● Labels are optional○ Can be used for organizing locations
○ Can be used for filtering in AdWords
○ Recommendation: Use AdWords CIDs (see later)
location.setLabels(Collections.singletonList(CID));
![Page 35: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/35.jpg)
4. Send Creation Request
CreateLocationRequest createLocationRequest = new CreateLocationRequest();createLocationRequest.setLocation(location);createLocationRequest.setLanguageCode("en-AU");
Mybusiness.Accounts.Locations.Create createLocation = gmb.accounts() .locations() .create(account.getName(),createLocationRequest);
Location createdLocation = createLocation.execute();
![Page 36: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/36.jpg)
SummarySummary
1. Initialize GMBMybusiness gmb = ...;
2. Create location, address, hoursLocation location = new Location();Address address = new Address();BusinessHours hours = new BusinessHours();
3. Apply Labelslocation.setLabels(Arrays.asList(CID));
4. Send Creation RequestCreateLocationRequest createLocationRequest = ...
![Page 37: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/37.jpg)
GMB locations in AdWords
![Page 38: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/38.jpg)
GMB account
Previously...
GMB locations
AdWords account
Campaign B
Mapped locations (campaign)
CampaignFeed / Matching Function
Campaign A
Mapped locations (customer)
CustomerFeed / Matching Function
AdWords locations
GMB UI AdWords API
( )
![Page 39: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/39.jpg)
GMB account
Now: One Repository
GMB locations
AdWords account
Campaign B
Mapped locations (campaign)
CampaignFeed / Matching Function
Campaign A
Mapped locations (customer)
CustomerFeed / Matching Function
Available locations
Feed / setLabelFilters(...)
GMB API
![Page 40: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/40.jpg)
CampaignFeed campaignFeed = new CampaignFeed();campaignFeed.setMatchingFunction(...);
CustomerFeed customerFeed = new CustomerFeed();customerFeed.setMatchingFunction(...);
Feed gmbFeed = new Feed(); gmbFeed.setSystemFeedGenerationData(...);
Let’s Talk CodeMain Steps
1. Create a new feed linked to your GMB account
2. Associate the feed to the customer
3. Associate the feed to specific ad groups / campaigns
“Link” level filter
IDENTITY(true) Enables location extensions
Campaign level filter
![Page 41: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/41.jpg)
Best Practice for Resellers
● If ...○ … your client already has a GMB account○ … you want to work with verified locations
⇒ Ask your client to add you as a GMB manager● Preserves client’s location ownership● Locations access through manager account● In PlacesLocationFeedData, use your credentials
but specify client GMB ID when syncing to AdWords
![Page 42: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/42.jpg)
Best Practice for Resellers / cont.
● If you only need GMB for AdWords location extensions
⇒ Use GMB repository account for all locations○ Create MCC-level GMB account (=repository)○ Label locations with CIDs○ Filter locations / feeds based on label in AdWords
![Page 43: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/43.jpg)
… In Code
GMB API location.setLabels(Arrays.asList(CID));
AdWords API fd = new PlacesLocationFeedData();fd.setLabelFilters(new String[]{CID});
Account: 1
Account: 2
Account: 3
GMB account
1
12
23
![Page 44: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/44.jpg)
Location Extension Migration
Oct 2015● GMB API available to AdWords
API users (>50 locations)● Manual location extensions
deprecated
● March 31, 2016● Creation of manual location
extension sunsets
● GMB API v2● General availability
Q2 2016● Auto-migration of any
locations left in AdWords
https://developers.google.com/adwords/api/docs/sunset-dates
![Page 45: GMB API (Google My Business)](https://reader030.fdocuments.net/reader030/viewer/2022021416/589b59061a28ab606f8b5091/html5/thumbnails/45.jpg)
ResourcesGMB API https://developers.google.com/my-business
Signup https://goo.gl/o87cwB
GMBL UI https://www.google.com/local/manage
Guide https://goo.gl/kadl59