Assigning a javascript variable output to a liquid variable

Tudor15
Visitor
1 0 0

Hello!

 

Is there a way to access a javascript variable through liquid?

 

On the site I am working on, there is a featured collection in the homepage. This featured collection is changing from time to time. I want to track this collection, even if it's changing and I don't know what collection will be next.

 

I am able to track this changing from DOM, by using a javascript variable. I need to assign the output of this javascript variable to a liquid variable.  

 

The output of the javascript variable tells me what the current featured collection is, and if the collection changes, the variable tells me what is the name of the updated collection. 

 

I could use the output of this variable to tell the liquid code, that extracts collection data from the site collections, which collection is the current one, and pull data from that collection.  This data will be then pushed to dataLayer. 

 

Is there is a solution to this situation?

Replies 0 (0)