v0.1

MarketingJSON
#70 - Ocultar elementos CMS antiguos/vistos
Mostrar sólo los elementos CMS que son nuevos para un miembro en particular. Si ya lo han visto, ocultarlo.
Añada este atributo a cualquier botón/elemento que desee que active una actualización JSON tras un breve retardo.
Watch the video for step-by-step implementation instructions
<!-- 💙 MEMBERSCRIPT #4 v0.1 💙 UPDATE MEMBER JSON IN LOCAL STORAGE ON BUTTON CLICK -->
<script>
document.addEventListener("DOMContentLoaded", function() {
const updateButtons = document.querySelectorAll('[ms-code-update="json"]');
updateButtons.forEach(button => {
button.addEventListener("click", async function() {
const memberstack = window.$memberstackDom;
// Add a delay
await new Promise(resolve => setTimeout(resolve, 500));
// Retrieve the current member JSON data
const member = await memberstack.getMemberJSON();
// Save the member JSON as a local storage item
localStorage.setItem("memberJSON", JSON.stringify(member));
});
});
});
</script>More scripts in JSON