# GoogleAds
Google Ads SDK.
## Installation
The package can be installed by adding `google_ads` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:google_ads, "~> 0.1.0"}
]
end
```
The docs can be found at <https://hexdocs.pm/google_ads>.
## Usage
### Set the config
```elixir
config :google_ads,
client: GoogleAds.Client, # Or GoogleAds.Dummy for dev enviromment
```
Optionally set the API version, defaults to `18`:
```elixir
config :google_ads,
api_version: "17"
```
Optionally set the retry config:
```elixir
config :google_ads,
client: GoogleAds.Client, # Or GoogleAds.Dummy for dev enviromment
retry_config: [
delay: "1000",
max_retries: "10",
max_delay: "2000"
]
```
### Search
Returns all rows that match the search query.
Example:
```elixir
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:
```elixir
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:
```elixir
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
```elixir
GoogleAds.Telemetry.QueryResourceConsumption.setup()
```
It will emit the following event:
<details>
<summary>[:google_ads, :query_resource]</summary>
**Measurements**:
- consumption: `integer()`
**Metadata**:
- customer_id: `String.t()`
</details>