public static function getPixelInitCode()

in core/FacebookPixel.php [101:120]


  public static function getPixelInitCode($agent_string, $param = array(), $with_script_tag = true) {
    if (empty(self::$pixelId)) {
      return;
    }

    $code = $with_script_tag
    ? "<script type='text/javascript'>" . self::$pixelFbqCodeWithoutScript . "</script>"
    : self::$pixelFbqCodeWithoutScript;
    $param_str = $param;
    if (is_array($param)) {
      $param_str = json_encode($param, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT);
    }
    $agent_param = array('agent' => $agent_string);
    return sprintf(
      $code,
      'init',
      self::$pixelId,
      ', ' . $param_str,
      ', ' . json_encode($agent_param, JSON_PRETTY_PRINT));
  }