Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
SpiritStack authored Feb 1, 2025
1 parent e049b24 commit d36a7cd
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
<meta property="og:image" content="https://spiritstack.github.io/Free-Average-Stock-Price-Calculator/image.png">
<title>Average Stock Price Calculator - Track Your Investments Easily</title>
<link rel="stylesheet" href="styles.css">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-S9BL9ZL20F"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-S9BL9ZL20F');
</script>
</head>
<body>
<div class="container">
Expand Down Expand Up @@ -84,6 +93,38 @@ <h3>Can I use this tool for multiple stocks?</h3>
<script src="script.js"></script>
<script>
document.querySelectorAll("time").forEach(el => el.textContent = new Date().getFullYear());

// Track button clicks
document.getElementById("add-transaction").addEventListener("click", function() {
gtag('event', 'calculate_clicked', {
'event_category': 'User Interaction',
'event_label': 'Calculate Button'
});
});

document.getElementById("reset-transactions").addEventListener("click", function() {
gtag('event', 'reset_clicked', {
'event_category': 'User Interaction',
'event_label': 'Reset Button'
});
});

// Track form inputs
document.getElementById("quantity").addEventListener("change", function() {
gtag('event', 'stock_quantity_entered', {
'event_category': 'Form Input',
'event_label': 'Stock Quantity Field',
'value': this.value
});
});

document.getElementById("price").addEventListener("change", function() {
gtag('event', 'stock_price_entered', {
'event_category': 'Form Input',
'event_label': 'Stock Price Field',
'value': this.value
});
});
</script>
</body>
</html>

0 comments on commit d36a7cd

Please sign in to comment.