Created
April 7, 2021 10:26
-
-
Save daniel-sim/1069666ffc6acbcf0f3bcda44ace9a9e to your computer and use it in GitHub Desktop.
This file contains 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
<script> | |
(function () { | |
var analytics = window.analytics | |
if (!analytics) return | |
var appInstallButton = document.querySelectorAll('.js-partner-tracking'); | |
analytics.ready(function () { | |
ga('create', 'UA-REDACTED', 'auto', 'appTracker'); | |
ga('appTracker.send', 'pageview'); | |
if (appInstallButton.length) { | |
appInstallButton.addEventListener('click', ga('appTracker.send', 'event', 'Shopify App Store', 'Get App button', "REDACTED")) | |
} | |
}) | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
appInstallButton.addEventListener('click', ga('appTracker.send', 'event', 'Shopify App Store', 'Get App button', "REDACTED"))
This is where the bug is.
addEventListener
should be passed a reference to a function. Right now, it's calling the function immediately.