Skip to content
LogoLogo

Google apps

Three apps connect a Picked project to a Google account: Google Ads, Google Analytics and Google Tag Manager. Each app keeps the connection and one or two settings, and tests the connection.

How to connect Google Ads, Google Analytics or Google Tag Manager gives the steps.

Manifests

PropertyGoogle AdsGoogle AnalyticsGoogle Tag Manager
handlegoogle-adsgoogle-analyticsgoogle-tag-manager
nameGoogle AdsGoogle AnalyticsGoogle Tag Manager
scopesNoneNoneNone
offlineAccessNot setNot setNot set
eventsNoneNoneNone
slotsapp-homeapp-homeapp-home
workflowToolscheck_connectioncheck_connectioncheck_connection
Slot titleGoogle Ads connectionGoogle Analytics connectionGoogle Tag Manager connection
Slot height420420420
Google scopehttps://www.googleapis.com/auth/adwordshttps://www.googleapis.com/auth/analytics.readonlyhttps://www.googleapis.com/auth/tagmanager.readonly

The apps ask for no access to the data of the project. The slot height is in pixels. See App manifest for each property.

App page

The app-home slot shows the app page. The page has these parts:

PartWhat it does
Connect <name>Opens a new window at the Google sign-in page. Shows when the installation has no connection.
Account lineConnected as <email>. Shows Connected as a Google account when Google gives no email.
Setting fieldsThe settings of the app. See Settings. The fields show when the installation has a connection.
Save settingsStores the settings.
Test connectionRuns the test of the app. See Connection test.
DisconnectRemoves the connection. See Removal of the connection.
Status lineThe result of the last action. See Page messages.
ListAfter a test, one item for each account, property or container that the Google account opens. The list has the label What the connection reaches.

Google sign-in

The app uses the Google OAuth client of Picked. The person who connects does not make a client.

The app asks Google for these scopes:

  • openid and email, to get the email address of the Google account.
  • The Google scope of the app. See Manifests.

The app sends access_type=offline. Google then gives a refresh token. Google shows the consent page each time that a person connects. The app does not add scopes that the Google account gave to Picked before.

The connection belongs to the installation. It does not belong to the person who connects.

Settings

Save settings replaces all of the settings of the installation. The app removes spaces at the start and the end of each value.

FieldKeyRequiredFormat
Customer IDcustomerIdYesTen digits. The app removes each hyphen and space. Example: 123-456-7890.
Manager account IDloginCustomerIdNoTen digits. The app removes each hyphen and space.

Customer ID is the Google Ads account of the project. Manager account ID is the manager account that the Google account uses to get to the customer account. The app sends it to Google Ads in the login-customer-id header.

Google Analytics

FieldKeyRequiredFormat
Property IDpropertyIdYes6 to 12 digits. The app removes a properties/ prefix. Example: 250000001.

Property ID is a Google Analytics 4 property.

Google Tag Manager

FieldKeyRequiredFormat
Container IDcontainerIdYesGTM- and 4 to 12 letters or digits. The app changes letters to upper case. Example: GTM-XXXXXXX.

Container ID is a web container, as Tag Manager shows it.

Settings messages

MessageWhen
Settings savedSave settings is complete.
<field> is requiredA required field is empty.
Customer ID is ten digits, such as 123-456-7890Customer ID is not ten digits.
Manager account ID is ten digits, such as 123-456-7890Manager account ID is not ten digits.
A property ID is a number, such as 250000001Property ID is not 6 to 12 digits.
A container ID looks like GTM-XXXXXXXContainer ID does not match the format.

Connection test

Test connection and the check_connection tool run the same test. The test does these things:

  1. It makes sure that the installation has a connection.
  2. It makes sure that the Google account gave the Google scope of the app.
  3. When the app has no current access token, it gets one from Google with the refresh token.
  4. It reads the list of what the Google account can open.
  5. It reads the item of the saved setting.
AppListItem
Google AdsThe accounts that the Google account can open, from customers:listAccessibleCustomers.The name of the Customer ID account, from googleAds:search.
Google AnalyticsThe properties of up to 200 accounts, from accountSummaries.The property of Property ID, from the Google Analytics API.
Google Tag ManagerEach container of the first 20 Tag Manager accounts.The container of Container ID in the list.

The Google Ads app sends the developer token of Picked for the Google Ads API with each of its requests.

Each item of the list on the page has the format <label>: <value>:

AppLabelValue
Google AdsAccountThe customer ID, for example 123-456-7890.
Google AnalyticsThe name of the account, or Property<property name> (<property ID>)
Google Tag ManagerThe name of the account<container name> (<container ID>)

Test messages

MessageWhen
Connected to <name> (<ID>)The test passed. <name> is the name of the account, property or container.
<app name> is not connectedThe installation has no connection.
Connect again and allow <app name> accessThe Google account did not give the Google scope of the app.
Save the customer ID of the account to useGoogle Ads has no saved Customer ID.
Save the ID of the property to useGoogle Analytics has no saved Property ID.
Save the ID of the container to useGoogle Tag Manager has no saved Container ID.
This Google account reaches no container <ID>The container of Container ID is not in the list.
Google refused the request: <error>Google did not give an access token for the refresh token.
Google answered without an access tokenGoogle accepted the refresh token, but its answer had no access token.
Google could not be reachedThe app cannot reach Google.
Google answered <status>A Google API refused a request with no message.
The message from GoogleA Google API refused a request, for example because the account cannot open the item.

When the test does not pass, the page can still show the list.

Workflow tool check_connection

PropertyGoogle AdsGoogle AnalyticsGoogle Tag Manager
Tool nameapp.<installation slug>.check_connection, for example app.google-ads.check_connectionapp.<installation slug>.check_connectionapp.<installation slug>.check_connection
Label in workflowsGoogle Ads: Check Google Ads connectionGoogle Analytics: Check Google Analytics connectionGoogle Tag Manager: Check Google Tag Manager connection
Effectreadreadread

The tool has no arguments. It runs the connection test.

Output

NameLabelTypeDescription
connectedConnectedbooleantrue when the test passed.
messageWhat the test foundstringThe message of the test. See Test messages.

The tool does not fail when the test does not pass. It returns connected: false.

Data that Picked keeps

Each app keeps the data of each installation in labels of the installation in Picked:

LabelTypeSecretValue
google.connectionJSONYesThe connection: refreshToken, email, scopes and connectedAt.
google.settingsJSONNoThe settings, by key. See Settings.

The app keeps no other data. See How to store data for an installation.

Removal of the connection

Disconnect tells Google to revoke the refresh token. It then deletes google.connection. The settings stay.

When you remove the app from the project, Picked tells the app before it deletes the labels of the installation. The app then tells Google to revoke the refresh token. Picked deletes the labels also when the app does not answer.

The app ignores the answer from Google. When Google does not revoke the token, Picked still deletes the connection.

Sign-in messages

After a click on Connect <name>, the status line shows Waiting for Google…. It then shows one of these messages:

MessageWhen
Connected <email>The connection is complete.
Connected your Google accountThe connection is complete, and Google gave no email.
Google access was declinedThe person did not accept the access on the Google page.
Google sent no codeGoogle sent the window back with no authorization code.
Google answered without a refresh token; connect againGoogle did not give a refresh token.
Google refused the request: <error>Google refused the authorization code.
Google could not be reachedThe app cannot reach Google.
<app name> could not be connectedThe connection failed for a different reason.
This connection link has expired or was opened in another browser; start againThe window is too old, or it is in a different browser.
Sign in againThe session of the page expired.
The app could not start connectingThe window did not get the Google sign-in address.
Allow pop-ups to connectThe browser did not open the window.
The connection window closed. If you finished connecting there, it shows hereThe window closed before it sent a result.

Page messages

MessageWhen
Loading…The page reads the connection and the settings.
Testing…Test connection runs.
DisconnectedDisconnect is complete. The page shows Connect <name> again.
Sign in againThe session of the page expired.