Javascript not always firing for GTM tracking with DonationConfirmation event

Options
I have a couple donation forms, and for the confirmation tracking, I am using Google Tag Manager and some custom javascript to push the event & transaction data to GA. I'm using a slide modification of the script on this page (https://kb.blackbaud.com/articles/Article/66890) -- modified to get it to work with GTM instaed of GA. However, it would seem this "BLACKBAUD.netcommunity.api.DonationConfirmation.add" function does not always fire after a donation. It seems to always fire the first time that someone donates (I'm seeing the results in GA), but I'm not seeing the event or transaction data for repeat donors. 


Modification for GTM:

 

BLACKBAUD.netcommunity.api.DonationConfirmation.add(function (data) {
if (data.TransTotal) {

transProducts = [];
for (var i = 0; i < data.Items.length; i++) {
transProducts.push ({
'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
});
}

dataLayer.push({
'transactionId': data.TransID,
'transactionAffiliation': '',
'transactionTotal': data.TransTotal,
'transactionTax': '',
'transactionShipping': '',
'transactionProducts': transProducts,
'event' : 'DonationComplete'
});
}
});



Example forms:

https://giving.childrensmn.org/give

https://giving.childrensmn.org/givea5


Any ideas? Anyone else experiencing this?
Tagged:

Categories