Support

Home Forums Event Espresso Premium DataLayer for Enhanced Ecommerce

DataLayer for Enhanced Ecommerce

Posted: March 10, 2020 at 7:23 am


botanicwise

March 10, 2020 at 7:23 am

On confirmation of a registration (thank you page), we need to have a dataLayer to meet the criteria in this sample:
<script>
// Send transaction data with a pageview if available
// when the page loads. Otherwise, use an event when the transaction
// data becomes available.
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': 'T12345', // Transaction ID. Required for purchases and refunds.
'affiliation': 'Online Store',
'revenue': '35.43', // Total transaction value (incl. tax and shipping)
'tax':'4.90',
'shipping': '5.99',
'coupon': 'SUMMER_SALE'
},
'products': [{ // List of productFieldObjects.
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1,
'coupon': '' // Optional fields may be omitted or set to empty string.
},
{
'name': 'Donut Friday Scented T-Shirt',
'id': '67890',
'price': '33.75',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Black',
'quantity': 1
}]
}
}
});
</script>

I’m having some difficulty figuring out how to get this info at this stage in the process. Can you provide some guidance?


Josh

  • Support Staff

March 19, 2020 at 10:36 am

Hi,

You’ll find an example in this other topic:

https://eventespresso.com/topic/push-conversion-event-to-datalayer/#post-295800


botanicwise

March 19, 2020 at 11:08 am

Josh, thanks for sharing that example. Unfortunately, that example is for the old form of ecommerce tracking and does not cover Enhanced Ecommerce. Additionally, the example does not address the specific issue that I am having. I need to get the actual tickets being purchased.

I do hope that Event Espresso considers adding a full-fledged data layer to your checkout process as this is essential in today’s digital marketing world.


Josh

  • Support Staff

March 19, 2020 at 11:19 am

Unfortunately, that example is for the old form of ecommerce tracking and does not cover Enhanced Ecommerce.

Regardless of the type of ecommerce tracking you’re looking to do (there are many) the important part of the example is it shows how to get a value (in this case a transaction total) from the transaction object. You can use that part of the example with any type of ecommerce tracking.

Additionally, the example does not address the specific issue that I am having. I need to get the actual tickets being purchased.

Anything else transaction, event, ticket and registration-related you’d like to add can be grabbed from the $transaction object by using the model system which is documented here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

The support post ‘DataLayer for Enhanced Ecommerce’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso