Skip to content

Commit

Permalink
Merge pull request #9 from 1drop/task/PRS-370_add-pageUri-to-hubspot-…
Browse files Browse the repository at this point in the history
…form-submission

[TASK][PRS-370] add pageUri to Hubspot Form Submission
  • Loading branch information
Hans Höchtl authored Jun 15, 2020
2 parents e80cfa7 + f1fc326 commit 55e0145
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/Form/Finisher/HubSpotFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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');
}
Expand Down

0 comments on commit 55e0145

Please sign in to comment.