You are here

public static function PixelScriptBuilder::getPixelNoscriptCode in Official Facebook Pixel 7

Same name and namespace in other branches
  1. 8 src/PixelScriptBuilder.php \Drupal\official_facebook_pixel\PixelScriptBuilder::getPixelNoscriptCode()

Gets FB pixel noscript code

1 call to PixelScriptBuilder::getPixelNoscriptCode()
OfficialFacebookPixelInjection::injectNoScriptCode in src/OfficialFacebookPixelInjection.php

File

src/PixelScriptBuilder.php, line 157
Contains \Drupal\official_facebook_pixel\PixelScriptBuilder.

Class

PixelScriptBuilder
Pixel object

Namespace

Drupal\official_facebook_pixel

Code

public static function getPixelNoscriptCode($event = 'PageView', $cd = array(), $tracking_name = '') {
  if (empty(self::$pixelId)) {
    return;
  }
  $data = '';
  foreach ($cd as $k => $v) {
    $data .= '&cd[' . $k . ']=' . $v;
  }
  if (!empty($tracking_name)) {
    $data .= '&cd[' . self::FB_INTEGRATION_TRACKING_KEY . ']=' . $tracking_name;
  }
  return sprintf(self::$pixelNoscriptCode, self::$pixelId, $event, $data);
}