Building an Advertising Ready Web Application (and other preparations for advertising)

This article is part of my Entreprenerd: Marketing for Programmers book, which is currently available to read for free online.

1. Create appropriate landing page constellations

Many new advertisers make the mistake of sending all their paid traffic to generic homepages. This is a bad idea because it is unreasonable to expect rushed leads to navigate your website until they see the product they want. Most internet users are impatient, so this strategy is really just a recipe for wasted advertising money and heavy use of the back button.

It’s a much better idea to send leads directly to pages corresponding to the advertisements they were shown. Usually this means directing traffic to the appropriate product pages—but not always.

For one, having different landings pages for each product won’t make any sense if the business is unable to tell, upfront, which exact product the customer wants. Instead, the business should create landing pages for each category. These pages will then help the customer to choose the right product for them. For example, Amazon might advertise a page showcasing their various in-ear headphones instead of arbitrarily bringing traffic to some particular headphone set or other.

Other businesses, such as those that offer only a single product or service, should build separate landing pages that each address different subsets of customers. For instance, a website selling translation services might have separate landing pages for each of the following: “translation of legal contracts”, “translation of instruction manuals”, and “translation of movie scripts”. These specialised landing pages would focus on persuading specific sets of customers to convert, without having to be everything to everybody.

For all this segmentation to work, the website has to have been built with separate landing pages for the different things that customers might want. And it’s in this sense that the website needs to be “advertising-ready”.

Creating all these landing pages has a double pay-off: As well as sharpening the effectiveness of paid advertising, keeping a lively cast of landing pages also boosts SEO. The numbers here are quite astonishing: Hubspot, after studying 7000 websites, found that companies with 15 landing pages generated 55% more leads than companies with only 10.1

2. Calculate profitability with code

As we’ll see later, it’s important to know your unit profitability when advertising. The math of profitability would be cumbersome and error-prone to calculate by hand or calculator, so instead it should be calculated automatically based on information stored in the database, such as inventory costs, postage costs, sales tax costs, financial fee costs, and royalty costs. By writing code that calculates unit profits on a per-product basis, businesses selling many different products will be armed with the knowledge necessary to throttle advertising budgets for each item and thereby optimise overall profitability.

3. Write automated tests for conversion pixels (etc.)

Modern online marketers advertise with not one advertising platform, but many. As you add additional platforms, you end up with more and more conversion pixels installed on your website, and this increases the chances that one of them will break and start under- or over-recording conversions.

This is a particularly damaging case of incorrect data because it will cause you to make poor business and spending decisions that will hamper profitability.

In regards to the specifics of how to test conversion pixels, that’s for the programmers to decide. (My ghetto approach is to use integration tests to scan for the pixel presence at the key moments and then supplement these automated tests with manual tests after large changes.)

4. Only advertise to permanent URLs

Online advertisements deliver traffic to specific pages of your website. If that page disappears, the advertisements stop working. And trust me, there’s nothing more annoying that investing a day into writing a multi-platform set of online advertisements, only to discover that they’ve broken down a few weeks later because the URL they were supposed to lead to no longer exists.

URLs change for all sorts of reasons (e.g., refactors by your programming team or content edits by users of your website). To avoid hassle, ensure that you exclusively advertise to URLs that aren’t subject to future changes. Personally, I create separate unchanging “permalink” URLs for any content I want to advertise to, shielding them from breaking edits.

5. Place conversion pixels high up in the HTML of the page

Just because there is a conversion pixel on a page doesn’t guarantee that it will always register conversions taking place. Amongst other things, it’s necessary that the browser execute the code requesting the pixel. Because browsers execute HTML code from the top of the file to the bottom, conversion pixels low down in the file may never be fired. This could happen, for instance, when the customer quickly skips to the next page after converting.

Analytics and Advertising: The Eyes to See With

Before the computer revolution, businesses—which back then advertised with newspaper, TV, or other classic media—could only gauge their marketing success with the roughest and most rudimentary of tools. Mostly, they switched on adverts for one month and calculated how the subsequent sales compared to previous periods where advertising was switched off. Measuring success was an almost mystical undertaking, a task caked in deep, unsettling uncertainty.

Imagine a pet food seller. It opens its doors in December and starts taking its first orders. Without advertising, it achieves the following results:

Pet Food December Sales
Dog Food £3,000
Cat Food £4,000
Total £7,000

In January, the pet food seller buys advertising in two different local magazines—one for dog lovers and another for cat lovers. It expects to drastically increase sales in January, but at the end of the month its accountant tallies the results and they turn out to be underwhelming.

Side-note: I use the standard accounting convention of printing negative figures within parentheses.

Pet Food Ad Costs Jan Sales Increase IOAS
Dog Food £2,300 £6,000 £3,000 £700
Cat Food £3,000 £6,000 £2,000 (£1,000)
Total £5,300 £12,000 £5,000 (£300)

Table: “Increase” is the additional sales made in Jan relative to Dec. “IOAS” stands for “Increase on Advertising Spend” and is calculated here as “Increase in Sales - Advertising Costs”. It is only a coincidence that both pet food categories had the same amount of sales in Jan.

At first glance, the data appears damning. Although the advertisements did increase sales, this increase came at the cost of wiping out profits, mostly due to the abysmal performance of the cat food advertising campaign. It seems like advertising was a really bad idea.

But there is a problem with our analysis: Our calculations assumed that the pet food seller’s December sales figures were the baseline, and we judged the effectiveness of January’s foray into advertising relative to this assumed base rate. This assumption may not be justified. What if December was an outlier month, one with far more sales than could be expected in other months? Perhaps it’s a seasonal trend whereby pet owners buy overpriced Christmas treats for their dogs and cats. Or maybe it’s a press coverage thing, with the December boost in sales attributable to a local magazine doing a write-up about the pet food seller’s launch.

Let’s assume that we had access to an alternative universe where the pet seller had forgone advertising in January. What would it have earned?

Pet Food Dec Sales Jan Ad Costs Jan Sales Jan Counterfactual
Dog Food £3,000 £2,300 £6,000 £1,500
Cat Food £4,000 £3,000 £6,000 £2,000
Total £7,000 £5,300 £12,000 £3,500

Table: “Jan Counterfactual” is the key column here, representing the amount of sales that would have happened in January if the pet seller took out no advertisements. I copied over some figures from the last table (i.e., the world with advertising) so you don’t have to flick back and forth.

With the benefit of this counterfactual analysis, we now see that the return on £5,300 of advertising spend would be substantial: It would be responsible for an £8,500 boost in revenue (= £12,000 - £3,500), representing a return on advertising spend of £3,200 (= £8,500 - £5,300). Had we been able to peep at this alternate universe where the pet food seller hadn’t advertised in January, we would have known that the advertising was actually plenty profitable.

As the above example has shown, it was often impossible for businesses advertising in traditional media to say with any confidence whether an advertisement was profitable (at least without a time machine). Ultimately, this problem stemmed from their inability to connect and attribute individual sales to acts of advertising. But with the advent of online advertising and internet technologies, this changed. There appeared all manner of sophisticated new tools for gauging advertisement success, the most important of which was conversion tracking.

Conversion tracking

Conversion tracking is the technology that obviates the need for a time machine by providing a traceable link between sale and advertisement. Whenever a lead sent by an advertising provider buys something, conversion tracking attributes the sale to the specific advertisement (and advertising provider) that was ultimately responsible.2 These technologies, when properly implemented into a business’s practices, end the guesswork about whether advertising was worthwhile. The pet food store would no longer wonder how many of its January sales would have happened “naturally” without advertising; instead, it could simply read these figures off an automatically generated chart on the advertising platform’s website.

Pet Food Ad Cost Jan Sales Natural Orders Ad Orders Total Orders
Dog Food £2,300 £6,000 95 5 100
Cat Food £3,000 £6,000 5 95 100
Total £5,300 £12,000 100 100 200

Table: “Ad Orders” refers to orders that were attributable to the action of advertising.

From the above table, we see that the overwhelming majority (95%) of cat food orders were attributable to advertising, whereas practically none of the dog food orders were. It appears that the cat food advertising campaign was way more effective. Is it time to stop the analysis and switch off the dog food campaign?

No, it isn’t. The number of orders is largely irrelevant; what matters is sales (or revenue). Judging an advertising campaign’s effectiveness by the number of orders it triggered assumes that every order was for an equal amount of money. This won’t be true if, for example, the advertising campaign managed to reach professional buyers who bought in bulk, whereas the orders coming “naturally” were placed by individual consumers who only bought tiny amounts. Our tentative earlier conclusion to switch off the dog food advertising campaign because it didn’t generate enough orders would be wrong if those few dog food orders nevertheless accounted for a disproportionate sum of the total revenue.

The antidote to this uncertainty is to recognise that not all conversions are created equal. This is done by assigning specific financial values to each order. Instead of just recording the number of orders received, the pet food seller would now record the total revenue generated by these orders.3

Pet Food Ad Cost Jan Sales Avg Ad Order Ad Revenue Ad Profit
Dog Food £2,300 £6,000 £800 (wow!) £4,000 £1,700
Cat Food £3,000 £6,000 £47-ish £4,500 £1,500
Total £5,300 £12,000 £85 £8,500 £3,200

Table: “Avg Ad Order” refers to the average basket value of orders placed by customers found through advertising. To save you from the need to refer to the previous table, I’ll repeat that there were 5 Ad Orders for dog food and 95 for cat food. “Ad Revenue” refers to the revenue attributable to these same customers. It is equal to the Avg Ad Order times the number of orders placed by these people. “Ad Profit” is calculated by subtracting the Advertising Cost from the Ad Revenue.

This improved data invalidates our previous tentative conclusion that the dog food advertising campaign was wasteful. Because of the large difference in order size between the groups, the dog food campaign was worth running, and its results turned out to be slightly better that those of the cat food campaign, despite its many individual orders. Talk about a comeback.

Now that we know from our conversion tracking that both the pet food seller’s advertising campaigns generated revenue that would otherwise not have been earned, should it feel confident to continue advertising?

Just when you thought I had exhausted my repertoire of uncertainties and turnarounds, I have one more to introduce: bottom-line profit. When we concluded that both advertising campaigns were worth keeping, we assumed that all revenue was worth the same amount to the business. But this isn’t true—the figure that really matters is bottom-line profit.

The pet food seller has variable costs (costs that change in proportion to the amount of pet food sold), such as the price of raw ingredients, packaging costs, shipping costs, and sales tax. For our purposes, let’s define profit as the difference between the price the food sells for and its variable costs. That gives us:

Pet Food Sales Price Variable Costs Profit
Dog Food £20 £10 £10
Cat Food £20 £3 £17

The above table shows us that £20 of revenue from cat food sales is worth more in profit than the same amount of revenue from dog food sales. Because the pet food seller is ultimately optimising for profit, it would prefer to sell more of its high-profit item—the cat food—than the less-profitable dog food. Therefore, it should pass profit figures to its conversion tracking rather than just revenue numbers. If it can pull this tracking feat off, the pet food seller will have nicely informative data for making profitable business decisions:

Pet Food Ad Revenue Cost of Goods
Dog Food £4,000 £2,000
Cat Food £4,500 £675

Table: Shows the cost of the extra goods sold thanks to advertising.

Pet Food Ad Cost Ad Profit Cost of Goods Bottom-Line Profit
Dog Food £2,300 £1,700 £2,000 (£300)
Cat Food £3,000 £1,500 £675 £825
Total £5,300 £3,200 £2,675 £525

Table: “Ad Profit” again refers to what’s left after subtracting the advertising costs from the revenue generated thanks to advertising. “Bottom-Line Profit” then subtracts the Cost of Goods from this figure.

Now we have our final turn-around: Everything considered, dog food is actually losing money through advertising, whereas cat food is the campaign that is, ahem, bringing home the bacon.

When conversion tracking statistics still err

Because of the limits of modern tracking technologies, there will always be some inaccuracies with the recorded business intelligence figures.

In order for us to gauge the success of an advertisement at causing sales, there must be an unbroken trackable link between the initial advertisement and the ultimate conversion (e.g., the sale). But this link can get severed, for example, when someone first clicks your advertisement on their mobile device and decides not to buy right then, but later googles you on their laptop and completes the sale. Even with the latest technological precautions,4 these two visits may appear separate and unrelated within your conversion tracking reporting, which will cause the effectiveness of your advertisements to be underreported. (The conversion here would be attributed to organic traffic.) Upon viewing this lacklustre performance in your reports, you might be provoked into ditching your advertising campaigns. But doing so would trigger a greater decrease in sales than your conversion data would lead you to expect because you will lose out on all the sales that your tracking was unable to properly attribute.

There are myriad other ways that the attribution link might get severed. Imagine a touring musician advertising their upcoming concert to you. Upon seeing their ad, you decide against buying tickets online, and for buying them in person at the doors. With no electronic trail connecting the online advertisement to your eventual ticket purchase at the venue, the ad will appear a flop, even though the ticket sale would never have happened without it.

The fruits of advertising sometimes manifest long after the ads have finished running. An ad that causes no sales today may nevertheless leave a subtle impression on whoever sees it. This past exposure leads to future affinity—months later, when deliberating over which product to buy, this same person may feel inexplicably inclined towards the product they once saw advertised. These staggered benefits will not appear in recent conversion statistics.

The offshoot of all the above complications is that we usually underestimate the benefit of paid advertising. As such, while we should pay attention to our conversion statistics, we should not be slaves to them. Despite all the technological advances, we should still keep a watchful eye on how overall sales figures change as we switch campaigns on or off. The technology has improved since the days of newspaper ads, but it is still far from perfect.

The guiding rule: Know your margins before advertising

As we saw in the previous section, performance data can misrepresent the truth when it is shallowly analysed. The only way for a business to be on solid ground is to track profit figures and base their advertising analysis and spending off of these.

If a single bag of cat food has a pre-advertising profit of £17 for a £20 bag, that means the pet food seller could pay up to £16.99 on advertising each bag and still remain profitable.

In practice, of course, the pet food seller won’t pay £16.99 for advertising each bag because they would only be left with a mere penny profit on each unit sold. Instead, the seller would expect to earn a minimum margin for itself on each bag (e.g., £2.00). In this case, the most the pet food seller would pay in advertising would be £15.00 per bag sold. Obviously, it’d be better for the seller to pay less in advertising costs because that would leave more profit behind; £15.00 is just its absolute upper limit, constrained by the seller’s internal costs and the minimum profit it is comfortable keeping for itself.

The business that knows its own costs and desired profit margins has an incredibly simple strategy to guide all their advertising decisions: minimise the amount paid per conversion and never continue any advertising campaign that doesn’t leave a comfortable profit margin. This is the most important guiding rule to remember.

Pay Per Click? Per Impression? Per Conversion?

Online advertising platforms offer various different bases on which they will charge you for their advertising services. Are you better off when the payment is reckoned in terms of impressions, clicks, “actions”, target ROAS (“Return On Advertising Spend”), or installs?

Before answering this question I would like to draw a distinction between a) the basis on which you evaluate advertising success; and b) the basis on which you bid for advertising.

The basis on which you evaluate advertising should always be the one closest to your business goal of profiting. Thus, when possible, you should use ROAS (“Return On Advertising Spend”), i.e. the amount of profit you made on your advertising spend. (When this advanced metric is not available, I would evaluate based on cost per conversion.) The reason for choosing these as evaluation bases is that they correspond closely with how we think about our businesses and therefore our analyses become easier to carry out. Case in point: without knowing anything about my business, which of these sounds like it’s a better deal: “£0.40 per thousand impressions” OR “200% return on advertising spend”. Obviously, the return on advertising spend sounds like the safer bet–it’s easier to understand. If we wanted to evaluate whether the cost for thousand impressions was a good deal, we’d have to do a ton of math about the likelihood of each impression clicking and then converting. Yuck.

That said, as much as I prefer evaluating on these high-level bases, the question of what basis I bid on is determined by what is cheaper on the advertising platform. I found that advertising costs can sometimes be dramatically reduced by asking the advertising platform to charge me on a different basis: for instance, I remember a Facebook campaign three years ago which cost me about £0.80 per click when I bid on a “per click” basis. Behind the scenes, my evaluative basis was “cost per conversion” and this cost per click worked out at about £30.00 per conversion. When I switched to bidding “per thousand impressions”, my effective cost per conversion, calculated by looking at the number of conversions the advertising generated, dropped to about £14.00. I don’t pretend to know the reasons why the choice of bidding basis makes a difference to advertising costs; I simply observed that it does.

The above example isn’t intended to show you that bidding by impressions is cheaper; sometimes it is and sometimes it isn’t. Rather, my point is that the basis for bidding is worthy of your experimentation because different bases may lead to reduced costs when compared within a common evaluative basis.


  2. Some marketers have different conversion goals, such as mailing list sign-ups, app installs, or whatever else the website owner considers winning at business. For the sake of simplicity, I’m restricting the present analysis to sales. 

  3. Google Analytics has a special plug-in designed for doing just this: The Ecommerce Plug-in 

  4. Cross-device analytics wizardry, as described in the Google Analytics chapter, helps lessen this problem. 

More Articles: Click here for full archive

Optimising and Debugging Paid Advertisements

Ways metrics mislead you; how to overcome low reach/low quality score/high CPC etc.

The Conversion Surgeon: A Guide to Conversion Rate Optimization

A High-Level Catalogue of The Main Areas to Fiddle With When Optimizing Your Conversion Rate

SEO at the Whole Website Level

Internal linking strategies, sitemaps, and HTTPS