The following data attributes are used in the examples below:
Example: Subscribing to widget events (without GTM)
The example below uses the web1on1.on function to subscribe to widget events, and push them to Google Analytics. The widgetLoaded function name for the data-web1on1-callback attribute is added to a static script tag.
Open in a new tab, and open the console in your browser using ctrl-shift-i to see the events in action. The window in the tab was created with the following code:Example: Subscribing to widget events (with GTM)
Use a dynamic script tag when using Google Tag Manager. The example below uses the same callback as the previous example. Open in a new tab, and inspect the source and console.log; the window in the tab was created with the following GTM-compatible code:
Open in a new tab