How to track R shiny dashboard events from Google Analytics - r

Hi I am trying to add a event to track in Google Analytics,
Here is one working example:
$(document).on('change', 'select', function(e) {
ga('send', 'event', 'widget', 'select data', $(e.currentTarget).val());
});
And I am trying to track if a download button is clicked in my shiny app, and I tried:
$(link) .on('shiny:filedownload', function(e) {
ga('send', 'event', 'download', e.name, e.href)
});
It didn't work, I cannot find examples online, so just wondering if anyone came cross this problem before.

Related

Event Tracking not Appearing In Analytics

I am trying to use Google Event Tracking to record when a certain user action is taken. I have a JS method called runGABanner that fires the Google Analytics code when conditions are met, but I'm not seeing anything update in GA Admin page.
In my code, I set up the GA code as such:
const runGABanner = () =>{
ga('send', {
hitType: 'event',
eventCategory: 'AdBlocker',
eventAction: 'Ad Blocker Displayed',
eventLabel: 'Ad Blocker'
});
}
I was expecting to see "Banner Displayed" under "Event Action", but as the screenshot shows, nothing is appearing there.
Any thoughts as to why this is happening?

Google Analytics Events are Not Registering

I am in need of assistance. I am trying to implement Custom Event Tracking for a form submission as both an Analytics Goal, and a Conversion Goal for Google Optimize.
Here is a screenshot of the Google Analytics Goal:
I have my Google Analytics in the head (with sensitive information redacted with XXXXX) as such:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=XXXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXXXXXXXXXX', { 'optimize_id': 'XXXXXXXXXXX'});
</script>
And then I have tried to fire the custom event with both:
ga('send', {
hitType: 'event',
eventCategory: 'mailchimp',
eventAction: 'subscribe',
eventLabel: 'soft-lead-form'
});
and also:
gtag('event', 'play', {
'event_category': 'mailchimp',
'event_label': 'soft-lead-form'
});
I have confirmed that analytics is instanced effectively by writing to the console with:
if (gtag) {
console.log("ga present");
}
And I have confirmed that the user action triggers the ga call by writing to the console in the same function with:
$("#mc-embedded-subscribe-form").submit(function(){
gtag('event', 'play', {
'event_category': 'mailchimp',
'event_label': 'soft-lead-form'
});
console.log("ga Event Submitted");
});
I would GREATLY APPRECIATE any help. I've been through pages of documentation and, despite trying/testing multiple points in this process, I can not get the event to appear in Either Analytics or Optimize. This is a crucial piece for our marketing efforts and I very much want to make it work.
Thank you so much!
Gary
Surely the event with ga(...) you have to remove it because you are using gtag.
If you are seeing the events real time, then you need to wait for at least 24-72 hrs to get the data updated under Behaviour -> Events -> Overview.

GA Tracking Event in WordPress

I want to integrate GA Tracking Event on buttons in WordPress. Currently my theme is using ShortCodes and I can add specific .Class to it.
[vc_button text="Order Now" type="blue" align="left" url="#" size="big" class="ordernow"]
Google Analytic code is added on the site which is on Local Host and it's working. I found an article on this but don;t know what I'm missing.
http://www.gravitatedesign.com/blog/event-tracking-google-analytics-wordpress-edition/
There will be around 4 buttons of "Order Now" on a single page and I want to track their conversion rate with Google Analytic so I will know on which button visitors are getting engage. Hope this will deliver the exact thing that I want to achieve..
please provide your result html of that buttons.
I usually use something like this
$('.ordernow').on('click', function(e) {
ga('send', 'event', 'order', document.URL);
});
you can add additional classes to track each button, example:
$('.ordernow button1').on('click', function(e) {
ga('send', 'event', 'order1', document.URL);
});
$('.ordernow button2').on('click', function(e) {
ga('send', 'event', 'order2', document.URL);
});
hope this will help you.

Event tracking in Google analytics is not displaying events data

I am adding Google Analytics code in my website, it displays active users but not but displaying the event list empty.
I tried both below codes
1)
jQuery('.btn-cart').click(function() {
ga('send', 'event', 'add-to-cart', 'add','product-added-to-cart');
});
2)
onclick("_gaq.push(['_trackEvent', 'whitepaper', 'add', 'product-added-to-cart']);")
Please let me know where i am doing wrong.
I found the solution.
jQuery('.btn-cart').on('click',function() {
_gaq.push(['_trackEvent', 'Add to Cart', 'Add To Cart Clickthrough', '<?php echo $currentUrl = Mage::helper('core/url')->getCurrentUrl();?>']);
});

Where find events tracker in google analytics?

I have track event like this.
$('.payment_button').on('click', function() {
var _this = this;
ga('send', 'event', 'Payment', 'Payment', 'Payment Checkout', {
'hitCallback': function() {
$(_this).parents('form').first().submit();
}
});
It's worked good, but I don't know where to view results. In google analitics admin I can view my event only in real time events, but after 30 minuts it's removes and I can't view it.
UPDATE: Google Analytics generally updates reports every 24 hour
On the left side of the reports page where the Report Navigation menus is, it's under
Behavior > Events

Resources