GoogleTagManagerBundle
GoogleTagManagerBundle copied to clipboard
If persist any kind of redirect, the data is lost
Seems this bundle doesn't care about situation when for example user paid something and we redirect to success page. I think we need to use something like flash messages in symfony that will show one time the data.
What do you think ?
What do you mean? Can you explain a bit more your issue or use case? And where do you think that the bundle should cover this task?
@xyNNN I will try to explain, think about situation when someone buy a ticket from your site. How it's look like:
- Click button buy
- Post request to payment endpoint (not ajax)
- We make all checks if user have enough money
- In case of success of point 3, we set data layer something like:
$googleTagManager->addPush(['purchase' => 'ticket', 'amount' => 125.50]);
- Redirect to success page
And on success page we don't have this data layer with these data. Hope you understood me. Below you will find just small piece of code.
Sorry @alexkingdom for this delay. Currently I'm very busy myself and don't find time to investigate your issue. Perhaps you could please debug it yourself to identify your problem and that I'm willed to help you to merge this pull request ASAP and create a new bugfix release for you!
Will make more deep investigation but later. Now too busy :(
@alexkingdom - Do you mean GA4 purchase event with attributes: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#make_a_purchase_or_issue_a_refund should be triggered on success page?
@alexkingdom I think it makes more sense that you make sure the right attributes are injected into GTM on the actual success page. I don't think this library should persist things to a next pageview as everyone's use case is different.
E.g. I do similar to you on the confirmation page in a project. I store the Order ID in the session, then I use that Order ID on the success page to pull the data I need, clear the session and inject it into GTM.