PageSourceSearch

https://influencermarketinghub.com/wp-content/plugins/imh-banner-module/assets/frontend.js?ver=1.0.0

js influencermarketinghub.com collected 2026-10-01 07:14:37 UTC 1,780 bytes, 48 lines download raw bytes

1/**
2 * IMH Banner Module – frontend click tracking.
3 *
4 * Fires a GA4 event (and a dataLayer push for GTM fallback) whenever a
5 * visitor clicks any link inside an .imh-banner-v3 container.
6 *
7 * GA4 event schema:
8 *   event_name : "banner_click"
9 *   placement  : position slug, e.g. "article-top", "main-page-left"
10 *   banner_id  : WordPress post ID of the banner
11 */
12( function () {
13    'use strict';
14
15    document.addEventListener( 'click', function ( e ) {
16        var link = e.target.closest( '.imh-banner-v3 a' );
17        if ( ! link ) return;
18
19        // Walk up to find the wrapper that carries position & banner-id
20        var wrapper = link.closest( '[data-position]' ) || link;
21
22        var position = wrapper.getAttribute( 'data-position' )
23                    || link.getAttribute( 'data-position' )
24                    || '';
25
26        var bannerId = wrapper.getAttribute( 'data-banner-id' )
27                    || link.getAttribute( 'data-id' )
28                    || '';
29
30        // ── GA4 via gtag ──────────────────────────────────────────────────
31        if ( typeof gtag === 'function' ) {
32            gtag( 'event', 'banner_click', {
33                placement : position,
34                banner_id : bannerId,
35            } );
36        }
37
38        // ── GTM dataLayer fallback ────────────────────────────────────────
39        if ( Array.isArray( window.dataLayer ) ) {
40            window.dataLayer.push( {
41                event     : 'banner_click',
42                placement : position,
43                banner_id : bannerId,
44            } );
45        }
46    } );
47
48} )();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.