GoogleAds.API
2.45.9
dotnet add package GoogleAds.API --version 2.45.9
NuGet\Install-Package GoogleAds.API -Version 2.45.9
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GoogleAds.API" Version="2.45.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GoogleAds.API" Version="2.45.9" />
<PackageReference Include="GoogleAds.API" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GoogleAds.API --version 2.45.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GoogleAds.API, 2.45.9"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GoogleAds.API@2.45.9
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GoogleAds.API&version=2.45.9
#tool nuget:?package=GoogleAds.API&version=2.45.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
GoogleAds.API
GoogleAds.API is an async, thread-safe singleton implementation for the Google Ads client. It ensures safe and efficient concurrent access to the Google Ads API, making it ideal for high-performance applications.
Features
- Async support for non-blocking operations.
- Thread-safe singleton design pattern.
- Easy integration with Google Ads API.
- Designed for high concurrency environments.
Installation
You can install the package via NuGet:
Install-Package GoogleAds.API
Example
🔧 1. Configuration (e.g. appsettings.json)
{
"GoogleAds": {
"DeveloperToken": "YOUR_DEV_TOKEN",
"LoginCustomerId": "123-456-7890",
"ClientCustomerId": "098-765-4321",
"OAuthClientId": "your-oauth-client-id",
"OAuthClientSecret": "your-oauth-client-secret",
"RefreshToken": "your-refresh-token"
}
}
🚀 2. Initialize and Use the Client
// Load configuration
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
// Initialize the Google Ads client
var adsClient = GoogleAdsClientSingleton.Create(config.GetSection("GoogleAds"));
// Example: fetch first 10 campaigns
var service = adsClient.GetClient().GetService(Services.V14.GoogleAdsService);
var response = await service.SearchAsync($"SELECT campaign.id, campaign.name FROM campaign ORDER BY campaign.id LIMIT 10");
foreach (var row in response)
{
Console.WriteLine($"Campaign ID: {row.Campaign.Id}, Name: {row.Campaign.Name}");
}
🧩 3. Customizing for Campaign Creation
using Google.Ads.GoogleAds.V14.Services;
using Google.Ads.GoogleAds.V14.Resources;
// ... initialize adsClient as shown above ...
var campaignService = adsClient.GetClient().GetService(CampaignServiceClient);
var campaign = new Campaign
{
Name = "My New Campaign",
AdvertisingChannelType = AdvertisingChannelType.Search,
Status = CampaignStatus.Paused,
ManualCpc = new ManualCpc(),
CampaignBudget = ResourceNames.CampaignBudget(yourCustomerId, yourBudgetId)
};
var operation = new CampaignOperation { Create = campaign };
var response = await campaignService.MutateCampaignsAsync(customerId.ToString(), new[] { operation });
Console.WriteLine($"Created campaign with resource name: {response.Results[0].ResourceName}");
Requirements
- .NET Standard compatible environment.
- Google Ads API credentials.
Contributing
Contributions are welcome! Please submit pull requests or open issues on the repository.
License
MIT License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Google.Ads.GoogleAds (>= 23.0.0)
- Soenneker.Extensions.Configuration (>= 2.1.482)
- Soenneker.Utils.AsyncSingleton (>= 2.1.431)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.45.9 | 30 | 7/13/2025 |
0.0.40 | 112,027 | 7/13/2025 |
0.0.39 | 112,034 | 7/13/2025 |
0.0.38 | 112,033 | 7/13/2025 |
0.0.37 | 112,029 | 7/13/2025 |
0.0.36 | 112,033 | 7/13/2025 |
0.0.35 | 112,033 | 7/13/2025 |
0.0.34 | 112,026 | 7/13/2025 |
0.0.33 | 112,031 | 7/13/2025 |
0.0.32 | 112,033 | 7/13/2025 |
0.0.31 | 64,033 | 7/13/2025 |
0.0.30 | 64,029 | 7/13/2025 |
0.0.29 | 64,032 | 7/13/2025 |
0.0.28 | 64,032 | 7/13/2025 |
0.0.27 | 64,034 | 7/13/2025 |
0.0.26 | 64,028 | 7/13/2025 |
0.0.25 | 64,031 | 7/13/2025 |
0.0.24 | 64,035 | 7/13/2025 |
0.0.23 | 64,034 | 7/13/2025 |
0.0.22 | 64,034 | 7/13/2025 |
0.0.21 | 64,031 | 7/13/2025 |
0.0.20 | 64,032 | 7/13/2025 |
0.0.19 | 64,032 | 7/13/2025 |
0.0.18 | 64,032 | 7/13/2025 |
0.0.17 | 64,033 | 7/13/2025 |
0.0.16 | 64,033 | 7/13/2025 |
0.0.15 | 64,030 | 7/13/2025 |
0.0.14 | 64,030 | 7/13/2025 |
0.0.13 | 64,034 | 7/13/2025 |
0.0.12 | 64,032 | 7/13/2025 |
0.0.11 | 112,032 | 7/13/2025 |
0.0.10 | 64,032 | 7/13/2025 |
0.0.9 | 64,036 | 7/13/2025 |
0.0.8 | 64,035 | 7/13/2025 |
0.0.7 | 64,034 | 7/13/2025 |
0.0.6 | 64,030 | 7/13/2025 |
0.0.5 | 64,030 | 7/13/2025 |
0.0.4 | 64,036 | 7/13/2025 |
0.0.3 | 64,030 | 7/13/2025 |
0.0.2 | 64,034 | 7/13/2025 |
0.0.1 | 64,034 | 7/13/2025 |