Solution to use href and onclick together in anchor tag.
Scenario : We have to track number of times link click by user (Using Adobe siteCatalyst).
We tried added onClick function with href attribute.
But when we use href it ignores onClick.
So we have use below alternative.
Link :
< a href="javascript:TrackSiteCatalystAndRedirect('event1','bannerimage','00000','SOME_PROD');">
Script :
< script type="text/javascript" language="javascript">
function ImageTracking(event, link, productId, productName) {
//Tracking code
}
function TrackSiteCatalystAndRedirect(event, link, productId, productName) {
ImageTracking(event, link, productId, productName);
window.location = "/product-results.aspx";
}
Comments
Post a Comment