How to use GA4 Ecommerce as Input to the Facebook GTM Template

For now, the Facebook Pixel GTM Template doesn’t support GA4 Ecommerce as input. In this blog post you find 2 scripts that makes it possible to use GA4 Ecommerce as input to the Facebook GTM Template.

  1. Supports only GA4 Ecommerce
  2. Supports both GA4 Ecommerce and GA Enhanced Ecommerce

Hopefully the Facebook Template will soon support GA4 Ecommerce as input, and make this blog post redundant.

Google Tag Manager Setup

First, create a Data Layer Variable:

  • Data Layer Variable Name: ecommerce
  • Data Layer Version: Version 1
Ecommerce - Data Layer Variable - Version 1

This Variable will be used as input in the Custom Javascript Variable.

1. GA4 Ecommerce only

If you have a pure GA4 Ecommerce implementation, this script will convert GA4 Ecommerce to Facebook Ecommerce based on GA4 Ecommerce Events.

Add this script to a Custom Javascript Varible.

In addition, you need to activate the following Variable:

  • Event

2. GA4 Ecommerce and GA Enhanced Ecommerce

This script supports both GA4 Ecommerce and GA Enhanced Ecommerce. This is handy if your site has both GA4 Ecommerce and Enhanced Ecommerce implemented, or you want a smooth transition from Enhanced Ecommerce to GA4 Ecommerce.

Add this script to a Custom Javascript Varible.

In addition, you need to activate the following Variable:

  • Event

Facebook GTM Template Setup

In the Object Properties setting, add the Custom Javascript Variable as input to the Load Properties From Variable (1).

As Event Name you can either use Standard or Custom (2). In this setup Custom is used as input, and here I have mapped implemented GTM Events with Facebook Ecommerce Events using a Lookup Table. How you choose to to this, I leave that to you.

Facebook GTM Tempalte Setup with GA4 Ecommerce as input.

When it comes to Triggers for this Tag, I have GTM Events implemented both for GA4 Ecommerce and Enhanced Ecommerce, and use those Events as Triggers.

Some of the code is inspired by the Facebook Template.

That’s it.

Be the first to comment on "How to use GA4 Ecommerce as Input to the Facebook GTM Template"

Leave a comment

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.