public static function getPixelTrackCode()

in core/FacebookPixel.php [129:151]


  public static function getPixelTrackCode($event, $param = array(), $tracking_name = '', $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)) {
      if (!empty($tracking_name)) {
        $param[self::FB_INTEGRATION_TRACKING_KEY] = $tracking_name;
      }
      $param_str = json_encode($param, JSON_PRETTY_PRINT);
    }
    $class = new ReflectionClass(__CLASS__);
    return sprintf(
      $code,
      $class->getConstant(strtoupper($event)) !== false ? 'track' : 'trackCustom',
      $event,
      ', ' . $param_str,
      '');
  }