What is JavaScript used for?
JavaScript (JS) is used for event tracking in real-time. Google defines an event as "user interactions with content that can be tracked independently from a web page or a screen load."
By implementing our JS snippets on your webpages, you are able to track several standard events, as well as custom (user-defined) events on your webpages. These JS snippets should be inserted before the closing </head>
tag of each page in which you are tracking an event.
How does Cortex use JavaScript tracking?
Retention Science's event tracking serves as the "food" for our AI models, enabling us to learn how users are engaging with your website and what types of campaigns/recommendations/subject lines will work best for them.
Whether you are using Shopify, Magento, or custom HTML scripts, this guide will help you understand our JavaScript event tracking and key details. (You can also watch our YouTube videos for similar explanations of data, JS, and other topics)
How do JS waves get implemented?
Shopify clients
- Shopify JS is handled via these instructions, and can be set up in a few minutes
- The only time a Shopify client has to do anything additional is when customizations are made to the site outside of Shopify
- e.g. Search Bar is added via third-party plugin, and you want to make sure every search term is passed to RS for analysis and Search Abandon Campaign follow-ups
- e.g. form needs email capture via JS or Import API
Magento clients
- JS setup is even more automated and part of the Magento extension setup steps.
- Also similar to Shopify in the sense that additional effort is only needed in certain cases, e.g.:
- Your Magento is using an AJAX Cart system that is not part of the standard extension support, so one script has to be added to "Add to Cart" buttons
Custom clients
- Your tech stack will dictate how our JS should be implemented:
- You may use Google Tag Manager to trigger our JS events if you can access the necessary key datapoints via data layer
- If you have a Single-Page Application (e.g. Angular), you might want to create a new class for RS functionality
- You can also add it under a
<script>
tag
- The goal is to read through our JS documentation and determine how you should implement our pixel code; Your onboarding engineer/technical project manager will assist you in QAing your code.
How does ReSci prioritize site performance?
Our JavaScript optimizes for your website performance by utilizing:
- Asynchronous script loading to ensure the script does not interfere with page loading or affect site speed.
- Content Delivery Network (CDN) hosting to ensure low latency and high data transfer speeds.
- Code encapsulation is an anonymous function so it does not interfere with any external JavaScript Variables.
Helpful resources:
- How to Troubleshoot JavaScript
- JavaScript setup for Shopify
- Optional AJAX JavaScript setup for Shopify
- User interaction events 101
- Regular page view JavaScript event
- Item page view JavaScript event
- Add to cart JavaScript event
- Shopping cart view JavaScript event
- Checkout success JavaScript event
- Checkout success with order data JavaScript event
- Search JavaScript event
- Email capture JavaScript event
- Custom JavaScript event
- Common parameters
- Reserved action names
- Adding JavaScript email capture snippet to WordPress
Comments
0 comments
Please sign in to leave a comment.