Google Analytics Event Tracking using html5 data attributes
How do I make an google analytics event tracking using html5 data attributes?
What is a google analytics event tracking using html5 data attributes? How do you make a google analytics event tracking using html5 data attributes? This script and codes were developed by Martin Boyce on 20 September 2022, Tuesday.
Google Analytics Event Tracking using html5 data attributes - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Google Analytics Event Tracking using html5 data attributes</title> <link rel='stylesheet prefetch' href='https://www.sutherlandshire.nsw.gov.au//files/templates/00000000-0000-0000-0000-000000000000/bd538bed-1f9c-43d7-b9f0-2c3cb29b7d41/style.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="row-fluid"> <div class="span4 offset4 thumbnail"> <ul class="more"><li> <span class="headline"><a class="js-ga-tracking" data-ga-category="homepage-spotlight" data-ga-action="click" data-ga-label="Zinio Digital Magazines">Zinio Digital Magazines</a></span>
</li><li> <span class="headline"><a class="js-ga-tracking" data-ga-category="homepage-spotlight" data-ga-action="click" data-ga-label="Picture Sutherland Shire">Picture Sutherland Shire</a></span>
</li><li> <span class="headline"><a class="js-ga-tracking" data-ga-category="homepage-spotlight" data-ga-action="click" data-ga-label="Freegal Music Downloads">Freegal Music Downloads</a></span>
</li><li> <span class="headline"><a class="js-ga-tracking" data-ga-category="homepage-spotlight" data-ga-action="click" data-ga-label="Overdrive eBooks and Audiobooks">Overdrive eBooks & Audiobooks</a></span>
</li><li> <span class="headline"><a class="js-ga-tracking" data-ga-category="homepage-spotlight" data-ga-action="click" data-ga-label="New Titles Lists">New Titles Lists</a></span>
</li><li> <span class="headline"><a class="js-ga-tracking" data-ga-category="homepage-spotlight" data-ga-action="click" data-ga-label="Renew Your Loans">Renew Your Loans</a></span>
</li>
</ul>
</div>
</div>
<div class="span7 offset4">
<table class="table table-bordered"> <tbody> <tr> <th>Category</th> <th>Action</th> <th>Label</th> </tr> </tbody>
</table>
</div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Google Analytics Event Tracking using html5 data attributes - Script Codes CSS Codes
* { box-sizing: border-box;
}
.row-fluid { margin: 1rem;
}
.table { width: 100%;
}
th { width: calc(100%/3);
}
Google Analytics Event Tracking using html5 data attributes - Script Codes JS Codes
$('.js-ga-tracking').on('click', function() { var category = $(this).data('ga-category'); var action = $(this).data('ga-action'); var label = $(this).data('ga-label'); var value = $(this).data('ga-value'); var addRow = '<tr><td>'+ category + '</td><td>' + action + '</td><td>' + label + '</td></tr>'; //alert(category + ", " + action + ", " + label); $(addRow).appendTo('table'); //check that analytics is installed and then send event if (typeof ga !== 'undefined') { ga('send', 'event', category, action, label, value ); } else if (typeof _gaq.push !== 'undefined') { _gaq.push([ '_trackEvent', category, action, label, value ]); } else { alert("no google analytics here bro!"); }
});
Developer | Martin Boyce |
Username | boycetrus |
Uploaded | September 20, 2022 |
Rating | 3 |
Size | 2,560 Kb |
Views | 38,456 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Flexbox horozontal scrolling booklist | 5,605 Kb |
First steps with Handlebars.js | 3,978 Kb |
Booklist Using Google Spreadsheets as JSON Source and Handlebars for templating | 3,063 Kb |
Test Case for ajax fail on single result | 3,297 Kb |
Bootstrap Panel List | 2,472 Kb |
Google Maps API Ground Overlay | 2,961 Kb |
Sutherland Shire Libraries Catalogue Search | 2,732 Kb |
Flexbox test | 2,846 Kb |
Flexbox login form | 3,551 Kb |
Homepage thumbnail | 1,852 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Awesome textarea | Ayoungh | 1,977 Kb |
Multi column experiment. | Spylefkaditis | 2,805 Kb |
Bubble animation | Ftabor | 6,565 Kb |
TigerWoods Freecodecamp Page | Baileytj | 2,869 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
Cloud upload | Jaflo | 2,774 Kb |
Slim Grid SASS SCSS v3.2 | Thesturs | 4,709 Kb |
Test | Dviate | 2,668 Kb |
Material Design-Layout-Principles Practice | Fraina | 2,331 Kb |
VerbalExpressions Converter | Cmalven | 2,607 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!