 # The brighter you are, the more you have to learn.

## Optimize Campaign Spend to Minimize Cost of Acquisition

#### Author – Author – Ankit Gadi , Data Scientist at Decision Tree Analytics Customer journeys are becoming more complex with the evolution of new online platforms. It is more than normal that a customer journey contains a set of touch points on different platforms before a conversion. Here an attribution model works as the rule, or set of rules, that determines how credit for sales and conversions is assigned to touch points in conversion paths. So, accuracy of Media Allocation optimization, which is the process of distributing the budget with the objective of optimizing the conversions, depends on how holistic, accurate information about the financial return activities are being delivered by attribution modeling.

Digital marketing requires allocation of the budget across digital media channels like AdWords, Bing, DCM, and Facebook to engage customers.The challenge here is how to optimize allocation of the budget for maximizing the business objectives subject to certain constraints.

Linear Programming Model:Linear programming techniques optimize a linear objective function, subject to equality and/or inequality constraints.

Components of a linear programming equation:

Objective function: Function that maps an event or values of one or more variables onto a real number intuitively representing some "cost" associated with the event.This function is to be maximized or minimized.

Equality and Inequality Constraints:These are the constraints added on the variables that are involved in formulation of the model. A constraint is a condition of an optimization problem that the solution must satisfy. There are several types of constraints—primarily equality constraints, inequality constraints, and integer constraints.

A general form of linear programming problem is represented as follows:

Minimize/Maximize Z= cTx

subject to,

Ax ≤ b

and x ≥ 0

where x represents the vector of variables (to be determined), c and b are vectors of (known) coefficients, A is a (known) matrix of coefficients, and ( )T is the matrix transpose. The expression to be maximized or minimized is called the objective function (cTx in this case). The inequalities Ax ≤ b and x ≥ 0 are the constraints over which the objective function is to be optimized.

The most popular method for linear optimization is the Simplex Method. It uses a systematic strategy to generate and test candidate vertex solutions to a linear program. That is, iteratively it chooses the variable that can make the biggest modification toward the optimum solution. It continues to solve until there is no more improvement possible without violating the user defined constraints.

Applying Linear Programming for media allocation

Towards optimization, the foremost step is to define the objective and constraints based on the business knowledge and requirements.

Our objective function would be the product of a variable representing the allocated spends for the channels and a variable representing total number of conversions per unit spend.

Mathematically the objective function can be defined as:Z = ∑ (Xc * Ic)

Where Xc represents the spend across each channel and IC represents the conversion per unit spend across each channel. Also, if we want a minimum number of clicks for Facebook, then one of the constraint can be Xfb*Clfb > α,

where α is the minimum clicks desired and Cl is the Clicks per spend which can be inferred from the historical data and Xfb is the spend for Facebook.

Likewise, in our data set we have constraints for minimum number of impressions, clicks and conversions along with total and individual channel budget constraints.Based on the data set available,the technique for estimating the coefficients of objective function and constraints might differ. For a data set larger than 6 months,it is important to account for seasonality and trends; ARIMA or Holt Winter Models can be used to forecast the coefficients here. However, for a smaller dataset, we can estimate the coefficients by averaging out historic data values.

Optimization of budget spends is essential in today’s day and age, linear optimization is one alternative among others. A proposed linear optimization model saw a client’s conversion increasing by ~14%.