Open Forum

 View Only
  • 1.  GTM and FLEX

    Posted 03-10-2021 09:52
    I recently added some GTM code to our FLEX event and couldn't figure out how to add the second bit of code, which usually is placed in the body. I chatted with support and they didn't seem to know the best route either- just that it wasn't possible to place it in the body (they even suggested I hire a developer), so I just wanted to drop a line that I did some testing and it will work with just the main code. Do not add the 2nd bit of code anywhere, including in the main area for the code snippet. 

    Also, remember not to include <script> in your code for FLEX events, according to CVENT directions.

    Cheers!
    #Flex-Creating/ManagingEvents

    ------------------------------
    Hilary Wickes
    Marketing Coordinator
    America Outdoors Association
    ------------------------------


  • 2.  RE: GTM and FLEX

    Posted 10 days ago
    After hours of searching and testing, I finally figured 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:

    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!


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