Streaming live at 10am (PST)

Event Tracking For CTAs - Google Analytics Issue


#1

I’ve set up a common handler to retrieve event tracking data from CTAs throughout the site as well as set up the attributes for each. However, it’s been a few days and still nothing from GA. None of my events are appearing on therefore not sure where I messed up. Help would be much appreciated.

Here’s my read-only link where you can see that I set up custom attributes for each CTA throughout the site - https://preview.webflow.com/preview/trytootles?preview=2eff3d1cfdee00cffd0a22814633a76c

Common Event Handler is currently in the Custom Code section for Project Settings–

Thanks for the help guys. Looking forward to hearing from you.

Here is my site Read-Only: LINK
(how to share your site Read-Only link)


#3

This is the common handler in the footer section under Custom Code in project settings. I found it used as a “solution” on an older forum post.


#4

hi @jose_llorens, when clicking on one of the links with the tracking, I am showing an error in the console, that is usually a good place to start looking:

CloudApp

That error usually means the GA tracking code script is not yet loaded, I did not see any google tracking snippet yet installed on the site, i.e:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

You should copy your own snippet from Google like above and paste into the head of your site and republish for the ga tracking event to fire successfully.

I would check that first, then see if the issue persists. P.s. when using the async snippet above, you can remove the analytics tracking code from the project settings SEO tab.


#5

I went ahead and added this async snippet found in my GA tracking code section to the header.

However, I wanted to confirm with you because mine doesn’t state anything regarding tracking events as yours does above.

The only snippet I have for tracking events is the following handler found in the footer section of the site:

Let me know if I’ve mixed this up somehow.

Appreciate the help man!


#6

I apologize. Forgot to attach.

Site Header (GA Tracking Code):

Site Footer (Event Tracking Handler):

Did I miss something here? I’ve gone ahead and republished so just waiting for Google to fetch the data. Thanks again for the help here.


#7

Hi, well the error is still indicating that _gaq is undefined:

CloudApp

I would suggest to add the universal tracker to the site first, then you can use event tracking, see here: https://developers.google.com/analytics/devguides/collection/analyticsjs/


#8

Good call!

I went ahead and replace the header code with the following:


#9

Also, on the integrations page, I’ve always had the universal tracking ID set up. I came across this message now, which doesn’t this contradict what you were saying??

A little confused as to which I should keep/remove and if I had the universal tracking ID the entire time, then why wouldn’t the event tracking be working?

Now, I have two tracking IDs for GA haha…one on the integrations section and one under header for custom code just to clarify.


#10

Hi @jose_llorens, remove the code in the integrations page. If you are using the code snippet, there is no need to use the integrations tab. If you try to use both codes, the communications will likely fail to google.

Also, now when I click the button, no more console error, are you seeing any updates in your GA?


#11

You’re the man Dave!

Everything is finally all set up. I really appreciate all the help man. Wish you the best. Always here if I can ever help with anything.

Cheers,
JL


#12

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.