Page 1 of 1

Problems Populating the Google Tag Manager datalayer

Posted: Wed Feb 21, 2018 6:52 am
by djordje
For the past few days I have been trying to populate the Google Tag Manager datalayer on the OpenCart product page when the button "Add to Cart" is clicked.

I understand that I need to use the push method, but I can't figure out where to place it and how to get the actual data I want.

I turned the internet up side down but found no solution to this. Any help is appreciated.

Re: Problems Populating the Google Tag Manager datalayer

Posted: Wed Feb 21, 2018 7:40 pm
by paulfeakins
Probably best to as for a developer from the Commercial Support forum to do this.

Re: Problems Populating the Google Tag Manager datalayer

Posted: Thu Feb 22, 2018 2:30 am
by djordje
I actually got it to work. The code needs to go in the script that adds the product to the cart.
It starts like this:

Code: Select all

$('#button-cart').on('click', function()