Zum Inhalt springen
Jetzt starten

Asynchronous tracking code for top Google rankings

Tips & Tricks
1 min Lesezeit
Inhalt
Asynchronous tracking code for top Google rankings

von Katrin Nebermann

Asynchronous tracking code for top Google rankings

In order for etracker analytics to collect data, the etracker code first initiates the loading of another script. This process can be synchronous or asynchronous. In synchronous mode, the actual content of the page is only loaded after the etracker code has been executed. In asynchronous mode, however, scripts can be executed simultaneously. This means that tracking has no influence on the loading speed of website content and other scripts. The result: top Core Web Vitals values and excellent Google rankings.

Whether the asynchronous code is integrated can be seen from the parameter marked in the following example:

The asynchronous code can be found in all etracker accounts under Account Info → Settings → Setup/Tracking Code.

If you currently have the older synchronous tracking code included, you can simply adapt it by replacing src=”//static.etracker.com/code/e.js” with src=”//code.etracker.com/code/e.js” and adding the async keyword.

Attention: If you use asynchronous code retrieval and eCommerce events, timing problems may occur. This can result in the eCommerce events not being transmitted successfully. To ensure that the etracker code has already been loaded before the eCommerce events are sent, the eCommerce API should be called in the following function:

<script>
function _etrackerOnReady() {
  etCommerce.sendEvent('viewProduct', { /* product /* } );
}
</script>

Or in this function, if several events are to be sent at different points in the code:

<script>
var _etrackerOnReady = [];
_etrackerOnReady.push(function() {
  etCommerce.sendEvent('viewProduct', { /* product1 /* });
});
</script>
...
<script>
_etrackerOnReady.push(function() {
  etCommerce.sendEvent('viewProduct', { /* product2 /* });
});
</script>
Mehr zum Thema