function engagements_create_new_tracking_img_url

6.x engagements.module engagements_create_new_tracking_img_url($cid)

Generates a URL to our tracking pixel, based on the cid included.

1 call to engagements_create_new_tracking_img_url()

File

modules/engagements/engagements.module, line 3334
This is the primary module file for the engagements module.

Code

function engagements_create_new_tracking_img_url($cid) 
 {

  $token = hash('sha512', ($cid . microtime() . mt_rand(9, 99999) . mt_rand(9, 99999)));
  $url = $GLOBALS ['fp_system_settings']['base_url'] . '/' . fp_url("engagements-track/$cid/$token/pixel.gif", '', FALSE);

  // Write to database
  db_query('INSERT INTO engagements_tracking (cid, token, opens, updated)
            VALUES (?, ?, ?, ?)', array($cid, $token, 0, time()));


  return $url;
}