Skip to content

Instantly share code, notes, and snippets.

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>
function initYTAPI() {
if (typeof(window.YT) == "undefined") {
vwo_$.getScript("https://www.youtube.com/iframe_api", function(data, textStatus, jqxhr) {
if (window.timerX) clearInterval(window.timerX);
window.timerX = setInterval(function() {
if (typeof(window.YT.Player) != "undefined") {
window.vwo_player = new YT.Player('vwo_YT', {
events: {
'onStateChange': onPlayerStateChange
}
<!-- Start VWO Async SmartCode -->
<link rel="preconnect" href="https://dev.visualwebsiteoptimizer.com" />
<script type='text/javascript' id='vwoCode'>
_vis_opt_url = document.location.protocol + '//' + document.location.hostname +
document.location.pathname + "?preview_theme_id=XXXXXXX&" +
document.location.search.substring(1, ) + document.location.hash; //Replace "XXXXXXX" with your Shopify Preview theme ID
window._vwo_code || (function() {
var account_id=XXXXX, //Replace XXXXX with your accountID
_vis_opt_url = window._vis_opt_url || document.URL,
version=2.0,
{% if first_time_accessed %}
<script>
{% assign _vis_opt_revenue = total_price | divided_by: 100.0 %}
// Do not change anything in the following two lines
window.VWO = window.VWO || [];
VWO.event = VWO.event || function () {VWO.push(["event"].concat([].slice.call(arguments)))};
VWO.event("purchase", {
"revenue": {{_vis_opt_revenue }},
});
</script>
{% if first_time_accessed %}
<script type="text/javascript">
window.VWO = window.VWO || [];
{% assign _vis_opt_revenue = subtotal_price | divided_by: 100.0 %}
window._vis_opt_queue = window._vis_opt_queue || []; window._vis_opt_queue.push(function() {_vis_opt_revenue_conversion('{{ _vis_opt_revenue }}',{allowMultipleConsversions: true});});
window.VWO.push(['track.revenueConversion','{{ _vis_opt_revenue }}']);
</script>
{% endif %}