Comments (2)
I've released a new version (1.4.0), which includes upgrading the google-ads-node dependency.
I didn't seem to encounter any errors with the mime_type
field, but instead discovered that in your example the ad.display_url
field was missing, hence the "Missing required field" error being thrown.
It's definitely not very clear in the Google Ads documentation, or the error message, that the display_url
is required. So in this release, we've added a new location
property to the error object. This provides information on exactly which field is missing/invalid, and should hopefully make these kinds of errors easier to resolve in the future 🎉 You'd use it a bit like this:
try {
await customer.adGroupAds.create(ad)
} catch (err) {
if (err.code.adError === enums.AdError.EMPTY_FIELD) {
console.log("Missing or invalid field:", err.location)
// "Missing or invalid field: operations[0].create.ad.display_url"
}
}
For the data
field, I used a base64 string and it seems to work fine. Below is a full example of adding an image ad, which works for me:
const ad = {
ad_group: "customers/123/adGroups/321",
status: enums.AdGroupAdStatus.PAUSED,
ad: {
final_urls: ["http://www.example.com"],
type: enums.AdType.IMAGE_AD,
name: "ad #1",
display_url: "https://example.com",
image_ad: {
image_url: "https://image.com/image.png",
pixel_width: 300,
pixel_height: 250,
mime_type: enums.MimeType.IMAGE_PNG,
data: "yourBase64EncodedString=",
},
},
}
const { results } = await customer.adGroupAds.create(ad, { validate_only: true })
Remember to update google-ads-api
to 1.4.0
. If you continue to have issues adding image ads, feel free to re-open this issue! 👍
from google-ads-api.
Hi @madpilot,
Thanks for reporting this, these issues really are appreciated. I'm going to take a deeper look into this and find out what's going on, hopefully we'll be able to provide a quick fix like the previous issue!
As for the data
field type, the Google Ads documentation specifies Bytes ("Raw image data as bytes.")
, and our protobuf ts compiler defines the type as string
. So I think the way you've done it, by converting the image to a base64 string, should work fine. I'll double check this whilst fixing the mime_type
issue.
By the way, if you want to make the output more readable when debugging, the protobuf grpc object should have a method .toObject()
, which makes the resource much easier to parse 👍
from google-ads-api.
Related Issues (20)
- Upgrade Google Ads to v14 HOT 9
- Export the function 'buildQuery'
- Can't create ad_group_ad_critetion with age and gender at the same time
- "The client has already been closed" Error thrown HOT 2
- Wait for response forever in Cloud Functions
- unable to compile with 13.0.1
- No information on documentation HOT 1
- Adding/Removing Criteria, and missing Documentation HOT 1
- OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE
- List customers with their descriptive names
- Why is `toJSON` required for `generateKeywordIdeas`?
- Authentication Error
- Upgrade Google Ads API to v15 HOT 19
- How to create a custom segment via the SDK? HOT 1
- Customer report showing previous day's data when date_constant is 'TODAY'
- Bad resource id in query from conversion_action HOT 1
- TypeError: this.auth.getUniverseDomain is not a function HOT 1
- Query returns campaign data, but report options does not based on TODAY date_constant
- size of module growing, making use with AWS lambda functions difficult HOT 2
- Can't change a Promotion Asset from "Money Amount Off" to "Percent Off".
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-ads-api.