45
“Google My Business” API Managing your locations at scale

GMB API (Google My Business)

Embed Size (px)

Citation preview

Page 1: GMB API (Google My Business)

“Google My Business” APIManaging your locations at scale

Page 2: GMB API (Google My Business)

Agenda

● Introduction

● Google My Business (GMB)

● The GMB API

● GMB locations in AdWords

Page 3: GMB API (Google My Business)

Introduction

Page 4: GMB API (Google My Business)

Introduction

Why talk about GMB during AdWords workshops?

Page 5: GMB API (Google My Business)

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)

Introduction / cont.Client changed address

Page 7: GMB API (Google My Business)

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)

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)

Google My Business

Page 10: GMB API (Google My Business)

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)

GMB Locations

How to create business locations?

● Manual Creation ● Bulk Upload● New: GMB API

Page 12: GMB API (Google My Business)

GMB Locations / cont.

www.google.com/local/manage

Page 13: GMB API (Google My Business)

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)

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)

The GMB API

Page 16: GMB API (Google My Business)

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)

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)

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)

Get Started

● Create a Google My Business accountwww.google.com/local/manage

Page 20: GMB API (Google My Business)

Get Started / cont.

● Create a project on Developers Consoleconsole.developers.google.com○ APIs & Auth → Enable GMB API

Page 21: GMB API (Google My Business)

Get Started / cont.

● Add new OAuth 2.0 client ID

Page 22: GMB API (Google My Business)

Get Started / cont.

● Submit project ID(form link in GMB API welcome email)

Page 23: GMB API (Google My Business)

Working with the GMB API

Page 24: GMB API (Google My Business)

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)

Testing It Out - Set Credentials● Settings → Use own credentials → Enter Client ID

Page 26: GMB API (Google My Business)

Testing It Out - Authorize APIs● Scope: https://www.googleapis.com/auth/plus.business.manage

Page 27: GMB API (Google My Business)

Testing It Out - Retrieve accounts● Request URI: https://mybusiness.googleapis.com/v1/accounts

Page 29: GMB API (Google My Business)

Let’s talk code

Page 30: GMB API (Google My Business)

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)

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)

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)

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)

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)

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)

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)

GMB locations in AdWords

Page 38: GMB API (Google My Business)

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)

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)

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)

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)

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)

… 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)

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)

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