#Custom Conversion Goal in Visual Website Optimizer (VWO)
How to add a Custom Conversion Goal (CCG) in VWO. Use this to be able to add a CCG for a specific test.
Replace goalId and testlId with your test specific values.
| // Get discount code in Eventbee widget | |
| var eventID = ''; //Set your event ID here | |
| //Function to get the code from the browser url | |
| function getParameterByName(name) | |
| { | |
| name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
| var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
| var regex = new RegExp(regexS); | |
| var results = regex.exec(window.location.search); |
| if (!vwo_$('#newUniqeIdentifier').length) { | |
| // Do your vwo_$ stuff here | |
| // vwo_$('<h1>Foo</h1>').replaceWith( '<h1 id="newUniqeIdentifier">Bar</h1>' ); | |
| } |
| $(document).ready(function() { | |
| /*#### | |
| Load in script only when a DOM element exists. | |
| Use callback function to run | |
| ####*/ | |
| Modernizr.addTest('foo', $('.bar').length > 0); | |
| Modernizr.load({ |
| /** | |
| * jQuery iframe click tracking plugin demo | |
| * Version 1.0 (2013-03-30) | |
| * Copyright © 2013 Vincent Paré | |
| * https://github.com/finalclap/iframeTracker-jquery | |
| */ | |
| (function($){ | |
| // Registering new tracking handler | |
| $.fn.iframeTracker = function(handler){ | |
| // Storing the new handler into handler list |
| if (typeof jQuery != 'undefined') { | |
| jQuery(document).ready(function($) { | |
| var filetypes = /\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|txt|rar|wma|mov|avi|wmv|flv|wav)$/i; | |
| var baseHref = ''; | |
| if (jQuery('base').attr('href') != undefined) baseHref = jQuery('base').attr('href'); | |
| jQuery('a').on('click', function(event) { | |
| var el = jQuery(this); | |
| var track = true; | |
| var href = (typeof(el.attr('href')) != 'undefined' ) ? el.attr('href') :""; |
| //Define your search query parameter as varible sn | |
| var sn = "q"; | |
| var sr = new RegExp(sn+"=[^\&]+"); | |
| p = document.location.pathname; | |
| s = document.location.search; | |
| if (!!s.match(sr)) { | |
| sm = s.match(sr).toString(); | |
| srs = sm.split("="); | |
| // The next line is where we add the category and add |
| var restify = require('restify'), | |
| mongoose = require('mongoose'); | |
| var server = restify.createServer({ | |
| name: 'mongo-api' | |
| }) | |
| server.listen(7000, function () { | |
| console.log('%s listening at %s', server.name, server.url) | |
| }) | |
| db = mongoose.connect("mongodb://localhost/example-api"); |
#Custom Conversion Goal in Visual Website Optimizer (VWO)
How to add a Custom Conversion Goal (CCG) in VWO. Use this to be able to add a CCG for a specific test.
Replace goalId and testlId with your test specific values.
| var startTime;function loadJs(url, callback) { var js = document.createElement('script'); js.async = true; js.src = url; var s = document.getElementsByTagName('script')[0]; js.onload = trackTimingCallback; startTime = new Date().getTime(); s.parentNode.insertBefore(js, s);}function trackTimingCallback(event) { var endTime = new Date().getTime(); var timeSpent = endTime - startTime; ga('send', 'timing', 'jQuery', 'Load Library', timeSpent, 'Google CDN'); // Library has loaded. Now you can use it.}; |