By Leo Blanchard

In this blog, we run through some of the DoubleClick Search's most powerful built-in functions, allowing you to take your inventory management set-up to the next level and drive high-quality traffic to your site.

Back to blog home

Inventory management (IM) is one of the most powerful tools that DoubleClick Search offers, allowing you to create automated ads and keywords that save hours spent slaving over your keyboard, while simultaneously including more relevant up-to-date information than is possible with manually-built campaigns. If you currently use inventory management and are looking to take it to the next level, then this article is for you. Otherwise, it might be best to read up on the subject first, as this article could be a bit too technical. 

If you're running inventory management campaigns without using functions, you're missing out on a lot of the benefits that DoubleClick Search has to offer. Used effectively, functions can make your campaigns far more effective, saving you wasted spend and highlighting your website's offering in ways that manual ads are simply incapable of. For this reason, I'll be going through some of the most useful functions DoubleClick has to offer, and some examples to give some context.

If you're unfamiliar with feeds or inventory management, I'd recommend learning more about the subject before going through this article, as feeds are an essential part of inventory management and the functions outlined in this article.

Feed anomalies

Regardless of how well-maintained it is, there's a good chance that anomalies will at least occasionally rear their ugly head in your lovely, orderly feed and cause untold disruption, particularly in the form of keywords and ads that look like they've been in and out of Google Translate a good few times. This can cause a lot of problems. In the case of IM keywords gens, this can take the form of large spends on keywords that aren't relevant to the product in question, or are so broad they attract a lot of irrelevant search queries. This can also make creating good, logical IM ad copy very difficult, and lead to ugly, unprofessional ads. In this section, we'll go through some functions that are useful in resolving these anomalies.

Special characters

Special characters (which are often not allowed in text ads) are often a culprit when it comes to problems caused by feed anomalies. Luckily, the substitute_all() function is here to help. The function takes the relevant attribute to change as its first parameter, and the second parameter is the character you'd like to substitute the unwanted characters with. After that, you'll need to specify all the characters you want removed, separating each one with a comma.

For our example, we'll take hotel_name as the relevant feed attribute, putting it as the first parameter in the brackets following substitute_all. We'll then include "" as our second parameter, to indicate that we want to replace the unwanted characters with nothing, deleting them in the process. After this we'll specify a series of unwanted characters that commonly crop up in our feed. As hotels are often owned by brand-names, we'll include characters like "™" and "®", as well as ones that aren't supported by AdWords. Put together, the resulting function might look something like this: 

substitute_all(c:"hotel_name", "", "°", "™", "®", "`")

Example of substituted ad copy

Trim, title case and clean

Additionally, there are four more functions we can use that add some more tidiness to the names. Trim() removes all whitespace from the beginning and end of the string (much simpler) and clean_keyword() replaces all unsupported keyword text characters with an input of your choice - we've gone with "" to signal DoubleClick to delete them altogether. Finally, title_case() is a quick and easy way to ensure your output appears in title case. Unfortunately, there isn't a sentence case equivalent, so you'll just have to make sure your feed attributes are in line with how you plan to use them in ad copy. If we combine these all together, you should have something to the effect of:


To save yourself having to type out this formula every time you need to use it, it may be best to create a 'base name' formula column within the feed section of the DS interface, so you can quickly and easily reference it when building your inventory management.

Example of trimmed, title cased, cleaned ad copy

Reduce words

Given the fact that Google is very strict on the character limits for its ads, and also for its keywords, the reduce_words() function can be a lifesaver. This function pretty much does what it says on the tin - reducing the number of words in the specified attribute, based on the number of characters specified in the second parameter. The third parameter is the 'delimiter' - this is the last character that we will choose as the cut-off point before the attribute in the question hits the word count. For most purposes, its best to specify a space for this, so that the output will only contain whole words.

For example, if we were to specify the function as reduce_words(c:"hotel_name", 30, " ") and the attribute in question equates to 'The Ritz-Carlton Luxury Hotel in Dubai, United Arab Emirates,' the output should instead be a neat and tidy 'The Ritz-Carlton Luxury Hotel,' fitting neatly in Google's 30-character limit for headlines.

Example of ad copy with reduced words

Highlighting feed attributes

Highlighting feed attributes within ad copy can be a great way of appealing to users by providing them with accurate and compelling information before they've even clicked on your ads. By doing this, you can do more than just say you have the cheapest or widest offering, you can prove it. 'Show don't tell' is the motto here.

Including this information can also be beneficial for the opposite reason - it can discourage people from clicking your ad if you're offering isn't relevant to what they're looking for. This can save you money you'd otherwise lose in the form of clicks with a low conversion likelihood.

In this section, we'll go through some of the best functions for highlighting these attributes.

Finding the cheapest price

One of the best things about inventory management is its ability to dynamically create ads based on the most up-to-date information available. Given that price is a pretty big factor when people are looking to buy a product or service, the ability to include a "…from £x" can be a compelling attraction for potential customers, and that's where the min() function comes in. The aptly-named min() finds the feed item with the smallest value for the attribute specified, from the selection of items you've filtered down to.

As the min() function will only take a number as an input, you'll need to encase the relevant attribute in a to_number function first, so you'd have something to the effect of min(to_number(c:"price_per_night")). But that's not all! You'll need the resulting output to be a string if you want to use it in ads and ad copy, so you'll need to encase all that in a to_string as well, which would give you this:


You'll also need to put a currency symbol (£, $, €) in front of this formula in any ad copy, so people know you're talking about currency and not points, cryptocurrency, or magic beans.

Ad showing dynamically updated price per night.

How many versions of the product are available

This one's much simpler. Often users will not only be interested in how cheap your products are, but also how many different types you have available, because everyone loves choice. Dynamically updating your ad variants with this information is as simple as using the count() function. Inserting this in your ad copy will display the number of items in your feed that apply to your relevant filtering and multiplication criteria. For example, if you've divided your plan into campaigns for each of the origin countries your flights fly from, and then each of these campaigns into the destinations they fly to, the count() function will display the number of flights on offer from A to B.

In the example below, we've integrated both the count() function and the min() function into the ad copy, giving users a full sense of the range of hotels on offer and the lowest prices they're likely to find. This can save wasted clicks in the form of users visiting the site before realising the prices are too high, or the selection isn't adequate.

Ad copy dynamically updated with number of hotels.


Finally, there's the max_with_min() function. This one's a bit narrower in its scope of use, but it can be great as a means of showing off the best of two different attributes for a selection of items in the feed. This function works by narrowing down the available items based on the 'min attribute' (the second parameter) and then finding the highest value for the 'return attribute' (the first parameter). This one's a bit confusing, and so is best explained with an example…

Say our campaigns narrow down available hotels by country and then our ad groups narrow down by cities within that country. We'd then want to highlight the cheapest available hotel prices for that city but, in case there are multiple hotels at the same cheapest price, we'd want to highlight the highest star-rating available for hotel of that price. The formula might look something like this:

max_with_min(c:"star_rating", c:"price_per_night")

...and, used in ad copy, the result might look something like this: 

Ad copy using max_with_min function

To conclude, functions in DoubleClick Search are a powerful tool that can enable you to truly take your inventory management skills to the next level. Systematically correcting naming anomalies in particular will ensure that your ad copy consistently looks professional and your keywords don't pull in large amounts of irrelevant traffic, even when using a feed with errors in.

The functions explained in this article represent just a small proportion of those on offer. Visit the DoubleClick support site for the full list of DoubleClick functions.

Share this article