1. Configure site tracking for Google Analytics...
  • a. Login to your NetCommunity website and go to Administration > Sites & settings.
  • b. Select the site to configure and then select the Settings tab.
  • c. Under Site Tracking, select Enable Site Tracking.
  • d. In the Site Tracking area, enter the script provided by Google Analytics when you created your website profile with them. You can get this under Admin > Tracking Info > Tracking Code.
Example: Note the highlighted
"BBNCAnalyticsURL"
. This MUST be added after the other arguments. Also note that the argument "ga('require', 'ecommerce');" will need to be added if you want to track conversions.
 
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    
    ga('create', 'UA-XXXXXXXX-X', 'auto');
    ga('send', 'pageview', BBNCAnalyticsURL);
    ga('require', 'ecommerce');
</script>

2. Configure E-Commerce (in Google Analytics)...
  • a. Login to Google Analytics and select your website's profile.
  • b. Click on the Admin button at the top, right-hand corner of the page.
  • c. Under the View section, click on View Settings > Ecommerce Settings and turn Ecommerce tracking on.
  • d. Click Save to save your settings.

3. Edit the page that has a donation form on it and add the following code inside an Unformatted Text part. While editing the Unformatted Text part, select Show Advanced Options and choose at the end of the <body> tag from the drop down menu.
 
<script type="text/javascript">
    BLACKBAUD.netcommunity.api.DonationConfirmation.add(function (data) {
        if (data.TransTotal) {
            ga('ecommerce:addTransaction', {
                'id': data.TransID,
                'affiliation': '',
                'revenue': data.TransTotal,
                'shipping': '',
                'tax': ''
            });
            for (var i = 0; i < data.Items.length; i++) {
                ga('ecommerce:addItem', {
                    'id': data.Items[i].ID,
                    'name': data.Items[i].Name,
                    'sku': data.Items[i].SKU,
                    'category': data.Items[i].Name,
                    'price': data.Items[i].Price,
                    'quantity': data.Items[i].Quantity
                });
            }
            ga('ecommerce:send');
            ga('ecommerce:clear');
        }
    });
</script>
 
This script will track the following data associated with successfully submitted donations:
 

Data ID in Google Analytics

Description of Data Type

data.TransTotal

Total dollar amount for the transaction.

data.TransID

Identifies the transaction.

data.Items

Items included in the transaction. If the transaction contains multiple items (for example, a transaction from a Payment 2.0 part may include several purchased items), the items are identified as data.Item[0], data.Item[1], data.Item[2], etc.

data.Items.ID:

Associates an item with a transaction. This is the same value as the TransID.

data.Items.SKU

Unique SKU used to track the price and quantity of an item.

data.Items.Name

Human readable name for an item.

data.Items.Price

Price of an item.

data.Items.Quantity

Number of items purchased of the same type.



4. Configure goals in Google Analytics...
You can use goals in Google Analytics to track conversions on your website. In this example, you'll be creating a goal to track the number of donations made on a particular donation page.
  • a. Login to Google Analytics and select your website's profile.
  • b. Click on the Admin button at the top, right-hand corner of the page.
  • c. Under the View section, click on Goals and then click on CREATE A GOAL.
  • d. Select a template to start with a pre-filled configuration and click the Next step button.
  • e. Enter a Goal description
  • f. For Type, mark the Destination radio button
  • g. Click Continue
  • h. Under the Goal details area, select Regular Expression under Destination.
  • i. Enter "DonationStep_[PART ID]=DonationStep_Acknowledgement" in the field next to it. You will replace [PART ID] with the actual ID of your donation form part, which can be found in the URL bar (address bar) of your web browser when editing the part (see illustration below).
  • j. Select any additional options and then click Save Goal to save your settings.



Additional Notes:

Goals can be setup for other purposes, not just donations. For more information about how URL's are built for different part types, see Site Tracking URL Examples.

You can create as many goals as you like in Google Analytics but you'll need to make sure you add the above piece of JavaScript into an Unformatted Text part on any page that includes one of these part types:
  • Donation Form
  • Membership Form
  • Event Registration Form
  • Payment 2.0.
The script you entered in the Unformatted Text part sends tracking information to Google Analytics about transactions made on those pages.