You are here

function ad_delayed_track_impression in Advertisement 7.3

Worker callback to track the impression from the queue.

Parameters

$data:

1 string reference to 'ad_delayed_track_impression'
ad_cron_queue_info in ./ad.module

File

./ad.module, line 727
Core code for the ad module.

Code

function ad_delayed_track_impression($data) {
  $event = entity_create('tracked_event', $data);
  $event
    ->save();
  ad_increase_denormalized_counter($data['ad'], 'total_impressions');

  // Also denormalize data in any existing click.
  // Text fields are limited to 255 characters (see eck_property_type_schema())
  // so truncate to avoid errors.
  db_query("\n    UPDATE eck_tracked_event SET\n      url = :url,\n      page_title = :page_title,\n      page_unique_id = :page_unique_id\n    WHERE\n      type = 'click' AND parent_unique_id = :unique_id\n  ", array(
    ':url' => substr($data['url'], 0, 255),
    ':page_title' => substr($data['page_title'], 0, 255),
    ':page_unique_id' => substr($data['page_unique_id'], 0, 255),
    ':unique_id' => substr($data['unique_id'], 0, 255),
  ));
}