The Google Ads API supports linking Google Ads accounts to other product accounts. This guide explains how to use version v16 of the API to link your accounts.
Ways to link accounts
When linking a Google Ads account to another product account, there are two different ways in which the linking can happen.
Invitation flow
Invitation flow is used when you have administrator access to the Google Ads account, but not the product account. This flow works in two scenarios:
- You want to link the two accounts and create an invitation for an administrator of the product account. The product account administrator accepts the invitation to complete the account linking process.
- The product account administrator wants to link the two accounts, but doesn't have access to the Google Ads account. The product account administrator creates an invitation, and you accept the invitation and complete the linking process.
The following methods are used in this scenario:
Scenario | Action | Remarks |
---|---|---|
Scenario 1 | Create an invitation | Use the
ProductLinkInvitationService.CreateProductLinkInvitation method
to create an invitation. The status
of the
ProductLinkInvitation shouldn't be set; the Google Ads API server
will set this to REQUESTED upon the successful completion of
the API call. |
Inspect the status of an invitation | Use GoogleAdsService.Search
or GoogleAdsService.SearchStream
to query the product_link_invitation
resource and inspect its status. |
|
Scenario 2 | Retrieve an invitation | Use GoogleAdsService.Search
or GoogleAdsService.SearchStream
to query the product_link_invitation
resource. Filter for
status = PENDING_APPROVAL to accept or reject
a pending invitation. |
Accept or reject an invitation | Use the
ProductLinkInvitationService.UpdateProductLinkInvitation method to
update the status of the
ProductLinkInvitation to ACCEPTED or
REJECTED . |
|
Revoke an invitation | Use the
ProductLinkInvitationService.RemoveProductLinkInvitation method to
revoke an existing
ProductLinkInvitation . |
The following common errors can be thrown in this workflow:
Error code | Explanation |
---|---|
ProductLinkInvitationError.PERMISSION_DENIED |
The customer doesn't have the permission to perform this action. |
ProductLinkError.NO_INVITATION_REQUIRED |
An invitation couldn't be created, since the user already has administrator access to the invited account. The user should use the ProductLinkService to directly create an active link. |
Direct linking flow
Direct linking flow is used when you have administrator access to both the Google Ads account and the product account. In this case, you directly link the Google Ads account to the product account instead of sending an invitation.
The following methods are used in this scenario:
Action | Remarks |
---|---|
Create an active link | Use
ProductLinkService.createProductLink to create a
ProductLink . |
Disable an active link | Use
ProductLinkService.removeProductLink to remove an
active
ProductLink . |
Retrieve active links | Use
GoogleAdsService.Search or
GoogleAdsService.SearchStream
to query the
product_link resource. |
The following common errors may be thrown in this workflow:
Error code | Explanation |
---|---|
ProductLinkError.CREATION_NOT_PERMITTED |
An account linking was attempted using the direct link flow, but this
isn't supported due to lack of permissions. The user should use
ProductLinkInvitationService
to do the invitation flow instead.
|
ProductLinkError.INVITATION_EXISTS |
A link cannot be created because a pending invitation already exists. |
Changes to AccountLinkService and MerchantCenterLinkService
If you used MerchantCenterLinkService or AccountLinkService in the past to link a Google Ads account to another product account, then you need to migrate your existing application to one of the workflows listed earlier. The following table shows the migration status:
Link type | Supported in new services? | Support available as of | Remarks |
---|---|---|---|
DataPartnerIdentifier |
Yes | v15 | Migrate off MerchantCenterLinkService |
GoogleAdsIdentifier |
Yes | v16 | Migrate off AccountLinkService |
MerchantCenterIdentifier |
Yes | v16 | Migrate off AccountLinkService |
AdvertisingPartnerIdentifier |
Yes | v16 | Migrate off AccountLinkService |
ThirdPartyAppAnalyticsLinkIdentifier |
No | – | Continue using AccountLinkService |