From f1fc326b8a0afb0e6ba453d5a965e2f35e6644b5 Mon Sep 17 00:00:00 2001 From: Elizabeth Dunphy Date: Wed, 10 Jun 2020 14:43:09 +0200 Subject: [PATCH] [TASK][PRS-370] add pageUri to Hubspot Form Submission --- Classes/Form/Finisher/HubSpotFinisher.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'); }