GoogleAds

Google Ads SDK.

Installation

The package can be installed by adding google_ads to your list of dependencies in mix.exs:

def deps do
[
{:google_ads, "~> 0.1.0"}
]
end

The docs can be found at https://hexdocs.pm/google_ads.

Usage

Set the config

config :google_ads,
client: GoogleAds.Client, # Or GoogleAds.Dummy for dev enviromment

Optionally set the API version, defaults to 18:

config :google_ads,
api_version: "17"

Optionally set the retry config:

config :google_ads,
client: GoogleAds.Client, # Or GoogleAds.Dummy for dev enviromment
retry_config: [
delay: "1000",
max_retries: "10",
max_delay: "2000"
]

Returns all rows that match the search query.

Example:

request_body = %{
"query" => "SELECT * FROM customer_client WHERE id = 123"
}
GoogleAds.search(developer_token, access_token, customer_id, request_body)

Append lead conversation

Append Local Services Lead Conversation resources to Local Services Lead resources.

Example:

request_body = %{
"conversations" => [
%{
"localServicesLead" => "customers/123/localServicesLeads/456",
"text" => "text"
}
]
}
GoogleAds.append_lead_conversation(developer_token, access_token, customer_id, request_body)

Pagination

Paginates the results of a paginated function.

Example:

GoogleAds.paginate(fn pagination_options ->
GoogleAds.search(developer_token, access_token, customer_id, request_body, pagination_options)
end)

Telemetry

You can attach Google Ads telemetry to your app.

QueryResourceConsumption

Setup

GoogleAds.Telemetry.QueryResourceConsumption.setup()

It will emit the following event:

[:google_ads, :query_resource]

Measurements:

Metadata: