This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Structured-Data Explorer | |
| // To be installed as a Google Chrome Snippet | |
| // Franco Folini - May 2021 | |
| // | |
| ;(() => { | |
| const css = { | |
| schema: "color:darkblue;", | |
| label: "color:darkgreen;", | |
| value: "color:black;", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get the two sliders | |
| const roomWidthElement = document.getElementById('room-width') | |
| const roomLengthElement = document.getElementById('room-length') | |
| // Compute the area and create GA Custom Event | |
| function updateRoomArea() { | |
| const LARGE_ROOM_AREA = 100 | |
| const roomWidth = parseInt(roomWidthElement.value) | |
| const roomLength = parseInt(roomLengthElement.value) | |
| const roomArea = roomWidth * roomLength |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get the two sliders | |
| const roomWidthElement = document.getElementById('room-width') | |
| const roomLengthElement = document.getElementById('room-length') | |
| // Compute the area and create GA Custom Event | |
| function updateRoomArea() { | |
| const roomWidth = parseInt(roomWidthElement.value) | |
| const roomLength = parseInt(roomLengthElement.value) | |
| const roomArea = roomWidth * roomLength |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Google Analytics --> | |
| <script> | |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r; | |
| i[r]=i[r]||function(){ | |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date(); | |
| a=s.createElement(o), m=s.getElementsByTagName(o)[0]; | |
| a.async=1; | |
| a.src=g;m.parentNode.insertBefore(a,m) | |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Global site tag (gtag.js) - Google Analytics --> | |
| <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-X"></script> | |
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| // Replace 'UA-XXXXXXXX-X' with your GA ID | |
| gtag('js', new Date()); | |
| gtag('config', 'UA-XXXXXXXX-X'); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Always use full state name and specify USA to avoids ambiguity | |
| // with Google Maps. This is the structure of a column of cells | |
| const stops = [ | |
| ["601 Santander Drive, San Ramon, California 94583 USA"], | |
| ["1040 Vista Pointe Cir, San Ramon, California 94582 USA"], | |
| ["5013 Laurelspur Loop, San Ramon, California 94582 USA"], | |
| ["524 South Overlook Drive, San Ramon, California 94582 USA"], | |
| ["82 Franciscan Drive, Danville, California 94526 USA"], | |
| ["5117 Ralston Avenue, Richmond, California 94805 USA"], | |
| ["4404 Shadowfalls Drive, Martinez, California 94553 USA"], |