Connect
https://docs.google.com/document/d/1VpsH32hYuPAI6adh0EuOmw9hgLfn_X0HgUL2F4afhDo/edit?tab=t.0#heading=h.62xyoovtb64s
NConfigure in the Google Tag Manager panel and install the code on the website
The website is written in Next.js (React + TypeScript) using Node.js on the server side.
Installation of Google Ads dynamic remarketing event code in the website code
It is necessary to add the dynamic remarketing event code and configure data transmission in the events. The event codes need to be added to the website in the head section after the GTM code.
Mandatory events
When visiting the product card, the following code should be triggered:
dataLayer.push({ 'event': 'GAds_view_item', 'value': 78.45, // corresponds to the value of the product 'items' : [{ 'id': '1234', // corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }] }); |
When adding a product to the cart, the following code should be triggered:
dataLayer.push({ 'event': 'GAds_add_to_cart', 'value': 78.45, // corresponds to the value of the product 'items' : [{ 'id': '1234', // corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }] }); |
When visiting the thank you page after a successful purchase, the following code should be triggered (here is an example for the purchase of 2 products)
dataLayer.push({ 'event': 'GAds_purchase', 'value': 78.45, // corresponds to the total of all purchased products 'items' : [ { 'id': 1234, // corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }, { 'id': 45678, // corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' } ] }); |
Additional events (if possible, it would be good to add additional parameters)
When viewing search results, it is necessary to transmit the ID of all products that are in view:
dataLayer.push({ 'event': 'GAds_view_search_results', 'value': 6666, // corresponds to the total of all products on the search page 'items': [ { 'id': 1234, //// corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }, { 'id': 3213, //// corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }, { 'id': 5236, //// corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' } ] }); |
When viewing the category page, transmit the ID of all products that are in view:
dataLayer.push({ 'event': 'GAds_view_item_list', 'value': 6666, // corresponds to the total of all products on the search page 'items': [ { 'id': 1234, //// corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }, { 'id': 3213, //// corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' }, { 'id': 5236, //// corresponds to the id or item_group_id of the product from the Merchant Center feed 'google_business_vertical': 'retail' } ] }); |