Google Conversion Tracking On a Button
Hi All,
I'm trying to add a DBM floodlight tag onto a button click using DTM. I've set the global snippet to fire on all the pages (onload rule - Non-Sequential HTML) and set the event snippet to fire on the button action as non-sequential HTML. I see the rule being triggered on the button click, however I get a console error saying the gtag is not defined. Any idea how to fix this?
<!-- Start of global snippet: Please do not remove Place this snippet between the <head> and </head> tags on every page of your site. --> <!-- Global site tag (gtag.js) - DoubleClick --> <script async src="https://www.googletagmanager.com/gtag/js?id=DC-XXXXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'DC-XXXXX'); </script> <!-- End of global snippet: Please do not remove -->
<!-- Event snippet: Please do not remove. Place this snippet on pages with events you’re tracking. Creation date: 07/20/2018 --> <script> gtag('event', 'conversion', { 'allow_custom_scripts': true, 'u1': _satellite.getVar('Product Display Name'), 'u2': _satellite.getVar('Product Model Code'), 'send_to': 'DC-XXXXX/invmedia/y9sjx4y9+standard' }); </script> <noscript> <img src="https://ad.doubleclick.net/ddm/activity/src=XXXXX;type=invmedia;cat=y9sjx4y9;u1=[Product Name];u2=[Product Code];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=1?" width="1" height="1" alt=""/> </noscript> <!-- End of event snippet: Please do not remove -->
I tried adding the gtag+event tag together onto the button - that resolves the gtag error but then it flags that _satellite is not defined. Any thoughts on how to resolve these?
Thanks,