K
K
Kerm2017-10-25 15:08:35
Google
Kerm, 2017-10-25 15:08:35

Question on google tag manager, how to pass information before redirecting to the payment site?

In the basket, after placing an order, they asked me to send information about the completed order to google, that the order has been created for me in the Ajax response, where I wrote the code:

dataLayer.push({
                    'event': 'PayByCard',
                    'ecommerce': {
                            'purchase': {
                                'actionField': {
                                    'id': ''+rd.o_id['order_id']+'',
                                    'revenue': ''+rd.o_id['price'].replace(/[^0-9$.,]/g, '')+'',
                                    'coupon': ''+rd.o_id['coupon']+'',
                                },'products': products
                            }

                    },
                    'eventCallback' : function() {
                        alert('Сейчас Вы будите перенаправлены на страницу оплаты.');
                        id('order_payment').submit();
                    }
                })

In theory, as it is written in the documentation, everything inside the eventCallback should work after transferring information about the order to Google, I have a redirect there to the payment page after. But for some reason, Google does not receive order data, can someone tell me what? I checked push works, there are no errors in the code, but if you push and then immediately redirect to another site, then order data is not transmitted to Google.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2017-10-25
@dimonchik2013

deal with headlines and traffic movements

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question