Title: | Google Ads Data Hub API Client |
---|---|
Description: | Interact with Google Ads Data Hub API <https://developers.google.com/ads-data-hub/reference/rest>. The functionality allows to fetch customer details, submit queries to ADH. |
Authors: | Pankaj Bhatlawande |
Maintainer: | Pankaj Bhatlawande <[email protected]> |
License: | GPL-2 |
Version: | 0.1.1 |
Built: | 2025-02-24 05:33:29 UTC |
Source: | https://github.com/cran/adsDataHubR |
Creates an analysis query for later execution. No query validation is performed at this time. Reference: <https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/create>
create_query(customer_id, query_title, query_text, token)
create_query(customer_id, query_title, query_text, token)
customer_id |
ADH Customer ID e.g. customers/123 |
query_title |
Query title, which is unique within a single Ads Data Hub customer and query type. e.g.RnF Analysis |
query_text |
Query text written in Standard SQL. |
token |
Access token retrived from function google_auth() |
If successful, the response body contains a newly created instance of the query
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) create_query(customer_id, query_title, query_text, token) ## End(Not run)
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) create_query(customer_id, query_title, query_text, token) ## End(Not run)
Lists links between the specified customer and other Google advertising entities.
get_adh_links(customer_id, token)
get_adh_links(customer_id, token)
customer_id |
ADH Customer ID e.g. customers/123 |
token |
Access token retrived from function google_auth() |
A list of ad data links.
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) total_customers <- get_customers(token) customer_id <- "customers/123456" get_adh_links(customer_id, token) ## End(Not run)
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) total_customers <- get_customers(token) customer_id <- "customers/123456" get_adh_links(customer_id, token) ## End(Not run)
Fetch Ads Data Hub customers to which the current user has access. Reference: <https://developers.google.com/ads-data-hub/reference/rest/v1/customers.adsDataLinks/list>
get_customers(token)
get_customers(token)
token |
Access token retrived from function google_auth() |
A dataframe of all customers along with IDs to which authenticated user has access
## Not run: library(adsDataHubR) total_customers <- get_customers(token) ## End(Not run)
## Not run: library(adsDataHubR) total_customers <- get_customers(token) ## End(Not run)
Retrieves the requested analysis query. Reference: <https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/get>
get_query(query_name, token)
get_query(query_name, token)
query_name |
e.g.customers/123/analysisQueries/abcd1234 |
token |
Access token retrived from function google_auth() |
A list of query details
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) get_query(query_name, token) ## End(Not run)
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) get_query(query_name, token) ## End(Not run)
Function to login and create a token to be used in all the funtions Reference: <https://developers.google.com/ads-data-hub/guides/quickstart-api>
google_auth(client_id, client_secret)
google_auth(client_id, client_secret)
client_id |
Client ID |
client_secret |
Client Secret |
Environment token that can be used in all other functions
https://developers.google.com/ads-data-hub/guides/quickstart-api
## Not run: token <- google_auth(client_id = client_id, client_secret=client_secret) ## End(Not run)
## Not run: token <- google_auth(client_id = client_id, client_secret=client_secret) ## End(Not run)
Lists links between the specified customer and other Google advertising entities. Reference: <https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/list>
list_queries(customer_id, token)
list_queries(customer_id, token)
customer_id |
ADH Customer ID e.g. customers/123 |
token |
Access token retrived from function google_auth() |
A list of analysis queries run on the ADH customer account.
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) total_customers <- get_customers(token) customer_id <- "customers/123456" list_queries(customer_id, token) ## End(Not run)
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) total_customers <- get_customers(token) customer_id <- "customers/123456" list_queries(customer_id, token) ## End(Not run)
Starts execution on a stored analysis query. The results will be written to the specified BigQuery destination table. The returned operation name can be used to poll for query completion status.. Reference: <https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/start>
start_query( query_name, ads_data_customer_id, bq_destination_table, start_date, end_date, token )
start_query( query_name, ads_data_customer_id, bq_destination_table, start_date, end_date, token )
query_name |
e.g. customers/123/analysisQueries/abcd1234' |
ads_data_customer_id |
#Enter the "From" ADH account on which we want to run the query |
bq_destination_table |
BigQuery destination table ID e.g. "project.dataset.table_name" If specified, the project must be explicitly whitelisted for the customer's ADH account. If project is not specified, uses default project for the provided customer. If neither project nor dataset is specified, uses the default project and dataset. |
start_date |
Start Date e.g. 2021-01-31 format: YYYY-MM-DD |
end_date |
End Date e.g. 2021-01-31 format: YYYY-MM-DD |
token |
Access token retrived from function google_auth() |
If successful, the response body contains an instance of the submitted job.
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) start_query(query_name, ads_data_customer_id, bq_destination_table, start_date, end_date, token) ## End(Not run)
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) start_query(query_name, ads_data_customer_id, bq_destination_table, start_date, end_date, token) ## End(Not run)
Performs static validation checks on the provided analysis query. Reference: <https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/validate>
validate_query(customer_id, query_instance, token)
validate_query(customer_id, query_instance, token)
customer_id |
ADH Customer ID e.g. customers/123 |
query_instance |
Query instance returned by create_query function |
token |
Access token retrived from function google_auth() |
If successful, the response body contains a validation queryPerformanceInfo object
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) validate_query(customer_id, query_instance, token) ## End(Not run)
## Not run: library(adsDataHubR) token <- google_auth(client_id = client_id, client_secret=client_secret) validate_query(customer_id, query_instance, token) ## End(Not run)