function facebook_pixel_add_event in Facebook Pixel 7
Adds Facebook Pixel event to the user session to be added to the page code.
Parameters
string $event: A Facebook Pixel event to be added to the page code.
See also
facebook_pixel_page_alter()
6 calls to facebook_pixel_add_event()
- facebook_pixel_commerce_cart_product_add in ./
facebook_pixel.module - Implements hook_commerce_cart_product_add().
- facebook_pixel_commerce_checkout_complete in ./
facebook_pixel.module - Implements hook_commerce_checkout_complete().
- facebook_pixel_commerce_checkout_router in ./
facebook_pixel.module - Implements hook_commerce_checkout_router().
- facebook_pixel_ctools_render_alter in ./
facebook_pixel.module - Implements hook_ctools_render_alter().
- facebook_pixel_node_view in ./
facebook_pixel.module - Implements hook_node_view().
File
- ./
facebook_pixel.module, line 110 - Drupal Module: Facebook Pixel.
Code
function facebook_pixel_add_event($event) {
// Add variable to session only if module is configured.
if (variable_get('facebook_pixel_id')) {
if (!isset($_SESSION['facebook_pixel'])) {
$_SESSION['facebook_pixel'] = array();
}
// Use event name for array key as well, so that we don't send
// the same event multiple times.
$_SESSION['facebook_pixel'][$event] = $event;
}
}