registerForAutoconfiguration(PageviewExtractor::class)->addTag('tracking.extractor.pageview'); $containerBuilder->registerForAutoconfiguration(RecordviewExtractor::class)->addTag('tracking.extractor.recordview'); $containerBuilder->addCompilerPass(new class() implements CompilerPassInterface { public function process(ContainerBuilder $containerBuilder): void { $registry = $containerBuilder->findDefinition(Registry::class); foreach ($containerBuilder->findTaggedServiceIds('tracking.extractor.pageview') as $id => $tags) { $definition = $containerBuilder->findDefinition($id); if (!$definition->isAutoconfigured() || $definition->isAbstract()) { continue; } $registry->addMethodCall('addPageviewExtractor', [$definition]); } foreach ($containerBuilder->findTaggedServiceIds('tracking.extractor.recordview') as $id => $tags) { $definition = $containerBuilder->findDefinition($id); if (!$definition->isAutoconfigured() || $definition->isAbstract()) { continue; } $registry->addMethodCall('addRecordviewExtractor', [$definition]); } } }); };