Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enhanced e-commerce tag through GTM v5 using firebase bundle

I am working on an e-commerce Android application and I would like track Enhanced e-commerce events on Google Analytics through GTM v5 (included in Firebase SDK).

For that, to send an "impressions" event, I try to transform the old datalayer to a bundle object accepted by GTM v5 with Firebase SDK.

So, the following datalayer

DataLayer.mapOf(
                    "currencyCode", "EUR",                                  // Local currency is optional.
                    "impressions", DataLayer.listOf(
                            DataLayer.mapOf(
                                    "name", produitsDispo.get(0).name,             // Name or ID is required.
                                    "id", produitsDispo.get(0).sku,
                                    "price", produitsDispo.get(0).price,
                                    "brand", produitsDispo.get(0).brand,
                                    "category", produitsDispo.get(0).category,
                                    "variant", produitsDispo.get(0).variant,
                                    "list", produitsDispo.get(0).category,
                                    "position", 1),
                            DataLayer.mapOf(
                                    "name", produitsDispo.get(1).name,
                                    "id", produitsDispo.get(1).sku,
                                    "price", produitsDispo.get(1).price,
                                    "brand", produitsDispo.get(1).brand,
                                    "category", produitsDispo.get(1).category,
                                    "variant", produitsDispo.get(1).variant,
                                    "list", produitsDispo.get(1).category,
                                    "position", 2),
                            DataLayer.mapOf(
                                    "name", produitsDispo.get(2).name,
                                    "id", produitsDispo.get(2).sku,
                                    "price", produitsDispo.get(2).price,
                                    "brand", produitsDispo.get(2).brand,
                                    "category", produitsDispo.get(2).category,
                                    "variant", produitsDispo.get(2).variant,
                                    "list", produitsDispo.get(2).category,
                                    "position", 3)));

is now :

Bundle myBundle = new Bundle();
myBundle.putString("currencyCode", "EUR");
myBundle.putParcelableArrayList("impressions", constructBundleImpressions(produitsDispo));
mFirebaseAnalytics.logEvent("ecommerce", myBundle);

  public ArrayList<Bundle> constructBundleImpressions(ArrayList<Item> produitsDispo){
    ArrayList<Bundle> bundleImpressions = new ArrayList<Bundle>();
    Bundle tempBundle = new Bundle();
    for (int i=0; i<produitsDispo.size();i++){
        tempBundle.clear();
        tempBundle.putString("name", produitsDispo.get(i).name);
        Log.d("AAAAA ; ", produitsDispo.get(i).name);
        tempBundle.putString("id", produitsDispo.get(i).sku);
        tempBundle.putString("price", produitsDispo.get(i).price.toString());
        tempBundle.putString("brand", produitsDispo.get(i).brand);
        tempBundle.putString("category", produitsDispo.get(i).category);
        tempBundle.putString("variant", produitsDispo.get(i).variant);
        tempBundle.putString("list", produitsDispo.get(i).category);
        tempBundle.putInt("position", i+1);
        bundleImpressions.add(tempBundle);
    }

I have already configured my GTM container with value, trigger and tag but the hit does not appear on Google Analytics dashboard.

I think that issue occurs because Firebase doesn't not accept complex bundle for events so, even is it is correct, the bundle with an ArrayList is not interpreded by Firebase events logger.

What is your opinion about that ? Have you ever meet this kind of issue ?

like image 880
Francesco K. Avatar asked Oct 30 '22 21:10

Francesco K.


1 Answers

According to that page https://support.google.com/tagmanager/answer/7003315?hl=en

Ecommerce arrays: Support for ecommerce tags that require arrays of data (e.g. Google Analytics Enhanced Ecommerce) will be available at a later date.

And the release notes notify of no further progresses on the topic: https://support.google.com/tagmanager/answer/4620708?hl=en&ref_topic=6003219

like image 122
Benoît Pointet Avatar answered Nov 15 '22 05:11

Benoît Pointet