Open Forum

 View Only
  • 1.  Google Tag Manager (GTM) on Flex Sites

    Posted 05-12-2022 11:01
    Edited by Jennifer Bissex 01-06-2023 12:04
    I've posted this in a couple of discussions but realized maybe it would be better as its own post. It took me hours of searching and testing to finally figure out how to add GTM to a Flex event and get it to fire correctly to load the container, fire off page views and a reg conversion event.

    To save everyone else time, here was my setup (you'll have to update with your container code):


    This one goes in a snippet with the type Initialization:
    /* initialization snippet */
    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-YOUR CONTAINER CODE HERE');
    /* end initialization snippet */

    This one goes in a snippet with the type All website and registration pages:
    /* pageview snippet */
    dataLayer.push({
    'event': 'cvent_page_view'
    });
    /* end pageview snippet */

    This one goes in a snippet with the type Registration conversions:
    /* reg conversion snippet */
    dataLayer.push({
    'event': 'reg_complete'
    });
    /* reg conversion snippet */

    Here is the the export of the GTM container that I created to handle pushing the pageviews and registration complete event to GTM. It works for both UA and G4. All you have to do is import and update the IDs with your values (or replace with your settings/config variables). Hopefully no one else will have to spend hours trying to figure this out!
    #Flex-Creating/ManagingEvents
    #Miscellaneous

    ------------------------------
    Jennifer Bissex
    Maritz
    ------------------------------

    Jan. 6, 2023 - edited to correct the link to the GTM container as the old one expired.


  • 2.  RE: Google Tag Manager (GTM) on Flex Sites

    Cvent Staff
    Posted 05-16-2022 11:40
    Hi Jennifer,

    Thank you so much for sharing this great information with everyone!

    ------------------------------
    Megan Clark
    Assistant Team Lead, Online Community Marketing
    Cvent
    ------------------------------



  • 3.  RE: Google Tag Manager (GTM) on Flex Sites

    Posted 05-16-2022 14:44
    Edited by Jennifer Bissex 01-06-2023 12:07
    Quick update: here's how you could add data tags to the conversion snippet. Need to have those single quotes around the variable and the data tag label.

    If you want to send that data over with a reg conversion, you'd have to create data layers variables in your GTM container to read these, and then use custom dimensions or event parameters to send them over to UA/G4. 

    /* reg conversion snippet */
    dataLayer.push({
    'event': 'reg_complete',
    'firstname':'{[C-FIRST NAME]}',
    'lastname':'{[C-LAST NAME]}',
    'contact_company':'{[C-COMPANY]}',
    'contact_type':'{[C-CONTACT TYPE]}',
    });
    /* reg conversion snippet */

    ------------------------------
    Jennifer Bissex
    Maritz
    ------------------------------



  • 4.  RE: Google Tag Manager (GTM) on Flex Sites

    Posted 12-06-2022 09:57

    Hello, Saint Jennfier! 🙌🏻 Big fan of your work on this thread (really and truly).

    I have a favor to ask. That GTM container file link expired and my team is having trouble trying to match it back. Is there any way you would be able to reshare it? Thank You for all of this!! This should be added to the CVENT Documentation/FAQs for Marketers.



    ------------------------------
    Kristen Costello
    Senior Digital Marketing Manager
    ASUGUnited States
    ------------------------------



  • 5.  RE: Google Tag Manager (GTM) on Flex Sites
    Best Answer

    Posted 12-20-2022 12:12
    Edited by Jennifer Bissex 01-06-2023 12:02
    Sorry about that! Here's another link: hopefully longer lasting! GTM container for Cvent Flex Sites

    ------------------------------
    Jennifer Bissex
    Business Solution Strategist
    MaritzUnited States
    ------------------------------