JSFiddle - React, Tailwind, and code Playground

by Ganesh

HTML

<a class="documentTitle downloadcompDocPreview docViewed" href="/content/dam/nextgen/shell/dex/gf/gb/en/lubes/download_center/Products/Tonna/tn10_lt_techlf_s2m_a4x_low.pdf" id="doc_01"
data-event="docDownload" data-docName="Shell Tonna S2 M Product Leaflet"  data-type="pdf" data-pubDate="04/09/2015"  >Shell Tonna S2 M Product Leaflet</a>

JavaScript

//downloadeventTracking = function () {
    $t = $('[data-event="docDownload"]');
    $t.click(function () {
   
        var evDocname = $(this).data('docName') ? $(this).data('docName') : '',
            evDoctype = $(this).data('docName') ? $(this).data('docName') : '',
            evDocdate = $(this).data('pubDate') ? $(this).data('pubDate') : '',
            evDocid = $(this).attr('id') ? $(this).attr('id') : '';
        try {
//Update the data layer
			$.extend(true, digitalData,{ 
      documents:{id : evDocid , name : evDocname,type:evDoctype,publishDate:evDocdate}});
      
//     Triggering the search event - DTM Direct Call
digitalData.trackEvent({ action: "documents" }); 
      
        } catch (e) {
            console.log(e);
        }
    });
//}