Configure a Google Ads API data source
Get the connector
For comfortable usage of the new Google Ads API a modular connector which is currently not shipped with the Data Virtuality Server is necessary.
Please reach out to Data Virtuality Support team to get installation instructions and files matching your Data Virtuality Server version.
Deploy the connector
Check whether the modular connector is present on the Data Virtuality Server:
SELECT "name", "deployed"FROM "SYSADMIN.ModularConnectors"WHERE "name" = 'google-ads-api'
If the result is empty, the connector is not yet installed. In that case, as mentioned above, please reach out to Data Virtuality Support.
If the result is not empty, you can deploy the connector:
CALL "SYSADMIN.deployModularConnector"("name" => 'google-ads-api', "deploy" => true);;
Configure the data source
After successful deployment, the Google Ads API data source can be created. The credentials are same as used in the AdWords data source:
CALL "SYSADMIN.createConnection" ( "name" => 'google_ads_datasource' , "jbossCLITemplateName" => 'googleads' , "connectionOrResourceAdapterProperties" => 'ClientId=<ClientId>,UserAgent=<UserAgent>,ClientSecret=<ClientSecret>,DeveloperToken=<DeveloperToken>,RefreshToken=<RefreshToken>');;
CALL "SYSADMIN.createDataSource" ( "name" => 'google_ads_datasource' , "translator" => 'google_ads_api');;
Usage
In Google Ads API each criteria report is represented by a separate resource. A complete list of the old AdWords resources and their new corresponding Google Ads API resources can be found on this resource mappings page:
https://developers.google.com/google-ads/api/docs/migration/mapping
Please notice the following generic rules for translation of Google Ads API names to Data Virtuality Server column names:
- The character "." is translated to character "_".
Example: "customer.descriptive_name" is "customer_descriptive_name" in the Google Ads API connector. - The prefixes "segments." and "metrics." are not included into column name
Example: "metrics.cost_micros" is "cost_micros" in the Google Ads API connector.
While all reports are available by querying the Google Ads API data source tables, the new Google Ads API connector also provides a predefined set of procedures for most popular reports.
If you cannot use one of the predefined procedures but have to query tables, please be aware of the following rules:
- A where specifying a customer_id and/or a date range is mandatory for most of the tables.
- The combination of fields selected together need to be valid for being combined on Google Ads side. Hence select star is not recommended and won't work for most tables.
Sample of a report transition to Google Ads API
This example is the "Ad performance" report as present on old AdWords connector:
SELECT "Date" , "CustomerDescriptiveName" , "AdGroupId" , "AdGroupName" , "AdGroupStatus" , "Clicks" , "Ctr" , "Impressions"FROM "old_adwords.getAD_PERFORMANCE_REPORT" ( "customerId" => x , "startDate" => TIMESTAMPADD (SQL_TSI_DAY, -3, CURDATE ()) , "endDate" => CURDATE () , "fields" => 'AdGroupId,AdGroupName,AdGroupStatus,Clicks,Ctr,CustomerDescriptiveName,Date,Impressions');;
Same data via new Google Ads API connector:
SELECT "date" , "customer_descriptive_name" , "ad_group_id" , "ad_group_name" , "ad_group_status" , "clicks" , "ctr" , "impressions"FROM "google_ads_datasource.ad_group_ad"WHERE "customer_id" = x AND "date" BETWEEN TIMESTAMPADD (SQL_TSI_DAY, -3, CURDATE ()) AND CURDATE ()ORDER BY "date";;