SA5 Data BETA Kit

Add CMS Data to your Custom Code

BETA Announcement

12-Aug-2023 announcement - https://sygnal-attr.discourse.group/t/video-want-to-access-your-collection-data-in-script-join-the-sa5-data-beta/103

Useful Materials

// Demo code
window.sa5 = window.sa5 || [];
window.sa5.push(['datastoreLoaded', 
  (ds) => {
    
    console.log("DATASTORE LOADED", ds.store['listings'].data); 
    
    // Initialize total
    let total = 0;
    let items = ds.store['listings'].data;

    // Iterate through the map and sum the price field
    items.forEach(item => {
        total += parseFloat(item.price);
    });

    console.log(total);    

    const element = document.getElementById('portfolio-value');
    if (element) {
        const formatter = new Intl.NumberFormat('en-US', {
            style: 'currency',
            currency: 'USD',
            minimumFractionDigits: 0,
            maximumFractionDigits: 0          
        });
        element.innerText = formatter.format(total);
    }
    
  }]); 

Last updated