get()['gtm_enabled']; } /** Emit validated public configuration. */ public function render_base_code(): void { $s = ( new Repository() )->get(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Validated public JSON captured by EventManager. echo wp_json_encode( array( 'enabled' => $this->is_enabled(), 'id' => $s['gtm_id'], 'layer' => $s['gtm_data_layer'], 'server_url' => $s['gtm_server_url'], 'only' => $s['gtm_data_layer_only'], ), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ); } /** * Service operation. * * @param Event $event Internal envelope. * @return array|null */ public function map_event( Event $event ): ?array { $mapped = \PixelPair\Events\Mapping::event( $event, 'gtm' ); if ( ! $mapped ) { return null; } return array( 'event' => 'pixelpair_' . $mapped['name'], 'pixelpair' => array( 'event_id' => $event->event_id, 'params' => $mapped['params'], ), ); } /** GTM uses the browser transport. */ public function supports_server_side(): bool { return false; } /** * Service operation. * * @param Event $event Browser-only adapter. */ public function send_server_event( Event $event ): void {} }