imageeventsgoogle-analyticsevent-tracking

Google Analytics Event Image Tag Creation


Wondering if someone can help me... I'm working with an application system that only accepts simple img tags for tracking, they won't take JS or GTM at all.

Is it possible to create these for events, so I can create the necessary goals within Google Analytics?

I have the event like so:

ga('send','event', 'ATS','Application', 'Application Start',0,{'nonInteration':false});

But obviously I need the img part and the UA-ID etc. I'm not great with this stuff and all the documentation I can find relates to email sends, which isn't applicable here.

Also, it's for a page load.

Many thanks for any help!

Tom


Solution

  • For those reading in the future... This is what ended up working:

    <img style = "width: 1%; ; "src="https://www.google-analytics.com/collect?v=1&t=event&tid=UA-XXXXXXXX-1&cid=555&ec=ATS&ea=Application&el=Application%20Start&ni=0"alt=""height="1"/>

    I used the hit builder mentioned above: https://ga-dev-tools.appspot.com/hit-builder/ (thanks Дмитро Булах) to determine which parameters I needed and added the collect query to tell them to be sent to GA.

    I put the cid as 555 to anonymise it (don't know if that was a good idea), then put the whole thing inside an img tag I lifted from somewhere else.

    Cheers,

    Tom