Use Google Tag Manager to fire events on a store click.
To send an analytics event / advertising pixel, or any custom javascript code that will trigger a store click be sure that:
- The correct GTM ID is set in your Smart-Link (Advanced Settings)
- In GTM add this method with your custom code
window.FfmClickEventListener = function (store, cta, properties) {
// custom JS code here
};
(see a demo at the end of this article)
You can also set an event listener on link preview button:
if (document.getElementById(‘play-button’)) {
document.getElementById(‘play-button’).addEventListener(“click”,function(e) {
// custom JS code here
})};
note: you always have the re-targeting parameters you set in the "Advanced Settings"
available in window.ffmTargetingVariables global variable.
example of calling window.ffmTargetingVariables in the console:
That's it!
Demo - how to send Google Analytics event only on Beatport store clicks: