- Issue created by @loze
- πΊπΈUnited States loze Los Angeles
it appears that in the call to
fbq("track", event['event'], event['data']);
in facebook_pixel.js
event['data']
is a string and not a json object.changing this line to
fbq("track", event['event'], JSON.parse(event['data']));
seems to fix it.I will provide a patch
- Merge request !17Issue #3403531 by loze: ViewContent custom parameters appear incorrect in meta pixel helper chrome plugin β (Merged) created by loze
- last update
about 1 year ago 23 pass - πΊπΈUnited States loze Los Angeles
With the patch, this is the output on the pixel helper now. Which seems correct.
- Status changed to Needs review
about 1 year ago 6:02am 25 November 2023 - Assigned to Grevil
- Status changed to Needs work
7 months ago 1:43pm 12 June 2024 - π©πͺGermany Grevil
Yea, this is quite weird, the approach here is incorrect though:
Inside "facebook_pixel.module" line 51, we have the following code:
'data' => Xss::filter(json_encode($event['data'])),
This doesn't make much sense as Xss::filter returns a string. Instead, we should turn the statements around.
- last update
7 months ago 23 pass - Status changed to Needs review
7 months ago 1:48pm 12 June 2024 - π©πͺGermany Grevil
This should do the trick. Feel free to test it @loze!
- Issue was unassigned.
- Status changed to Needs work
7 months ago 5:37pm 13 June 2024 - πΊπΈUnited States loze Los Angeles
Thanks Grevil, I tried your MR and get the following error now
The website encountered an unexpected error. Try again later. TypeError: strlen(): Argument #1 ($string) must be of type string, array given in strlen() (line 395 of core/lib/Drupal/Component/Utility/Unicode.php). Drupal\Component\Utility\Unicode::validateUtf8(Array) (Line: 65) Drupal\Component\Utility\Xss::filter(Array) (Line: 52) facebook_pixel_page_attachments(Array) (Line: 311) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}(Object, 'facebook_pixel') (Line: 388) Drupal\Core\Extension\ModuleHandler->invokeAllWith('page_attachments', Object) (Line: 308) Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 285) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 284) Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128) Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90) Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) call_user_func(Array, Object, 'kernel.view', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 193) Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object, 1, 1) (Line: 53) Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
- π©πͺGermany Grevil
My apologies @loze, your original changes were correct, while mine are not. I think I simply rushed it and came to an incorrect solution.
We always get a JSON string inside our js, which we need to parse to "real" JSON, like your original changes suggested. I'll revert my changes. - Status changed to RTBC
7 months ago 7:39am 18 June 2024 - Status changed to Fixed
7 months ago 7:40am 18 June 2024 -
Grevil β
committed b169f499 on 2.x authored by
loze β
Issue #3403531 by loze: ViewContent custom parameters appear incorrect...
-
Grevil β
committed b169f499 on 2.x authored by
loze β
- π©πͺGermany Grevil
Oh, this was already fixed through π Event data should be passed as object Fixed . I thought the gitlab diff might be buggy. Oh, well.
Automatically closed - issue fixed for 2 weeks with no activity.