dreagan
dreagan

Reputation: 2446

tracking pixel asynchornous or synchronous

I want to start using Google Tag Manager for all tags on websites, but I just read that it doesn't support synchronous tags.

I'm not entirely sure if tracking pixel, image tags that have an external js as source, are in that category or not. I'm not sure if tracking pixels are blocking or not.

Can someone please clarify why tracking pixels are or aren't synchronous?

Upvotes: 0

Views: 3319

Answers (1)

Avi
Avi

Reputation: 2383

tl;dr: You should be able to include most of the tags that you want to include in GTM[1]. The text in GTM refers to how it loads the tags and it does so asynchronously. Since most of the tracking pixels are already asynchronous, you should be fine.

[1]: There might be a slight data loss for cases where a user comes to your sight and immediately leave before the JavaScript could load. For most modern internet connections, this should not happen unless user really came to the website by mistake and pressed back button immediately.


Long Answer:

Synchronous or Asynchronous behavior of a script in web world means how the script is loaded. The pros and cons of the two methods are:

Sync:

  • Guarantees that the script will load before the the whole page is loaded.
  • Also means that the JavaScript that is loaded synchronously will have to be loaded before anything can be done.
  • Usually makes the page slower and results in partially rendered pages.
  • Should mostly be done when you definitely need the javascript to be loaded before execution can continue.

Async:

  • Is usually faster in terms of user response (pages feel faster at load time)
  • The js is loaded later and hence the subsequent code can't assume that the script is loaded.
  • also prevents your site from breaking if the third party server is down or broken.

Upvotes: 1

Related Questions