Header
Home > Sites > Ecommerce events sent to the GTM dataLayer by BetterNow

Ecommerce events sent to the GTM dataLayer by BetterNow

This is the ecommerce events sent to the GTM dataLayer by BetterNow. This can be used to track donation completion rates and funnels.

Viewing a project page:

dataLayer.push({

  "event": "EEcommerce",

  "ecommerceCategory": "ecommerce",

  "ecommerceAction": "productDetail",

  "ecommerce": {

    "detail": {

      "products": [{

        "name": "#{project.name}",

        "id": "#{project.id}",

        "brand": "#{project.charity.name}",

        "category": "project"

      }]

    }

  }

});

Viewing the list of fundraisers:
 

dataLayer.push({

  "event": "EEcommerce",

  "ecommerceCategory": "ecommerce",

  "ecommerceAction": "productList",

  "ecommerce": {

    "currencyCode": "#{ site.currency_code}",

    "impressions": “#{impressions}”

  }

});

Viewing a specific fundraiser:

dataLayer.push({

  "event": "EEcommerce",

  "ecommerceCategory": "ecommerce",

  "ecommerceAction": "productDetail",

  "ecommerce": {

    "detail": {

      "products": [{

        "name": "#{fundraiser.name}",

        "id": "#{fundraiser.id}",

        "brand": "#{fundraiser.charity.name}",

        "category": "fundraiser"

      }]

    }

  }

 });

After a donation has been successfully completed:

dataLayer.push({

  "event": "EEcommerce",

  "ecommerceCategory": "ecommerce",

  "ecommerceAction": "purchase",

  "ecommerce": {

    "currencyCode": "#{donation.currency_code}",

    "purchase": {

      "actionField": {

        "id": "#{donation.id}",

        "affiliation": "#{site.hostname}",

        "revenue": "#{donation.amount}"

      },

      "products": [{

        "name": "#{donation.fundraiser.name}",

        "id": "#{donation.fundraiser.id}",

        "brand": "#{donation.fundraiser.charity.name}",

        "category": "#{donation.fundraiser.is_general? ? "project" : "fundraiser"}",

        "quantity": 1,

        "price": "#{donation.amount",

        "variant": "#{donation.donor_type}"

      }]

    }

  }

});


 

 

Footer