Created
January 29, 2015 19:02
-
-
Save nitishn/19b1650beab3561babc8 to your computer and use it in GitHub Desktop.
Sometimes you need to send a dataLayer push on an external/internal URL. This is how you do it properly.
This file contains hidden or 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
$(document).on('click', '.widget-promotion a', function(event) { | |
var title = $(this).text().trim(); | |
var url = $(this).attr('href'); | |
dataLayer.push({ | |
'event': 'promotion_click', | |
'promotion_title': title, | |
'eventCallback': function() { window.location = url }, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment