Importing CPC and calculating ROI in AlterCPA

Xoxo everyone, Reznik here and today we will count the loot.

Starting with version 3.17, a very convenient feature has appeared in AlterCPA Pro: we upload information about the costs of advertising campaigns and get deep analytics of costs and ROI in the context of all AlterCPA multi-level reports. I will tell you how to use this tool and what pitfalls will meet you on the way to total financial accounting.

Features of work

The new version of AlterCPA has useful statistics columns that allow you to evaluate the real success of your advertising campaigns. They are included in the “Advanced” system settings. Here’s what we added to the Traffic block:

  • Clicks – this is the number of paid clicks calculated by the system. Not all transitions are considered paid, because updating a page or entering from a pre-landing page to a landing page is definitely not worth counting.
  • CPC – the average cost per click from the previous column.
  • Expense – total traffic consumption, product of the first two columns
  • Profit – the difference between the expense and the amount of income for accepted leads and leads in the hold. Considering that we consider leads with delayed confirmation as hold, you can safely add them to our income.
  • ROI – the ratio of the amount of income to the amount of expense, indicated as a percentage. ROI less than 100 is a sign of complete failure.

For a start, a moment of disappointment. The mechanism implemented in AlterCPA is precisely the import of expenses, not their loading. This means that you yourself have to knock on the system and tell it: “I’m sharing!” – indicating at the same time how much was spent and by what criteria. AlterCPA on its own will not load anything from anywhere, because there are many ad networks, but AlterCPA is one and only. Just like Russian Post.

Another important point is the peculiarities of calculating paid clicks from the total number of clicks. A click is considered to be paid if certain conditions are met. First, the click must be unique. The system does not remember whether a click came to it from the outside or was a simple page refresh or a transition to one of the internal pages of the landing page, so for ease of selection we consider only unique clicks. Secondly, the click on the landing page should be direct, and not come from the pre-landing page. All transitions from pre-landings, including unique ones, will not be considered paid. Therefore, it is recommended to send the price not for one click, but for the entire volume of clicks – AlterCPA itself will set the price tag for all the clicks that it likes.

The technical side of the process

Price tags are sent using the wm/cost function, which will look something like this for you:

The most important parameters that a function expects is the cost of clicks:

  • cpc – cost per click, not recommended
  • cost – price for the entire selected volume of clicks, recommended
  • currency or curr – the three-letter ISO-code of the currency in which the click price is indicated.

It is recommended to submit exactly cost and ideally complement it with currency. If the currency code is not transmitted, then clicks are considered to be priced in the system’s standard currency.

In addition to the price, it is imperative to transfer at least one of the filters, you can do everything at once. The following filtering options for clicks are available:

  • flow – flow stream ID.
  • utmsutm_source tag
  • utmcutm_campaign tag
  • utmnutm_content tag
  • utmtutm_term tag
  • utmmutm_medium tag
  • from – date and time for the start of clicks selection, not inclusive.
  • to – date and time for the end of the selection of clicks, inclusive.

There are several interesting life hacks associated with the from and to parameters.

  1. You can pass integers in these parameters and they will be interpreted as UNIX timestamp. This is optimal when importing data from any smart system, which was done by programmers with arms growing out of their shoulders. In this case, the selection period will be strictly greater than from and less than or equal to to.
  2. You can transmit the date and time in a human-readable format YYYY-MM-DD HH: MM: SS, without resorting to terrible and incomprehensible large numbers. This date will be recognized by AlterCPA in relation to the time zone set in the system.
  3. You can cram any game into these parameters that the strtotime function understands. You can read more about these formats read the PHP documentation, everything is described in sufficient detail there. For example, when transmitting clicks for the last 24 hours, you can use from with the value “-24 hours”, and in to just pass “now”.

The parameters themselves can be passed in the GET or POST part of the request. It is very important: you cannot pass part of the parameters to GET, and some to POST – the system will perceive this as two separate requests and process both separately. If you want to send data about a bunch of clicks at once, you can stick them in an array into one parameter batch, so that you get something like this:

    "batch": [
            "flow": 42,
            "cost": 1984,
            "currency": "usd"
            "from": "2020-04-04 00:00:00",
            "to": "2020-04-07 23:59:59",
            "cpc": 1.337,
            "currency": "eur"

Now that we are imbued with the technical side of the process, let’s try to understand with a few examples how this will work in reality.

Practical examples

For convenience, we will assume that we indicate the traffic source in the utm_source parameter, the advertising campaign identifier goes to utm_campaign, and the code of a specific creative fits into utm_content.

Total flow rate

Let’s say we use one stream per ad campaign, and the ad network can periodically send us a postback with the total amount spent on this campaign over the entire time.

In this case, we simply specify the postback with the flow identifier in the flow parameter, and in the cost parameter we pass the total flow amount specified in the corresponding macro, for example, {spend}.

The postback will look like this:{spend}

Flow rate for a fixed period

Let’s assume that our ad network from the point above is able to send a postback every hour, indicating the amount spent for this particular hour. In this case, the from parameter with the value “-1 hour” will appear in the postback, which corresponds to the period of sending statistics. The to parameter is optional, because by default it corresponds to the current moment.{spend}&from=-1hour

Flow rate for an arbitrary period

Suppose that our ad network cannot send a postback once an hour, but it can send it for an arbitrary period. And she can indicate the beginning of this period in the {start} macro in any convenient form. In this case, we will pass the {start} macro into the from parameter:{spend}&from={start}

If the ad network can indicate not only the beginning of the period, but also its end in the {end} macro, we will add it to the to parameter.{spend}&from={start}&to={end}

Advertising campaign expense

Let’s assume that our network uses a global postback, and we are not tied by a stream to a specific ad campaign. In this case, we need to filter clicks by utm_campaign, it was not in vain that we configured it in the link.

Surely we are using more than one network, so for our imaginary Pedobear Advert network, we pre-specified the utm_source parameter in the stream with the pedadvert value. This means that we add the same filter to the postback in the utms parameter. In this case, the advertising campaign identifier is given in the {campaign} macro and sent to the utmc parameter.

In this case, our smartest postback will look like this:{campaign}&cost={spend}&from={start}&to={end}

It will set the cost per click for all streams from the selected ad network, scattering everything among ad campaigns and tying it to the desired period. At the same time, it is very important that UTM tags must be present in the flowing URLs.

Integration with well-known systems

This section will be updated as it integrates with existing traffic supply sources, ad networks, trackers and analytics systems.

It is deserted here for now, because the ROI calculation has not even been announced yet. Send your integration options, we will add everything here!

Reznik, out!