segmentio/analytics.js-integrations — pull request #363 by pnorthup-extole (2014-08-01 23:18:32+00:00)
Title: Extole integration added, tested, cleaned up.

I'm hoping you can add this integration with Extole. Extole provides clients with a referral marketing widget and the backend processing of those referrals. The integration does the following:

1- injects Extole's library, if it hasn't been injected on to the page beforehand,
2- on a "Completed Order" event, creates a "conversion" tag for Extole's library to use, and fires an event to handle it, unless the client has set up a conversionEvents mapping because they don't want to use "Completed Order", in which case
3- if the client has a conversionEvents mapping set up--which I imagine would be configurable in the Segment UI, similar to how AdRoll has an event mapping; I've attached a mockup below--then all and only those events listed in the conversionEvents object will result in conversions. The conversionEvents object gets generated by the Segment Integrations UI and passed as an option to the integration should be structured as follows:
options.conversionEvents = {
event_name : {
'e' : [property that maps to email in track.properties(), e.g. 'email' for track.properties()['email']],
'partner_conversion_id' : [property that maps to whatever their unique ID for the transaction is in track.properties()],
'tag:cart_value' : [property that maps to conversion value in track.properties()],
'[other variable name as they want it recorded in extole]' : [property that maps to it in track.properties()]
},
other_conversion_event_name : {
[same pattern]
}
}

where the 'e' and 'partner_conversion_id' key:value pairs are mandatory, 'tag:cart_value' is presumably usually going to be there, and there can be as many other optional ones as they want.

That's basically it. It passes the test suite I wrote, and works to generate conversions on the test Extole account I created for it. Let me know if you need anything further, or if there are any problems!

best,
Peter

![segment-extole-mockup](https://cloud.githubusercontent.com/assets/6911773/3786059/50aeb446-19cf-11e4-82b4-155f8aaae6e7.png)