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.

Revisions

  1. mariusbolik revised this gist Feb 18, 2025. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions empressofheels.html
    Original file line number Diff line number Diff line change
    @@ -8,11 +8,11 @@
    if (event.type === 'RESULT') {
    // Work with the result - e.g. preselect size in shop
    if (typeof hj === 'function' && 'result' in event.data) {
    hj('event', 'myshoefitter_result', {
    const hjRes = hj('event', 'myshoefitter_result', {
    size: event.data.result,
    product: document.title
    });
    console.log('mySHOEFITTER button click event sent to Hotjar.');
    console.log('mySHOEFITTER button click event sent to Hotjar:', hjRes);
    } else {
    console.error('hj function is not defined.');
    }
    @@ -22,10 +22,11 @@
    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', {
    const hjClick = hj('event', 'myshoefitter_button_click', {
    size: event.data.result,
    product: document.title
    });
    console.log('mySHOEFITTER button click event sent to Hotjar.');
    console.log('mySHOEFITTER button click event sent to Hotjar:', hjClick);
    } else {
    console.error('hj function is not defined.');
    }
  2. mariusbolik revised this gist Feb 18, 2025. 1 changed file with 15 additions and 4 deletions.
    19 changes: 15 additions & 4 deletions empressofheels.html
    Original file line number Diff line number Diff line change
    @@ -7,19 +7,30 @@
    console.log('mySHOEFITTER Event', event);
    if (event.type === 'RESULT') {
    // Work with the result - e.g. preselect size in shop
    if (typeof hj === 'function' && 'result' in event.data) {
    hj('event', 'myshoefitter_result', {
    size: event.data.result,
    product: document.title
    });
    console.log('mySHOEFITTER button click event sent to Hotjar.');
    } else {
    console.error('hj function is not defined.');
    }
    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.');
    hj('event', 'myshoefitter_button_click', {
    product: document.title
    });
    console.log('mySHOEFITTER button click event sent to Hotjar.');
    } else {
    console.error('gtag function is not defined.');
    console.error('hj function is not defined.');
    }
    // Log the event to the console (for debugging purposes)
    console.log('Shopify button click event sent to Google Analytics.');
    console.log('Shopify button click event sent to Hotjar.');
    }
    });
    myshoefitter.init({
  3. mariusbolik revised this gist Feb 18, 2025. 1 changed file with 2 additions and 6 deletions.
    8 changes: 2 additions & 6 deletions empressofheels.html
    Original file line number Diff line number Diff line change
    @@ -12,12 +12,8 @@

    if (event.type === 'BUTTON' && event.data && event.data.action === 'click') {
    // Send click event to google tag manager
    if (typeof gtag === 'function') {
    gtag('event', 'click', {
    event_category: 'mySHOEFITTER', // Group or category for the event
    event_label: 'mySHOEFITTER Button', // Label to identify the event
    value: 1 // Optional numeric value associated with the event
    });
    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.');
  4. mariusbolik revised this gist Feb 17, 2025. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions empressofheels.html
    Original file line number Diff line number Diff line change
    @@ -29,9 +29,12 @@
    myshoefitter.init({
    shopSystem: 'shopify',
    button: {
    attachTo: ".product-form__input--dropdown",
    position: "after", // before
    text: "Find your size",
    styles: {
    border: '2px solid var(--secondary_button_background_gradient)',
    border: "2px solid var(--primary_button_background_gradient)",
    }
    }
    });
    });
    </script>
  5. mariusbolik revised this gist Feb 17, 2025. 1 changed file with 23 additions and 0 deletions.
    23 changes: 23 additions & 0 deletions empressofheels.html
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,29 @@

    <!-- 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 gtag === 'function') {
    gtag('event', 'click', {
    event_category: 'mySHOEFITTER', // Group or category for the event
    event_label: 'mySHOEFITTER Button', // Label to identify the event
    value: 1 // Optional numeric value associated with the event
    });
    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: {
  6. mariusbolik created this gist Nov 7, 2024.
    14 changes: 14 additions & 0 deletions empressofheels.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <!-- Load the mySHOEFITTER Script -->
    <script src="https://js.myshoefitter.com/v1/script.js"></script>

    <!-- Initialize mySHOEFITTER -->
    <script type="application/javascript">
    myshoefitter.init({
    shopSystem: 'shopify',
    button: {
    styles: {
    border: '2px solid var(--secondary_button_background_gradient)',
    }
    }
    });
    </script>