google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 290 forks source link

GA send Event not working #1120

Closed gounder closed 3 years ago

gounder commented 4 years ago

Bug Description

We have connected Google Analytics and have added event tracking on various places on our site but the same isn't showing in Google Analytics. On investigating we realized Analytics is added using the Google Tag Manager code which does event tracking differently i.e. they have to be created in Google Tag Manager itself, but as we have connected Analytics and not tag manager, we don't have a container to add the events in GTM.

Steps to reproduce

Contact form 7 has the tutorial to track form submissions - https://contactform7.com/tracking-form-submissions-with-google-analytics/

Screenshots

Additional Context


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

QA Brief

Changelog entry

jamesozzie commented 4 years ago

@gounder Thanks for reporting, and great to see you making use of the plugin! There's an open feature request (#26) that deals with additional options using the Analytics module.

I'll chase up for any updates on this matter and report back on that issue. In the meantime you can keep watch of that related issue or add your input there.

gounder commented 4 years ago

Hi @jamesozzie

What I meant is there is no way for someone to have custom events being sent to GA if they don't use Tag Manager.

Sitekit offers both GA connection and GTM connection, but is only implementing using GTM, which leaves someone whose connected using GA without any option for event tracking, many have used event tracking on Contact form 7.

Maybe there's a better way to handle this, if someone connects GA then a GA universal code should be and if GTM then the GTM code...

I did see the feature request, but that's asking for events to be automatically added like it's done in the Monster Insights plugin for Downloads and Outbound Link clicks.

jamesozzie commented 4 years ago

@gounder Correct that at present using Tag Manager is required for such event tracking. I've added this as a product enhancement for the team to discuss. Thanks for the suggestion.

gabrielstuff commented 4 years ago

hello, just bumping on that. Was trying to simply add some ga tracking based on the following doc : https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration

After futher reading, I understood that the GTM methods is used and so one should only follow methods described there : https://support.google.com/tagmanager/answer/6106716?hl=en&ref_topic=6333310 to build custom event?

tommiekn commented 4 years ago

Hi, @jamesozzie there was any update regarding this feature and a possible implementation ? agreeing with @gounder thats a bit of limitation for whom doesnt use tag manager

marrrmarrr commented 3 years ago

Hi @gounder and everyone else who chimed in here so far, it seems that the main limitation here is around the type of snippet -- Site Kit uses gtag.js, whereas you seem to be referring to the older analytics.js (or at least that's what's referenced in the Contact Form 7 help article you linked).

Are you usuing analytics.js, and if yes is it feasible for you to upgrade the GA implementation to gtag.js?

marrrmarrr commented 3 years ago

Hi @gounder and everyone, I'll be closing this for now, if you do happen to read the comments have a look at the GA docs, and let us know if you have more questions.

tommiekn commented 3 years ago

hi @marrrmarrr ,

I am the developer of a wordpress plugin that worked well with ga() events, it worked well as well with other analytics plugins that uses gtags after i have updated to gtag() events. However, with sitekit i can't happen to make it work.

I'm using GA debug to figure out the calls, as well Tag Assistant, events gets fired but never arrive on gtag/analytics.

Could you please advise if i need to change the implementation somehow ? Set a default measurement id with a "send_to" command in the event?

The linked tag manager in Sitekit is an empty property, aka theres no settings.

Attached the log from GA debug. Tag assistant is just empty. Over the end theres an example of event fired.

Goal here is to have a gtag function that works with Gsite with default settings.

gtaglog.log