How to track lead generating products - google-analytics

We have a website where we present our products, there is no price shown, no add-to-cart button, just photos and text.
We want to track form submissions by product. (product x => 32 form submissions, product y => 7 form submissions)
We have setup a gtag event with a goal in analytics to show us how many people used the contact form successfully with
window.gtag('event', 'submit', {
'event_category': 'form',
'event_label': 'contact_form',
'value': 1
})
I cannot find something specific for this in the google analytics events documentation

Without being too complicated, why not just reorganize your events a little.
window.gtag('event', 'submit', {
'event_category': 'contact form',
'event_label': 'product x',
'value': 1
})

Related

Google analytics add to cart quantity

We use this code format in google analytics corresponding to add to cart feature of google analytics.
function addToCarts() {
ga('ec:addProduct', {
'id': '12334',
'name': 'methyly methly',
'category': 'Clothing',
'brand': '',
'variant': '',
'price': '100',
'quantity': 40
});
ga('ec:setAction', 'add');
// send this using event
ga('send', 'event', 'enhanced ecommerce', 'button click', 'add to cart');
}
addToCarts();
Where in google analtics convertion tab----->Enhanced ecommerce i can see quantity of product added?.Their is one section in google analytics conversion---->Enhanced ecommerce--->shopping behaviour--->Products add to cart(metric). But it only reflect how many times product was added to cart but not how many qunatity of that product to cart.
You can find the quantity in Summary tab of the report: Conversions-->Ecommerce-->Product performace (Summary tab).

Enhnaced ecommerce google analytics code for add to cart

This is code for add to cart in enhanced ecommerce feature of google analytics.
function addToCarts() {
ga('ec:addProduct', {
'id': '12334',
'name': 'methyly methly',
'category': 'Clothing',
'brand': '',
'variant': '',
'price': '100',
'quantity': 40
});
ga('ec:setAction', 'add');
// send this using event
ga('send', 'event', 'enhanced ecommerce', 'button click', 'add to cart');
}
addToCarts();
This is reflected in Conversions-->Ecommerce-->Product performace's Add to cart metrics.
Please see attached image.
Here i am setting default value of quantity to 40 but still 'Products Add to cart' metrics only increments it by 1 in google analytics.
Just to confirm that 40 quantity is sent or not i checked from developers tool and quantity is sent 40 only but still in google analytics 'Products Add to cart' metrics only increments it by 1 in google analytics.
Yes, I confirm that that column indicates the number of times the product was added to the shopping cart, not the quantity of product added to the cart. You can find the quantity in Summary tab of the same report.

Google Analytics Enhanced Ecommerce removed basket items not shown in dashboard

I have a function to remove an item from my analytics data. I'm calling the below function, when my shopper deletes an item from their cart. I've followed the example in the docs.
function removeFromCart(product) {
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
});
ga('ec:setAction', 'remove');
ga('send', 'event', 'UX', 'click', 'remove from cart');
}
I was expecting the Product Adds To Basket metric to decrement by 1 when this function is called, but it appears to remain the same.
Is this a wrong assumption? Is there a Product Removes From Basket column that I need to reveal in the dashboard?
You can find this information in this report in Google Analytics:

Is my code for measuring "Form Submit" event in Google Analytics for contact form "Submit" button on correct?

I want to track "Submit Form" event for contact form of a website in Google Analytics. I don't want to use Google Tag Manager.
Is my code correct to track Form submit event that will trigger on "Submit" button of contact form? Is the function "onSubmit" correct or should I use "onClick" function?
I have Universal Google Analytics code with gtag function embedded in the website.
I have also created the Goal in Google Analytics and set the respective parameters for onSubmit event.
OnClick Event
onClick="gtag('event', 'submit', {'event_category': form', 'event_label': 'form submission'});"
OnSubmit Event
onSubmit="gtag('event', 'submit', {'event_category': form', 'event_label': 'form submission'});"
If you are using contact form 7, if your theme has an admin theme option for adding script to the <head></head> section of your site, add the following code snippet
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
gtag('event', 'submit', {'event_category': form', 'event_label': 'form submission'});
}, false );
</script>
If your theme does not offer an admin option for adding script to your sites, use a plugin such as Insert Header Footer Scripts from wordpress.org
or alternatively, create a function using wp_head and add it to your active theme's function.php file (not recommended, goes against WP best practices of not editing core theme files - unless you are using a child theme in which case add the function to your child theme functions.php file)
ref: https://contactform7.com/tracking-form-submissions-with-google-analytics/
It will be onclick as like mention below:
<input id=”contact-submit” class=”button” type=”submit” value=”Submit” onClick="ga('send', 'event', { eventCategory: 'Form', eventAction: 'Submit', eventLabel: 'Contact'});">

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();?>']);
});

Resources