You are here

public static function OfficialFacebookPixelInjection::injectScriptCode in Official Facebook Pixel 7

Same name and namespace in other branches
  1. 8 src/OfficialFacebookPixelInjection.php \Drupal\official_facebook_pixel\OfficialFacebookPixelInjection::injectScriptCode()
1 call to OfficialFacebookPixelInjection::injectScriptCode()
OfficialFacebookPixelInjection::injectPixelCode in src/OfficialFacebookPixelInjection.php

File

src/OfficialFacebookPixelInjection.php, line 45
Contains \Drupal\official_facebook_pixel \OfficialFacebookPixelInjection.

Class

OfficialFacebookPixelInjection
Class OfficialFacebookPixelInjection.

Namespace

Drupal\official_facebook_pixel

Code

public static function injectScriptCode($options) {

  // Inject inline script code to head
  $pixel_script_code = PixelScriptBuilder::getPixelBaseCode();
  $pixel_script_code .= PixelScriptBuilder::getPixelInitCode($options
    ->getAgentString(), $options
    ->getUserInfo());
  $pixel_script_code .= PixelScriptBuilder::getPixelPageViewCode();
  drupal_add_html_head([
    '#type' => 'markup',
    '#markup' => $pixel_script_code,
    '#weight' => 1000,
  ], 'facebook_pixel_script_code');
}