Title: Google Tag Manager integration
Last modified: February 11, 2019

---

# Google Tag Manager integration

 *  [daisyfountain](https://wordpress.org/support/users/daisyfountain/)
 * (@daisyfountain)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/google-tag-manager-integration/)
 * Hi there
 * I was trying to find a flexible way to add Google Analytics event tracking to
   my forms so that I can have a goal in Google Analytics for when the form is submitted.
   My client’s site uses lots of forms, so it’s impractical to track each of them
   separately.
 * For example, you’ll see that the form in the footer of this site ([https://www.michaelneill.org/](https://www.michaelneill.org/))
   has no id or name, just the class ‘clearfix’. That doesn’t give much to hook 
   onto without going up the DOM and looking at parent divs.
 * Can I recommend two suggestions for your plugin?
    1. Add the ability for a user
   to add a form ID/name to each form, which will output on the form element, so
   that forms can be identified individually(like WP Contact Form 7 does).
 * 2. Add a basic Google Tag Manager support, i.e. send a GTM event when a form 
   is submitted, something like this:
 *     ```
       <script>
       window.dataLayer = window.dataLayer || [];
       dataLayer.push({
         'event' : 'optim.formSubmitted',
         'formID' : 2,
         'formName' : 'Footer' //Whatever user has entered in CMS
       });
       </script>
       ```
   
 * This will allow your users to easily track your forms in third party applications(
   like Analytics, Facebook, etc.)
    -  This topic was modified 7 years, 4 months ago by [daisyfountain](https://wordpress.org/support/users/daisyfountain/).
      Reason: Clarification
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fgoogle-tag-manager-integration%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [WPKube](https://wordpress.org/support/users/wpkube/)
 * (@wpkube)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/google-tag-manager-integration/#post-11195470)
 * Hi,
 * I’ve added it to the to do list, the update will be released this week.

Viewing 1 replies (of 1 total)

The topic ‘Google Tag Manager integration’ is closed to new replies.

 * ![](https://ps.w.org/optin-forms/assets/icon-256x256.png?rev=998391)
 * [Optin Forms - Simple List Building Plugin for WordPress](https://wordpress.org/plugins/optin-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/optin-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/optin-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/optin-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/optin-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/optin-forms/reviews/)

## Tags

 * [event tracking](https://wordpress.org/support/topic-tag/event-tracking/)
 * [Goal Tracking](https://wordpress.org/support/topic-tag/goal-tracking/)
 * [gtm](https://wordpress.org/support/topic-tag/gtm/)

 * 1 reply
 * 2 participants
 * Last reply from: [WPKube](https://wordpress.org/support/users/wpkube/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/google-tag-manager-integration/#post-11195470)
 * Status: not resolved