You have no items in your shopping cart.

Sunday, November 24, 2024 4:29:24 PM

OrderCompletedPage - orderId in tag manager datalayer

Posted: 6 years ago

#8120 Quote

scponline

Posted: 6 years ago

#8120 Quote
Hi,

is it possible to add orderId variable to tag manager datalayer in the OrderComplete page?

Thank you,

Posted: 6 years ago

#8121 Quote

Support

Posted: 6 years ago

#8121 Quote
Yes.
How do you want to add it?

Old code
            var product_list = [];
            product_list.push(
             { id: "productID_1", price: price_1, quantity: quantity_1 },
             { id: "productID_2", price: price_2, quantity: quantity_2 }
            );
                        dataLayer = [];
                        dataLayer.push({
                            'PageType': 'BasketPage',
            'email': 'email address of the user',
            'ProductBasketProducts': product_list
                        });

Posted: 6 years ago

#8122 Quote

scponline

Posted: 6 years ago

#8122 Quote
Mmm,

I think it's not the correct code snippet.

From what I can see you should look at GetOrderCompletedPage in TrackingCodeHelper class.
There, when TypeTag.GoogleTagManager condition is met, I would add orderId in the datalayer.
Now there are PageType, PageUrl, email, value, currency and ProductIDList

Thank you,
A.

Posted: 6 years ago

#8123 Quote

Support

Posted: 6 years ago

#8123 Quote
Yes....
it was old format.

Do you want to add new value "orderid"?
I'll add it now.

Posted: 6 years ago

#8124 Quote

scponline

Posted: 6 years ago

#8124 Quote
Yep, exactly.

Now i'm using Tag Manager js custom code functions in order to retrieve it from {{Page Url}}.
But this would be a much cleaner way!

Thanks,
A.

Posted: 6 years ago

#8125 Quote

Support

Posted: 6 years ago

#8125 Quote
I have done it.
Download the new release from out site and try.
Write me about result please.
I didn't changed the release number...

Powered by nopCommerce

Copyright © 2023 FoxNetSoft. All rights reserved