However, if you wish to look at each headline as a different
group, you could easily group by creativeid, which is guaranteed to be distinct for each ad, and then display
the creativeid instead of the headline. In that case, it would be difficult to tell ads with the same
headline apart, so you would need to devise a way to distinguish them, such as by including the body copy
on each line of the report.
The code then sorts the results_raw array by the ratio of cost per click of each item.
This will be used by the next chunk of code to determine which ads should be used first.
The source XML has a cpc field, which is, in theory, equal to the cost divided by the clicks;
however, this field is heavily rounded, despite being in units of one-millionth of a cent.
Instead of using this field, the code calculates the cost per click by dividing the cost by the
number of clicks, which is more accurate. In fact, in this example, replacing instances of
calculating the cost per click on the fly with the precalculated cpc field leads to several
rounding errors, including one that is 50 cents or so.
Pages:
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394