Setting Up eCommerce and Event Tracking

by Scott Dilley - CTO 07 May 2018

In addition to having advanced tracking capabilities via our own Custom Short Urls, each Funraisin powered site supports the ability to send through event and e-commerce data to platforms like Google Analytics and Facebook without requiring the need for developers to add bespoke code to individual pages. Currently we support the following e-commerce tracking methods:

  • GA (Google Analytics)
  • GTAG (Google Analytics as of April 2017)
  • GTM (Google Tag Manager)
  • Facebook
  • AutoPilot

It is also possible to implement custom tracking on most of your site’s pages however this article only covers our standard tracking feature.

Pixel and Event Based Tracking

This covers Google Analytics, Google Tag Manager and Facebook Pixel.

 

Step 1. Adding your tracking tags

Before we can send data to your other platforms you will need to upload your tracking tags to your platform. These can be uploaded via Platform Setup > Tracking and Analytics as the illustration below shows. Simply select which tracking tags you wish to add and paste in the code provided by each platform.

 

You can also add in other custom tracking tags using the “other tracking code” option and specifying where on the page you wish for the code to appear, e.g.,etc.

 

Step 2. Defining the e-commerce data method for Google Analytics

For Google tracking we support GA, GTAG and GTM tags, so in order for us to send through the correct data you will need to tell us which method to use. Note that as of April 2017 Google will provide you with GTAG tracking tags by default however we do support the older GA tracking.

If you aren’t sure which method is best for your site please feel free to ask us for assistance.

Defining your tracking method can be done from Platform Setup > Tracking and Analytics > Event and E-commerce Tracking as shown below.

 

Step 3. Standard E-commerce & Event Data

Once your tracking tags have been added to your site we will start to send through the following e-commerce and event data to the tracking method chosen for Google and to the Facebook Pixel. This data will be sent if the tag has been set up in Platform Setup > Tracking and Analytics 

For help with setting up your tracking within Google see this article.

Step 3. Standard E-commerce & Event Data

Once your tracking tags have been added to your site we will start to send through the following e-commerce and event data to the tracking method chosen for Google and to the Facebook Pixel. This data will be sent if the tag has been set up in Platform Setup > Tracking and Analytics 

For help with setting up your tracking within Google see this article.


Google Tag Manager data layer

Sponsored Donations

Sponsored donations are ones made from someone’s fundraising page.

// Create Pageview
dataLayer.push({
    ‘event’: ‘VirtualPageview’,
    ‘virtualPageURL’: ‘/sponsor/confirmation/{tax_ref}
});

// E-commerce data
dataLayer = [{
    ‘ecommerce’: {
    ‘currencyCode’:platform_currency,
    ‘purchase’ : {
       ‘actionField’: {
          ‘id’: donation_id,
          ‘revenue’: d_amount,
          ‘type’: donation_type // ‘online’, ‘recurring’, or ‘personal’
          ‘payment_method’:payment_method,
          ‘po_number’: po_number,
          ‘tax_ref’: tax_ref
       },
       ‘products’: [{
          ‘name’: ‘member’, team’, or ‘organisation’,
          ‘id’: online event's event_code or DIY's category_name,
          ‘price’: d_amount,
          ‘category’: ‘Personal Donation’ or ‘Sponsored Donation’,
          ‘quantity’: 1,
       }]
    }
}
}];

// event
dataLayer.push({
    ‘event’: ‘donation’
    ‘eventMeta’: ‘Personal Donation’ or ‘Sponsored Donation’,
    ‘eventCode’: online event's event_code or DIY's category_name,
});

Non-Sponsored Donations (Generic Donations)

Non-Sponsored donations are donations made to a generic donation / crowdfunding page.

// e-commerce
dataLayer = [{
 ‘ecommerce’: {
 ‘currencyCode’: platform_currency,
 ‘purchase’ : {
    ‘actionField’: {
       ‘id’: donation_id,
       ‘revenue’: d_amount,
       ‘payment_method’: payment_method,
       ‘po_number’: po_number,
       ‘frequency’: Weekly’,‘Monthly’, ‘Yearly’, or ‘one-off’,
       ‘type’: donation_type // online, or recurring

    },
    ‘products’: [{
       ‘name’: page_name,
       ‘id’: event_page_id or page_id,
       ‘price’: ‘d_amount’,
       ‘category’:Donation,
       ‘quantity’: 1,
      
}]
    }
}
}];

// event
dataLayer.push({
‘event’: ‘donation-success’,
‘eventMeta’: ‘Donation’
});

Online Event Registrations

On the registration completion lightbox:

// e-commerce data
dataLayer = [{
  ‘ecommerce’: {
  ‘currencyCode’:platform_currency,
  ‘purchase’ : {
  ‘actionField’: {
     ‘id’: ‘history_id’,
     ‘revenue’: ‘total_paid’,
     ‘po_number’: po_number,
     ‘payment_method’: payment_method,
     ‘tax_ref’: ‘tax_ref’,
     ‘hashed_email’: hash(m_email),

  },
‘products’: [{
    ‘name’: event_name,
    ‘id’: event_code,
    ‘price’: total_paid_entry,
    ‘category’: ‘Registration’,
    ‘quantity’:`1`,
    ‘brand’: event_code
    
 }
 // optional donation
 ,{
    ‘name’: event_name,
    ‘id’: event_code,
    ‘price’: m_donation_amount,
    ‘category’: ‘Personal Donation’,
    ‘quantity’:`1`,
    ‘brand’: event_code

    }
// optional merchandise
,{
    ‘name’: event_name,
    ‘id’: event_code,
    ‘price’: total_paid_merchandise,
    ‘category’: ‘Merchandise’,
    ‘quantity’:`1`,
    ‘brand’: event_code

    }

]}}}];

// Event
dataLayer.push({
    ‘event’: ‘registration’,
    ‘eventMeta’: ‘Event Registration’,
   
‘eventCode’:event_code,
});

// optional donation
dataLayer.push({
    ‘event’: ‘donation’,
    ‘eventMeta’: ‘Personal Donation’,
   
‘eventCode’: event_code,
});

If you’d like further help please pop in a support ticket from your Funraisin admin and our team will assist you.