Loading ...
Sorry, an error occurred while loading the content.

30098Re: Tracking Google Analytics Events with Google Tag Manager

Expand Messages
  • baphil78
    Apr 1, 2013
    • 0 Attachment
      Hi,

      I'm having a similar problem with tracking custom events. We just installed Google Tag Manager two weeks ago and are working the kinks out. There are several events we are trying to track; one (supposedly) easy one is a newsletter sign-up. Below is the custom JavaScript tag. We created a tag in GTM set it to fire on pages containing "/newsletter", where the sign-up form is. The tag is set to fire when someone clicks the submit button on that page. Though it's written to capture name and email, all we really care about is knowing if someone clicked on it. GA has constant of 1 when this tag is fired.

      Unfortunately, we aren't getting any data in GA (I've signed up using different emails on different browsers). When I open the debug window in Chrome, it looks like the below tag is firing. Any clues? Would more information help understand this problem. Thanks Kevin, or to anyone who can offer insight.


      <script>

      jQuery(function () {
      jQuery("#form > div:nth-of-type(2) > input").click(function () {
      var name = jQuery("#fname").text();
      var email = jQuery("#email").text();
      dataLayer.push(['_trackEvent', 'Newsletter Sign-Up', 'Name', name]);
      dataLayer.push(['_trackEvent', 'Newsletter Sign-Up', 'Email', email]);
      });
      });
      </script>

      Brian

      --- In webanalytics@yahoogroups.com, "VaBeachKevin" <vabeachkevin@...> wrote:
      >
      > Actually yes, you can track clicks of links (or buttons or whatever) using Google Tag Manager, without needing to make any changes or additions to the page or the link itself. The way I do it is to add a new tag in GTM with the type of "Custom HTML Tag". In there I use some jQuery to listen for clicks of certain elements on the page, and in that function I add my dataLayer.push calls to trigger events in GA (or any other analytics tool I have being served through GTM). I can add any click tracking to any element, and will never need to make any changes to the html of the page.
      >
      > Kevin Rogers
      > @vabeachkevin
      >
      >
      > --- In webanalytics@yahoogroups.com, "ju2ltd" <jim@> wrote:
      > >
      > > Is there a way to tag events such as a button click using Google Tag Manager without the need to call _trackEvent as the onclick event. In other words with out the need to involved developers or html code at all.
      > >
      > > May be this is too much too expect!
      > >
      > > Jim.
      > >
      >
    • Show all 8 messages in this topic