Skip to content

Instantly share code, notes, and snippets.

View jsn789's full-sized avatar

jsn789

View GitHub Profile
@jsn789
jsn789 / jQuery_click_listener_for_GTM.html
Last active May 28, 2019 10:35
jQuery Click Listener for Google Tag Manager replicating the "Click Element" and "Link Click" functionality within Google Tag Manager.
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
/* jQuery is required for this script.
*/
/// load jQuery in no-conflict mode
jQuery.noConflict();
(function($) {
/// dom ready
$(function() {
$('body').on('click', function(e){
@jsn789
jsn789 / persist_utm_params.js
Last active September 9, 2024 16:48
Persist UTM Parameters in a URL by decorating on-page <a> elements. Required on all pages.
// Script to persists the listed querystring parameters across the length of the session.
(function() {
var domainsToDecorate = [
'exampledomain.com' //add or remove domains (without https or trailing slash)
],
queryParams = [
'utm_medium', //add or remove query parameters you want to transfer
'utm_source',
'utm_campaign',
'utm_adgroup',