GMB API (Google My Business)
-
Upload
supergigas -
Category
Software
-
view
2.166 -
download
3
Transcript of GMB API (Google My Business)
“Google My Business” APIManaging your locations at scale
Agenda
● Introduction
● Google My Business (GMB)
● The GMB API
● GMB locations in AdWords
Introduction
Introduction
Why talk about GMB during AdWords workshops?
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
Introduction / cont.Client changed address
Location Management in GMBL
● Locations exist once in reality, they should also exist only once in our system
● Central repository: GMB Locations
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
Google My Business
Google My Business
Manage business presence across Google*
● Search● Maps● Google+● AdWords
(location extensions)
* Not available in some countries
GMB Locations
How to create business locations?
● Manual Creation ● Bulk Upload● New: GMB API
GMB Locations / cont.
www.google.com/local/manage
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
Location Verification / cont.Manual
CreationBulk
UploadGMBAPI
No verification necessary for AdWords!
GMB Locations (unverified) GMB Locations (verified)
Verification(Postcard / Phone /
Instant / Bulk)
The GMB API
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
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
Get Access
● Fill out form @ goo.gl/o87cwB(condition: currently more than 50 manual location extensions)
● Once approved, check outdevelopers.google.com/my-business
Get Started
● Create a Google My Business accountwww.google.com/local/manage
Get Started / cont.
● Create a project on Developers Consoleconsole.developers.google.com○ APIs & Auth → Enable GMB API
Get Started / cont.
● Add new OAuth 2.0 client ID
Get Started / cont.
● Submit project ID(form link in GMB API welcome email)
Working with the GMB API
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
Testing It Out - Set Credentials● Settings → Use own credentials → Enter Client ID
Testing It Out - Authorize APIs● Scope: https://www.googleapis.com/auth/plus.business.manage
Testing It Out - Retrieve accounts● Request URI: https://mybusiness.googleapis.com/v1/accounts
Testing It Out - Retrieve locations● Request URI: https://mybusiness.googleapis.com/v1/accounts/{id}
/locations
Let’s talk code
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
2. Create Location
// Create the location.Location location = new Location();
// Set location properties.location.setLocationName("My Company");location.setWebsiteUrl("https://www.example.com");...
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);
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);
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));
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();
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 = ...
GMB locations in AdWords
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
( )
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
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
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
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
… 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
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
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