The LUX Getting Started guide has instructions for deploying the LUX snippet. This explains how to put lux.js in your pages in order to collect LUX data from your real traffic. 

Those instructions say to put the LUX snippet as early in the page as possible, i.e., at the top of the HEAD element. Some customers use tag managers and have asked if the LUX snippet can be deployed that way.

It's best _not_ to use a tag manager to deploy the LUX snippet to your site. The main reason is that this results in some of the data not being collected, especially the CPU Time data. In addition, entire pages are missed if users quickly leave the page before the LUX snippet is loaded. It also increases the probability of JavaScript errors if you use the LUX API before it's defined. 

Following the guidance in the LUX Getting Started guide solves these problems. Including the LUX snippet at the top of the page allows it to collect CPU Time data from the beginning, and means that even users that leave the page before onload are tracked. Finally, putting the LUX snippet at the top of HEAD gets the LUX API declared immediately so it can be used throughout the page even while lux.js is being loaded asynchronously.

Did this answer your question?