Google Ads Reader
Google Ads is a marketing platform from Google. The Google Ads application builds awareness with visually engaging ads that reach your audience when they’re online, checking Gmail or using mobile apps.
Google Ads Reader syncs data from a Google Ads instance to analytical systems such as BigQuery or Snowflake. Moving ad data to such a system enables you to transform the data and perform a sophisticated analysis of advertising properties. Google provides a public API for accessing the data in the Google Ads platform that supports OAuth 2.0 authentication.
Summary information and supported objects
APIs used/data supported | APIs used:
|
Supported targets | Any Striim target that accepts WAEventss |
Security and authentication | OAuth 2.0 |
Operations / modes supported | Automated mode (consisting of initial load and incremental load) Initial load Incremental load |
Schema management | The Google Ads Reader supports initial schema creation. |
Resilience / recovery | Recovery for the Incremental mode is available based on the date field. Recovery is only available for objects with a valid check column and is not available when the resync option is enabled. NoteRecovery is likely to create several duplicates. Striim recommends enabling Merge mode at the target during recovery. |
Performance | Striim Platform-supported parallel execution |
Programmability |
|
Metrics and auditing | Key metrics available through Striim monitoring |
Key limitations | Only supports new insert operations. Enable merge mode for updates in resync mode. |
Google Ads Reader limitations
The following are limitations of Google Ad Reader:
The reader only supports new inserts. When records are updated in resync mode, the target should have merge mode enabled. The following behavior is true for these Google BigQuery modes:
in APPEND MODE irrespective of the kind of operation is being done, events will be stored as new records.
In MERGE MODE if there is no key column field, the target considers all the the columns present as a keycolumn and the (update) record will be treated as a new record in the target.
You can choose to use the target key column option as described in Create a BigQuery Writer application. This topic describes that if you do not specify key columns, Striim uses the key columns specified in the source adapter's
Tables
property as a unique identifier. If the source has no key columns, Striim concatenates all the column values and use that as a unique identifier.The OAuth 2.0 client ID and client secret must be retrieved from the GCP console. The OAuth 2.0 refresh token requires manual URL generation.
In Automated mode with date segment filtering, only
Attributes
can be selected which is a limitation from the Google Ads Reporting API. Even though the table is created with all the columns available in the source table, the data load will be limited toAttribute
columns only. Striim does not support tables that provide only the default metrics, segments, and attributes values.Due to a limitation in the Google Ads API, when using the
customerSearchTermInsight
object in automated/ Incremental mode, you need to select theCampaignId
along with the Date segment for filtering.
Configuring OAuth for the Google Ads Reader
You must enable both the Google Ads API and the Google Drive API at the GCS Console in order to use OAuth authentication.
The following procedure generates the client ID and client secret.
In the Google Ads API, click Manage.
In API/Service Details, navigate to the Credentials tab, then click Create Credentials.
Select OAuth Client ID.
The Create OAuth Client ID pane appears.
Type the required details into the fields and click Create.
The Google Ads API creates a client ID and client secret.
Note the client ID and client secret for later use.
The Google OAuth 2.0 playground can provide the OAuth refresh token. When the playground generates 400-series errors, build a custom OAuth browser URL. The 400-series errors are typically caused by incorrect scopes assigned to the OAuth tokens.
The base URI for the custom OAuth browser URL is https://accounts.google.com/o/oauth2/v2/auth
. Append to that base URI the following components:
The redirect URI specified for the OAuth Client ID created in the previous procedure.
?redirect_uri=http://localhost:9080
Additional required parameters.
&prompt=consent&response_type=code
The client ID.
&client_id=<clientID>.apps.googleusercontent.com
OAuth scopes for the refresh token.
&scope=https://www.googleapis.com/auth/adwords
Additional required parameters.
&access_type=offline
Navigate to the final URL, which redirects to the specified redirect URI. The redirect URI contains a code=<authorization code>&
segment. Note this code for future use.
In Postman, make a POST request to the address https://accounts.google.com/o/oauth2/token
, specifying the following parameters:
client_id: The client ID.
client_secret: The client secret.
grant_type:
authorization_code
redirect_uri: The redirect URI specified for the OAuth client ID.
code: The code string generated by the custom browser URL.
Postman returns an access token and refresh token.
Google Ads Reader properties
Property | Type | Default value | Notes |
---|---|---|---|
Auto token renewal | Boolean | True | Specifies whether to automatically refresh the OAuth access token. |
Access Token | Password | Only used when Auto token renewal is set to False. | |
Client ID | String | Required for authentication with OAuth | |
Client secret | Password | Required for authentication with OAuth | |
Refresh token | Password | Required for authentication with OAuth | |
Client customer ID | String | A comma-separated list of client IDs of Google Ads accounts within a single Google My Client Center (MCC). | |
Connection pool size | String | 20 | You can configure the Connection pool size to manage the maximum number of active connections that can be made at the same time. |
Incremental load marker | String | Value of the | The incremental load marker is a unique incremental column in each of the supported objects used for incremental load. For a list of supported objects, see the |
Manager ID | String | The ID of the MCC associated with the account. When access to a client customer account is granted by inheritance from a manager account, this property is required. | |
Mode | Select list
| Automated mode consists of an initial load and incremental loads. | |
Polling interval | String | 1d | Specifies an interval as an integer followed by a unit. Supported units are days ( |
Tables | String | A semicolon-delimited ( The supported objects are:
For more information, see Google Ads API. | |
Sync type | Select list
| Last position | The Resync option syncs the entire set of records at each polling interval. The Last Position option selects records from last saved position based on the the column selected as the check column. For example, if date is the check column, the last saved date in the object is the date where sync starts. |
Start position | String |
| Value of the incremental load marker that defines the initial reading position. |
Thread pool count | String | The number of parallel running threads. The default value of zero specifies single-threaded operation. |
Sample TQL for Google Ads Reader
The following TQL creates an application that reads from the resources table of Google Ads and writes the data to Google BigQuery.
CREATE OR REPLACE APPLICATION GAdsWithRefresh; CREATE OR REPLACE SOURCE GAdsWithRefresh_src USING Global.GoogleAdsReader ( clientId: <client_id>, refreshToken_encrypted: 'true', syncMode: 'LASTPOSITION', threadPoolCount: '10', pollingInterval: '1d', autoTokenRenewal: true, tables: 'BillingSetup', ConnectionPoolSize: '20', apiVersion: 'V15', migrateSchema: true, clientCustomerId: '804-931-6262', IncrementalLoadMarker: 'Date', clientSecret_encrypted: 'true', Mode: 'IncrementalLoad', clientSecret: <clientSecret>, refreshToken: <refreshToken> ) OUTPUT TO newstream1; CREATE OR REPLACE TARGET bq11 USING Global.BigQueryWriter ( ColumnDelimiter: '|', NullMarker: 'NULL', streamingUpload: 'false', BatchPolicy: 'eventCount:1000000, Interval:90', projectId: 'striimqa-214712', Encoding: 'UTF-8', ConnectionRetryPolicy: 'totalTimeout=600, initialRetryDelay=10, retryDelayMultiplier=2.0, maxRetryDelay=60 , maxAttempts=5, jittered=True, initialRpcTimeout=10, rpcTimeoutMultiplier=2.0, maxRpcTimeout=30', AllowQuotedNewLines: 'false', CDDLAction: 'Process', optimizedMerge: 'false', TransportOptions: 'connectionTimeout=300, readTimeout=120', ServiceAccountKey: '/Users/vishwanath.shindhe/prod/Platform/UploadedFiles/striimqa-214712- e68480320a53.json', adapterName: 'BigQueryWriter', Tables: '%, appAdaptersTesting.%', StandardSQL: 'true', QuoteCharacter: '\"', Mode: 'MERGE' ) INPUT FROM newstream1;
Metrics monitored by the Google Ads Reader
The Google Ads Reader monitors the following metrics.
Metric | Description |
---|---|
Number of DDLs | Number of data definition language operations |
Number of inserts | Number of insert operations |