Skip to content

Instantly share code, notes, and snippets.

function convertToDefaultCurrency(amount, fromCurrency, precision = 2) {
/**
* Your array of currencies and their conversion rates relative to the default currency
* Example: If USD is your store currency or the one in which you want to track revenue and
* 1 USD = 0.8 GBP then the entry in the array will be "GBP": 0.8
**/
var currencyConversion = {
"USD": 1,// Always keep the default store currency in the array and keep the value as 1
"EUR": 1.1,
"GBP": 0.82,
vwo.addShopifyMiddleware((payload) => {
let newPayload = payload;
if(payload.name == "shopify.productViewed"){
newPayload.name = "newShopifyEventName" ;
}
return newPayload;
});
vwo.addShopifyMiddleware((payload) => {
let newPayload = payload;
// customCode logic here
return newPayload;
});
payload = {
name: “shopify eventName” // mandatory field
props: {
// properties to be shown in VWO’s Events
}
}
override fun onVWOIntegrationCompleted(integrations: List<Integrations>) {
        for (integration in integrations) {
            val url = VWOInsights.getSessionURL(integration)
            if (url == null) {
                VWOLog.e(
                    VWOLog.DEBUG_LOGS,
                    "Session URL could not be generated - VWO Insights is not initialized. Please ensure that VWO Insights is properly initialized before attempting to generate the session URL. Refer to the documentation for initialization instructions.",
                    checkLoggable = false,
                    sendToServer = true
                )
func onVWOIntegrationCompleted(integrations: [IntegrationsList]) {
            for integration in integrations {
                let VWOSessionURL = VWO.getSessionURL(source: integration)
                if(VWOSessionURL == nil){
                    print("Session URL could not be generated - VWO Insights is not initialized. Please ensure that VWO Insights is properly initialized before attempting to generate the session URL. Refer to the documentation for initialization instructions.")
                    return
                }
                switch integration {
                    case IntegrationsList.CRASHLYTICS :
                        let crashlyticsReference = Crashlytics.crashlytics()
<script>
(function () {
function convertToDefaultCurrency(amount, fromCurrency, precision = 2) {
var defaultCurrency = "USD";
var currencyConversion = {
"USD": 1, // Always keep the default store currency in the array
"EUR": 1.1, // Euro
"GBP": 0.82, // Great British Pound
"AUD": 1.43, // Australian Dollar
function convertToDefaultCurrency(amount, fromCurrency, precision = 2) {
// For reference. Change USD to your default store currency
var defaultCurrency = "USD";
/**
* Your array of currencies and their conversion rates relative to the default currency
* Example: If USD is your store currency or the one in which you want to track revenue and
* 1 USD = 0.8 GBP then the entry in the array will be "GBP": 0.8
**/
var currencyConversion = {
<script type="text/javascript">
window._vis_opt_queue = window._vis_opt_queue || [];
window._vis_opt_queue.push(function() {
_vis_opt_revenue_conversion({order_total}, {allowMultipleConversions: true});
});
</script>
<script type = "text/javascript" >
window._vis_opt_queue = window._vis_opt_queue || [];
window._vis_opt_queue.push(function() {
_vis_opt_revenue_conversion(%%ORDER_AMOUNT%%, {allowMultipleConversions: true});
});
window.VWO = window.VWO || [];
window.VWO.push(['track.revenueConversion', %%ORDER_AMOUNT%%]);
</script>