Add To Cart Data Layer

Silver Contributor
Silver Contributor

I'm a bit confused on the directions which I need to give to my DEV for implementing the ecommerce tagging with GA & Adobe Analytics via Tealium. 

Our product is purchased through a 8-step (page) process. Customer move from step to step by clicking the next button until the last step which is the final "purchase" button. The steps are:

1) Start Page

2) Main Product Add to Cart

3) Optional Add-On Add to Cart #1

4) Optional Add-On Add to Cart #2

5) Optional Add-On Add to Cart #3

6) Customer Details

7) Payment Details

8) Confirmation

 

For this reason, our "cart" is finite as at most you can only purchase 4 items and. The cart can contain as little as one item. 

 

My question is on how to populate the data layer. Do I need to continually populate the ecommerce values of the variables (product_id, product_name, product_variant, product_category, product_price, product_quantity) on every single "add_to_cart" event or do I just poplate the item that is being added at that time. 

 

Example 1:

Step 2:

event_name : add_to_cart
product_name : ['main_product']

step 3:

event_name  : add_to_cart
product_name : ['main_product', 'optional_add_on1']

step 4:

event_name  :  add_to_cart
product_name : ['main_product', 'optional_add_on1', 'optional_add_on2']

step 5:

event_name  :  add_to_cart
product_name : ['main_product', 'optional_add_on1', 'optional_add_on2', 'optional_add_on3']

 

Example 2:

Step 2:

event_name : add_to_cart
product_name : ['main_product']

step 3:

event_name  : add_to_cart
product_name : ['optional_add_on1']

step 4:

event_name  :  add_to_cart
product_name : ['optional_add_on2']

step 5:

event_name  :  add_to_cart
product_name : ['optional_add_on3']

 

3 REPLIES 3

Add To Cart Data Layer

Community Manager
Community Manager

@MichaelG Good question. Example 2 is the correct way. On the cart_add event, the contents of the product variables should only contain the item that was just added to the cart. If you also want to keep track of the current contents of the cart you can use separate variables for those. Our recommended spec calls those cart_product_* variables.

See: Add to Cart Data Layer Spec

Hope that helps!

Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.

Add To Cart Data Layer

Gold Contributor
Gold Contributor

This is suggestion from my side, Always try to add all the product varibale data layer when cusotmer click "add_to_cart" and persist those data layer till they give the purchase from their side. It would help us to track the revenue of each product. Also, it would help us to track how many products has been dropped off by the customer at the end of the purchse. 

Add To Cart Data Layer

Employee Emeritus

Good point @TealiumJustin , I have to agree with you there. Method 2 would be the ideal way to implement.

As each cart_add event triggers, populate the cart_product_* variables with the data being sent with the link event. For cart_remove, do the opposite, and remove the values from cart_product_* variables on that event.

There are some vendors that prefer the full cart sent on cart_add event, however, those vendors can be satisfied by referencing the cart_product_* variables instead.

Public