AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.4K members online now
4.4K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

problem with setting event click Yes or No

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

On my website, I'd like to let users to choose "Yes" or "No", and track how many people click "Yes" and how many click "No".

 

In the website script, I include the following code within <script> <script/>

 

ga('create', 'mytrackingID', 'auto');
ga('send', 'pageview');
ga('send', 'event', 'willingness to go', 'Yes');
ga('send', 'event', 'willingness to go', 'No');

 

In the google analytics interface, I set up two goals with event category "willingness to go" and event action "Yes"/"No". I used submit template.

 

But when I tested, it seems that the number of "Yes" and "No" it recorded was always the same, even though I definitely clicked different times of "Yes" and "No". Is that the right way to set up the things?

1 Expert replyverified_user

problem with setting event click Yes or No

Top Contributor
# 2
Top Contributor

Hi,

 

How are you triggering the events on your website?

Can you please post the html and js code from your page where you are tracking the events?

 

Thanks!

 


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

problem with setting event click Yes or No

A T
Participant ✭ ✭ ✭
# 3
A T
Participant ✭ ✭ ✭

ga('send', 'event', 'willingness to go', 'Yes');
ga('send', 'event', 'willingness to go', 'No');

shouldn't be call simultaneously.

 

please refer: https://raventools.com/marketing-reports/google-analytics/event-tracking/

 

https://raventools.com/marketing-reports/google-analytics/event-tracking/general-event/

problem with setting event click Yes or No

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Hi, this is the code of "Yes" and "No". Is this what you meant? Thanks

 

<button type="button" onclick="alert('Thanks you! Do NOT forget to bring the code when you come.')">Yes</button>
<button type="button" onclick="alert('Thanks you!')">No</button>

 

problem with setting event click Yes or No

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi, thanks for the reference. This is helpful. I have one question about where shall I place the code. 

 

Right now, I uses Mobirise to develop my website, I can add code in my script for the "Yes"/"No" part and there is a specific place where I can add code for google analytics. Mobirise has this extension for google analytics. Where shall I put the code? In the script for "Yes"/"No" part or google analytics part? Also, what the link should be? Is that the link of my website?

 

 

problem with setting event click Yes or No

A T
Participant ✭ ✭ ✭
# 6
A T
Participant ✭ ✭ ✭

In the script for "Yes"/"No" part.

 

The link will be your code:

<button type="button" onclick="alert('Thanks you! Do NOT forget to bring the code when you come.')">Yes</button>
<button type="button" onclick="alert('Thanks you!')">No</button>

 

Generally it is for anchor link, but in your case it is a button.

 

Please like and accept as solution if it helped.

 

Re: problem with setting event click Yes or No

Top Contributor
# 7
Top Contributor

Hi,

 

Your code for your buttons with the event tracking commands added should look like this:

 

<button type="button" onclick="alert('Thanks you! Do NOT forget to bring the code when you come.');ga('send', 'event', 'willingness to go', 'Yes');">Yes</button>
<button type="button" onclick="alert('Thanks you!');ga('send', 'event', 'willingness to go', 'No');">No</button>

The events will be sent to GA on button clicks. You need to remove the other event tracking commands as they are in your first post.

 

Hope this helps.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital