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
| Property | Google Ads | Google Analytics | Google Tag Manager |
|---|---|---|---|
handle | google-ads | google-analytics | google-tag-manager |
name | Google Ads | Google Analytics | Google Tag Manager |
scopes | None | None | None |
offlineAccess | Not set | Not set | Not set |
events | None | None | None |
slots | app-home | app-home | app-home |
workflowTools | check_connection | check_connection | check_connection |
| Slot title | Google Ads connection | Google Analytics connection | Google Tag Manager connection |
| Slot height | 420 | 420 | 420 |
| Google scope | https://www.googleapis.com/auth/adwords | https://www.googleapis.com/auth/analytics.readonly | https://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:
| Part | What it does |
|---|---|
| Connect <name> | Opens a new window at the Google sign-in page. Shows when the installation has no connection. |
| Account line | Connected as <email>. Shows Connected as a Google account when Google gives no email. |
| Setting fields | The settings of the app. See Settings. The fields show when the installation has a connection. |
| Save settings | Stores the settings. |
| Test connection | Runs the test of the app. See Connection test. |
Disconnect | Removes the connection. See Removal of the connection. |
| Status line | The result of the last action. See Page messages. |
| List | After 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:
openidandemail, 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.
Google Ads
| Field | Key | Required | Format |
|---|---|---|---|
| Customer ID | customerId | Yes | Ten digits. The app removes each hyphen and space. Example: 123-456-7890. |
| Manager account ID | loginCustomerId | No | Ten 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
| Field | Key | Required | Format |
|---|---|---|---|
| Property ID | propertyId | Yes | 6 to 12 digits. The app removes a properties/ prefix. Example: 250000001. |
Property ID is a Google Analytics 4 property.
Google Tag Manager
| Field | Key | Required | Format |
|---|---|---|---|
| Container ID | containerId | Yes | GTM- 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
| Message | When |
|---|---|
Settings saved | Save settings is complete. |
<field> is required | A required field is empty. |
Customer ID is ten digits, such as 123-456-7890 | Customer ID is not ten digits. |
Manager account ID is ten digits, such as 123-456-7890 | Manager account ID is not ten digits. |
A property ID is a number, such as 250000001 | Property ID is not 6 to 12 digits. |
A container ID looks like GTM-XXXXXXX | Container ID does not match the format. |
Connection test
Test connection and the check_connection tool run the same test. The test does these
things:
- It makes sure that the installation has a connection.
- It makes sure that the Google account gave the Google scope of the app.
- When the app has no current access token, it gets one from Google with the refresh token.
- It reads the list of what the Google account can open.
- It reads the item of the saved setting.
| App | List | Item |
|---|---|---|
| Google Ads | The accounts that the Google account can open, from customers:listAccessibleCustomers. | The name of the Customer ID account, from googleAds:search. |
| Google Analytics | The properties of up to 200 accounts, from accountSummaries. | The property of Property ID, from the Google Analytics API. |
| Google Tag Manager | Each 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>:
| App | Label | Value |
|---|---|---|
| Google Ads | Account | The customer ID, for example 123-456-7890. |
| Google Analytics | The name of the account, or Property | <property name> (<property ID>) |
| Google Tag Manager | The name of the account | <container name> (<container ID>) |
Test messages
| Message | When |
|---|---|
Connected to <name> (<ID>) | The test passed. <name> is the name of the account, property or container. |
<app name> is not connected | The installation has no connection. |
Connect again and allow <app name> access | The Google account did not give the Google scope of the app. |
Save the customer ID of the account to use | Google Ads has no saved Customer ID. |
Save the ID of the property to use | Google Analytics has no saved Property ID. |
Save the ID of the container to use | Google 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 token | Google accepted the refresh token, but its answer had no access token. |
Google could not be reached | The app cannot reach Google. |
Google answered <status> | A Google API refused a request with no message. |
| The message from Google | A 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
| Property | Google Ads | Google Analytics | Google Tag Manager |
|---|---|---|---|
| Tool name | app.<installation slug>.check_connection, for example app.google-ads.check_connection | app.<installation slug>.check_connection | app.<installation slug>.check_connection |
| Label in workflows | Google Ads: Check Google Ads connection | Google Analytics: Check Google Analytics connection | Google Tag Manager: Check Google Tag Manager connection |
| Effect | read | read | read |
The tool has no arguments. It runs the connection test.
Output
| Name | Label | Type | Description |
|---|---|---|---|
connected | Connected | boolean | true when the test passed. |
message | What the test found | string | The 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:
| Label | Type | Secret | Value |
|---|---|---|---|
google.connection | JSON | Yes | The connection: refreshToken, email, scopes and connectedAt. |
google.settings | JSON | No | The 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:
| Message | When |
|---|---|
Connected <email> | The connection is complete. |
Connected your Google account | The connection is complete, and Google gave no email. |
Google access was declined | The person did not accept the access on the Google page. |
Google sent no code | Google sent the window back with no authorization code. |
Google answered without a refresh token; connect again | Google did not give a refresh token. |
Google refused the request: <error> | Google refused the authorization code. |
Google could not be reached | The app cannot reach Google. |
<app name> could not be connected | The connection failed for a different reason. |
This connection link has expired or was opened in another browser; start again | The window is too old, or it is in a different browser. |
Sign in again | The session of the page expired. |
The app could not start connecting | The window did not get the Google sign-in address. |
Allow pop-ups to connect | The browser did not open the window. |
The connection window closed. If you finished connecting there, it shows here | The window closed before it sent a result. |
Page messages
| Message | When |
|---|---|
Loading… | The page reads the connection and the settings. |
Testing… | Test connection runs. |
Disconnected | Disconnect is complete. The page shows Connect <name> again. |
Sign in again | The session of the page expired. |
