Hosting the Lytics JavaScript Tag
While it's possible to download and examine the core Lytics JavaScript Tag (JS Tag) source files (latest.js
, latest.min.js
or lio.js
), storing or serving these file(s) locally or from another domain is not recommended. Referencing the Lytics JS Tag files from Lytics' servers (i.e., https://c.lytics.io/api/tag/someid/latest.js
) ensures that you get access to new features and product updates as they become available, giving you the most reliable collection and delivery of your data.
That said, in some extreme cases it may be a requirement to serve all JavaScript files from your own secure environment. In these cases, we've created this document to outline the benefits, drawbacks, and a suggested approach.
What are the benefits?
- Compliance with rigid security requirements.
What are the drawbacks?
- Voids previously agreed upon Service-level agreements (SLAs) and support agreements due to the introduction of new and non-Lytics controlled infrastructure.
- Feature enhancements and bug fixes are made frequently to the Lytics JS Tag. Those that host their tag outside of Lytics will need to manually update the source to benefit from said improvements.
- Leveraging client-side integrations will require manual configuration while having limited support from the Lytics team.
- Additional Services hours or agreement to assist with initial installation and setup issues.
- Many account settings will no longer function as designed since configurations are not able to be updated dynamically.
- The core Lytics JS Tag endpoint has various levels of caching and protections to ensure it is always served no matter load or conditions. By hosting outside of the Lytics architecture, all caching and scalability concerns must be managed by the customer.
Given these benefits and drawbacks, if your organization still wants to proceed with hosting the Lytics JS Tag, see the following steps to get started.
Where should I start?
Before you begin, ensure you are installing version 3 of the Lytics JS Tag. Version 2 can't be hosted outside of Lytics, which means you will be restricted to version 3 of the tag.
Getting up and running with a hosted version of the Lytics JS Tag comes down to three main steps:
Accessing the source code and default configuration. Navigating to the source code is relatively simple. The URL can be found by visiting the Tag Installation section of the Lytics app. The tag sample on that page will include a
jstag.init
function. One line below that you will see asrc
definition and a URL that looks something like//c.lytics.io/api/tag/...
. Copying and pasting that URL into a new browser window will result in the core JavaScript tag to be loaded. Most browsers will allow you to File -> Save the source from this point to your local machine.Hosting the source code and default configuration. The output file that was created above will need to be hosted on a public server within your infrastructure. Unfortunately, there is little to no guidance Lytics can offer here other than to be sure the hosting solution can handle the necessary load generated by your web asset(s).
Initializing the tag. Return to the Tag Installation section and copy and paste the entire script tag as you normally would. The
src
URL in theinit
config will need to be updated with the URL of your now hosted JavaScript tag. You'll likely end up with something like this:jstag.init({ src: '//mycompany.com/assets/tag/lytics.latest.min.js' });
Once your tag has been hosted and initialized properly, we recommend you complete the verification steps to ensure everything has been installed and is working properly.