diff --git a/Classes/Form/Finisher/HubSpotFinisher.php b/Classes/Form/Finisher/HubSpotFinisher.php index 2573acb..9ed4af7 100644 --- a/Classes/Form/Finisher/HubSpotFinisher.php +++ b/Classes/Form/Finisher/HubSpotFinisher.php @@ -35,7 +35,6 @@ protected function executeInternal() $hubspotFormData = $this->populateHubspotFormData($formRuntime); $hubspotFormData['hs_context'] = json_encode($this->buildHubspotContext($formRuntime)); - $hubspotFormId = $formRuntime->getFormDefinition()->getIdentifier(); $formSubmitResponse = $this->hubspotFormService->submit($hubspotFormId, $hubspotFormData); @@ -71,9 +70,10 @@ protected function buildHubspotContext(FormRuntime $formRuntime): array $httpRequest = $formRuntime->getRequest()->getHttpRequest(); $hubspotContext = [ 'ipAddress' => $httpRequest->getClientIpAddress(), - 'pageUrl' => $httpRequest->getUri(), + 'pageUrl' => $httpRequest->getServerParams()['HTTP_REFERER'] ?? '', 'pageName' => $formRuntime->getFormState()->getFormValue('page') ?? '', ]; + if ($httpRequest->hasCookie('hubspotutk')) { $hubspotContext['hutk'] = $httpRequest->getCookie('hubspotutk'); }