About Convertize

Account

Technical Info

Installing Convertize

Billing

Using Convertize

Installing Convertize with:

How to run Convertize pixel asynchronously

As explained in another article, the Convertize pixel is synchronous to avoid a flickering effect when loading the web page.

However, Convertize does allow the user to change the pixel from synchronous to asynchronous.

Loading the pixel asynchronously

To allow the page to load at the same time as the Convertize pixel, you must add the attribute “async” in the pixel between “.js” and “></script>” leaving a white space before “async” as shown below in “Example #2: asynchronous pixel”.

Loading the pixel after the page has loaded

Sometimes you may need to wait for the complete page to load before fetching the Convertize pixel. Both the original code and the asynchronous method mentioned previously will hide the page content as soon as the pixel is retrieved to apply your experiments, then show the content when the page is fully loaded.

If you have many JavaScript and CSS files being loaded, there could be a delay before content is shown. To avoid this delay, you can use the long version of the pixel as shown below in “Example #3: long version asynchronous pixel (modified by the user)”.

However, please note with this method the user is likely to see the original content briefly before the Convertize is applied.

Examples

Example #1: synchronous pixel (given by Convertize)
<script src="//pixel.convertize.io/1177.js"></script>

Example #2: asynchronous pixel (modified by the user)
<script src="//pixel.convertize.io/1177.js" async></script>

Example #3: long version asynchronous pixel (modified by the user)

<script>
//<![CDATA[
(function() {
function asyncLoad() {
var urls = ["\/\/pixel.convertize.io\/1177.js"];
for (var i = 0; i < urls.length; i++) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = urls[i];
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
}
window.attachEvent ? window.attachEvent('onload', asyncLoad) :  window.addEventListener('load', asyncLoad, false);
})();
//]]>
</script>

If you want to use any of these examples, copy and paste the script given in this article but do not forget to change the number “1177” used in the examples. You should replace it with your personal project number found in the pixel code given to each of your projects.

Browser support

The first browser versions that fully support the attribute are Firefox 3.6, Internet Explorer 10.0, and all versions of Google Chrome, Safari, and Opera.