xyNNN / GoogleTagManagerBundle

Google Tag Manager Bundle for Symfony 2
https://github.com/xyNNN/GoogleTagManagerBundle
GNU Lesser General Public License v3.0
27 stars 15 forks source link

If persist any kind of redirect, the data is lost #43

Open alexkingdom opened 2 years ago

alexkingdom commented 2 years ago

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 ?

xyNNN commented 2 years ago

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?

alexkingdom commented 2 years ago

@xyNNN I will try to explain, think about situation when someone buy a ticket from your site. How it's look like:

  1. Click button buy
  2. Post request to payment endpoint (not ajax)
  3. We make all checks if user have enough money
  4. In case of success of point 3, we set data layer something like: $googleTagManager->addPush(['purchase' => 'ticket', 'amount' => 125.50]);
  5. 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.

image

xyNNN commented 2 years ago

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!

alexkingdom commented 2 years ago

Will make more deep investigation but later. Now too busy :(

kristjan-kure commented 1 year ago

@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?

stefandoorn commented 1 year ago

@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.