Skip to content

Instantly share code, notes, and snippets.

@mariusbolik
Last active February 18, 2025 13:10
Show Gist options
  • Select an option

  • Save mariusbolik/aa02177f4c95ccdf8b65de562146af73 to your computer and use it in GitHub Desktop.

Select an option

Save mariusbolik/aa02177f4c95ccdf8b65de562146af73 to your computer and use it in GitHub Desktop.
mySHOEFITTER x Empress of Heels
<!-- Load the mySHOEFITTER Script -->
<script src="https://js.myshoefitter.com/v1/script.js"></script>
<!-- Initialize mySHOEFITTER -->
<script type="application/javascript">
myshoefitter.events(event => {
console.log('mySHOEFITTER Event', event);
if (event.type === 'RESULT') {
// Work with the result - e.g. preselect size in shop
console.log('mySHOEFITTER Shoe Size', event.data.result);
}
if (event.type === 'BUTTON' && event.data && event.data.action === 'click') {
// Send click event to google tag manager
if (typeof hj === 'function') {
hj('event', 'myshoefitter_button_click');
console.log('mySHOEFITTER button click event sent to Google Analytics.');
} else {
console.error('gtag function is not defined.');
}
// Log the event to the console (for debugging purposes)
console.log('Shopify button click event sent to Google Analytics.');
}
});
myshoefitter.init({
shopSystem: 'shopify',
button: {
attachTo: ".product-form__input--dropdown",
position: "after", // before
text: "Find your size",
styles: {
border: "2px solid var(--primary_button_background_gradient)",
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment