We currently have Google Analytics ecommerce tracking set up on our form thank-you pages. We're also using Optimizely to run A/B/n tests on our website. Optimizely's an online split-testing platform, that also has revenue tracking you can configure.
We'd like to get Optimizely revenue tracking up and running, but are limited with what the form can push out code-wise. I'm hoping to find a solution where we can pull the revenue data from the GA ecommerce snippet into the Optimizely snippet on the same page.
Here is the GA e-commerce snippet:
//Ecommerce Tracking Code
if (pageName == 'thankyou') {
//Pull apart and use pieces of the HTML Document.Title
//where proposed convention is :: Fund - eventName - eventVersion
//changes based on provided example:
var pageIdentity = document.title;
var parsePageName = pageIdentity.split(" - ");
var fundName = parsePageName[0];
var eventName = parsePageName[1];
var eventVersion = parsePageName[2];
var paymentType = "oneTimeCreditCard";
var donationAmount = "$5.00";
var constituentID = "13921362";
var eventID = gup('eventid')||gup('eid');
//handles ecommerce transaction variables populated for GA
amount = getPaymentAmount("#ctl00_ctl00_mainContent_bodyContentPlaceHolder_hidDonationAmount");
pageTracker2._addTrans(constituentID, "PaymentNew", amount,"","","","","");
pageTracker2._addItem(constituentID, eventID,fundName+"-"+eventName,paymentType,amount,"1");
pageTracker2._trackTrans();
} // if donatethankyou
and we're trying to pull the donationAmount variable (or equivalent) into the Optimizely snippet:
window.optimizely = window.optimizely || [];
window.optimizely.push(['trackEvent', 'eventName', {'revenue': valueInCents}]);
Is this possible with the current setup? My JS is (clearly) very rusty.
Thanks in advance!