You can use the dataLayer to access the clicked element:
function () {
if (TagManager.dataLayer.get('mtm.clickElement')) {
return TagManager.dataLayer.get('mtm.clickElement').getAttribute('data-foo');
} else {
return '';
}
}
Worked for me