Created
December 2, 2011 15:02
-
-
Save yahelc/1423548 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (window.BSDTracker) { | |
var type = (BSDTracker.signup) ? "signup" : (BSDTracker.contribution) ? "contribution" : false; | |
if (type) { | |
var tracker = BSDTracker[type]; | |
var form = tracker.safeGet('formname', ""); | |
var amount = tracker.safeGet('transaction_amt', 0); | |
_gaq.push(['_trackEvent', 'Completions', tracker.getModuleName(), form, Math.ceil(amount)]); | |
if (amount) { | |
var order_id = tracker.safeGet("contribution_key", ""); | |
var sku_end = $.inArray(amount, tracker.safeGet("pageamounts", [])) !== -1 ? Math.round(amount) : "other"; | |
var sku = tracker.safeGet("contribution_page_id", "") + "_" + sku_end; | |
var pagetype = +tracker.safeGet("pagetype", 1); | |
var category = (+tracker.safeGet("is_recurring", false)) ? "BSD Recurring" : "BSD"; | |
category += pagetype === 4 ? " Memberships" : pagetype === 2 ? " Tickets" : pagetype === 3 ? " Custom Contributions" : " Contributions"; | |
_gaq.push(['_addTrans', order_id, "", amount, '0', '0', "", "", ""], ['_addItem', order_id, sku, form, category, amount, '1'], ['_trackTrans']); | |
optimizely.push(["trackEvent", "ga_integration", amount * 100]); // automatic optimizely revenue tracking. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment