Retrieve the Experience Name/Variant Using JavaScript
If you're looking to retrieve the experience name in your JavaScript code, you can easily access this information from our JavaScript snippets (either global JavaScript or custom component). This is useful, for example, if you want to pass the experience name to a tool like LogRocket for tracking.
Here’s how you can do it:
This object contains the metadata of the running experience:console.log(_USE_CASE_CTX)
-
Use
_USE_CASE_CTX._USE_CASE_GA
to return the experience name. -
Use
_USE_CASE_CTX._USE_CASE_GA_VARIANT
to return the variant name.
You can now pass this information to LogRocket or any other analytics tool you're using for further tracking.