I have a Firebase account with a project including two apps: android and ios. Recently, I integrated the Firebase project with a Google Analytics 4 account so that I could track in-app events.
I've also configured the Firebase SDK according to the documentation in: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce (my app is e-commerce).
Thera are manny events like:
add_to_cart
purchase
In my Firebase and Analytics account, I'm able to see how many times users have triggered the events, but I'm not able to see the revenue from purchase:
google analytics print
Although I see the monetary value as a parameter, it does not appear as revenue.
My currency is set as "BRL" and the price parameter is a number.
We figured out the problem:
Our code did not include the parameter "value". Although we were collecting "price", without the "value" parameter, Google doesn't recognize revenue.
Exemple code from google:
gtag('event', 'purchase', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}, {
item_id: 'SKU_12346',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'gray',
price: 9.99,
currency: 'USD',
quantity: 1
}],
transaction_id: 'T_12345',
shipping: 3.33,
value: 21.09,
tax: 2.22
})
Related
We're trying to configure GA4 to gather same data that we have in UA.
The problem is that we cant see custom metrics data on item-level in DebugView.
In TagAssistant we can see that data is sent:
{
event: "purchase",
gtm: {uniqueEventId: 10, start: 1651XXX},
gtag: {
targets: {
G-XXX: {_ee: true, _uei: 3, _upi: 2},
UA-XXX: {
currency: "PLN",
country: "PL",
custom_map: {
dimension2: "referrer",
...
dimension13: "ecomm_totalvalue",
metric1: "metric1",
...
metric5: "metric5"
},
_uei: 4
},
AW-106XXX: {}
}
},
eventModel: {
transaction_id: "40XXX",
affiliation: "XXX",
value: "9.99",
currency: "PLN",
tax: "1.87",
shipping: "0",
coupon: "",
items: [
{
id: "670",
name: "Tusz Zamiennik T0711 do Epson (C13T07114010) (Czarny)",
brand: "XXX",
category: "Wkłady/Atramentowe/Zamienniki/Tusze/XXX -> Do:E" +
"pson",
quantity: 1,
price: "9.99",
coupon: "",
metric1: "9.99",
metric2: "9.99",
metric3: "9.99",
metric4: "9.99",
metric5: "9.99"
}
],
send_to: ""
}
}
However, on DebugView side we can see purchase event that:
contains all orginal parameters on event level (like transaction_id, shipping etc.)
contains all orginal parameters on item level (like item_id, quantity, etc.)
But our custom metrics are missing
In the other hand, we tried (with different event) push some custom-dumension data and:
they are visible on GA4 DebugView
we can create custom dimension in GA4 basing on this data and it works
I am thinking about:
Creating event-level custom metric to test if it will be passed to GA4 DebugView
Creating item-level custom dimension to test if it will be passed to GA4 DebugView
However, due to fact that GA requires 24h to make conclusions i decided to ask here for any sugestions why it is not working and what else may i test.
As you can see GA4 clearly doesn't show revenue:
However, when I go to Configure-> Conversions I can clearly see that it does track the value:
Our data layer looks as followed:
{
event: "purchase",
gtm: {uniqueEventId: 7, start: 1541254301557},
ecommerce: {
transaction_id: "TEST000000184",
affiliation: "Brand Name B2C - Brand Name B2C website - Brand Name English",
value: "36.0000",
coupon: "",
tax: "4.5100",
shipping: "10.0000",
items: [
{
item_name: "Plate 27cm green",
item_id: "10000",
item_price: "5.37",
item_brand: "Brand Name",
item_category: "",
quantity: "4.0000"
}
]
}
Currency is a required parameter in your ecommerce object.
currency: "USD",
Also, you should keep your quantity as integers not floats
quantity: "4" not quantity: "4.0000"
I have successfully integrated Stripe Payment Gateway Successfully with my Project.
I am having a problem. My Currency is "usd". When an Indian user tries to make a payment and gives the address of India, It gives an error saying Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports.
When a user from outside India does the payment, It happens successfully.
kindly help me with this issue.
On further docs reading i have successfully made the payment by providing address and shipping to the payment intent object like this,
I am trying to make a usd payment.
U need to have address object while creating a customer
return stripe.customers.create({
email: 'test#gmail.com',
name: 'test',
source: stripetoken,
address: {
line1: '510 Townsend St',
postal_code: '98140',
city: 'San Francisco',
state: 'CA',
country: 'US', (In your case it's different so sure to change it)
}
})
Add shipping address object in payment intents like,
stripe.paymentIntents
.create({
amount: '199',
currency: 'usd',
// payment_method_types: ['card'],
off_session: true,
confirm: true,
customer: customer.id,
description: "yesss",
shipping: {
name: 'test',
address: {
line1: '510 Townsend St',
postal_code: '98140',
city: 'San Francisco',
state: 'CA',
country: 'US',
},
},
}),
Hope it's works Thanks.
This is expected. Export transactions must be in non-INR currency and domestic transactions must be in INR. There is, currently, no workaround for that.
https://support.stripe.com/questions/supported-payment-methods-currencies-and-businesses-for-stripe-accounts-in-india
https://support.stripe.com/questions/requirements-for-india-export-charges
On purchase on my ecommerce an event of type 'purchase' is triggered and correctly shown on google analytics dashboard except for the currency.
I've followed this guide, but also tried to pass parameters with 'transaction' prefix (for example 'transactionCurrency' instead of 'currency'). But I can't see any difference.
Here is how I generate payload for the event and how I send
var payload = {
"transaction_id": tid,
'value': 999.99,
'currency': "EUR", //<--this will be ignored
'items': items.map(item => ({
sku: item.sku,
name: item.description,
price: item.price,
quantity: item.qty
}))
};
gtag("event", "purchase", payload)
Here is an example of request sent:
https://www.google-analytics.com/collect?v=1&_v=j73&a=1550934340&t=event&cu=EUR&_s=2&dl=http%3A%2F%2Fmyhost.svi%2Fordini&ul=it-it&de=UTF-8&dt=ORDINI&sd=24-bit&sr=1920x1080&vp=1912x462&je=0&ec=ecommerce&ea=purchase&ev=45&_u=SCCAAUAL~&jid=&gjid=&cid=252314052.1551781012&tid=UA-xxxxxxxx-x&_gid=xxxxxx.xxxxx>m=2ou430&ti=C19000000021&tr=45.19&tt=8.15&ts=5&pa=purchase&pr1nm=item1&pr1pr=1.49&pr1qt=2&pr2nm=item2&pr2pr=21.85&pr2qt=2&z=1998964134
For readability the query string parameters are:
{
"v": "1",
"_v": "j73",
"a": "1550934340",
"t": "event",
"cu": "EUR",
"_s": "2",
"dl": "http%3A%2F%2Fmyhost.svi%2Fordini",
"ul": "it-it",
"de": "UTF-8",
"dt": "ORDINI",
"sd": "24-bit",
"sr": "1920x1080",
"vp": "1912x462",
"je": "0",
"ec": "ecommerce",
"ea": "purchase",
"ev": "45",
"_u": "SCCAAUAL~",
"jid": null,
"gjid": null,
"cid": "252314052.1551781012",
"tid": "UA-xxxxxxxx-x",
"_gid": "xxxxxx.xxxxx",
"gtm": "2ou430",
"ti": "C19000000021",
"tr": "45.19",
"tt": "8.15",
"ts": "5",
"pa": "purchase",
"pr1nm": "item1",
"pr1pr": "1.49",
"pr1qt": "2",
"pr2nm": "item2",
"pr2pr": "21.85",
"pr2qt": "2",
"z": "1998964134"
}
Currency should be EUR, but this is the result:
Change the ga view's settings in GA's admin to collect ecommerce data in EUR instead of USD.
if you're using one currency in your site then you won't even need to set the EUR currency in gtag.
https://support.google.com/analytics/answer/1010249?hl=en
As #Yoray mentions, change the currency setting in the view settings and that should fix it.
To add to this, if you specify a currency in the hit, you will likely see it as "Local Currency" in custom reports. (I haven't confirmed this with gtag.js).
After much pain and weeping and gnashing of teeth, I finally managed to get my website to talk to GTM and GTM to send data to Analytics.
I can see revenue and conversion rates and transaction results in Analytics, but not the product category.
I have my GTM tag set to use the Transaction track type along with the data layer.
My test code is:
dataLayer.push({
'transactionId': 'OnClickTransactionDataLayerPushID', // Transaction ID - Type:String - Required
'transactionAffiliation': 'OnClickTransactionDataLayerPushAffiliation', // store name - Type:String - Optional to use
'transactionTotal': 45, //total revenue - Type:Numeric - Required
'transactionTax': 5, // Tax amount for transaction - Type:Numeric - Optional to use
'transactionShipping': 5, // Shipping cost - Type:Numeric - Optional to use
'transactionProducts': [{
'sku': 'SKU456789', // Product SKU - Type:String - Required
'name': 'OnClickTransactionDataLayerPushName', // Product Name - Type:String - Required
'category': 'OnClickTransactionDataLayerPushNameCategory', // Product Category - Type:String - Optional to use
'price': 35, // Product Price - Type:Numeric - Required
'quantity': 1 // Product Quantity - Type:Numeric - Required
}]
});
In the GA Debugger I can see that the category is being sent as: ec:item variation (&iv) OnClickTransactionDataLayerPushNameCategory
The only problem is that this isn't a true variation. A variation would be something like color or size, not whether an item belongs to a t-shirt category or whatever. In any event, if this information is being sent over, why can't I see it in Analytics?
EDIT
After trying the Enhanced ECommerce code again as below, I see that the product names are hitting the top products list, but no monetary amounts or quantities are displayed. I can see that being sent in the GA debugger though?
dataLayer.push({
"event": "addToCart",
"ecommerce": {
"currencyCode": "USD",
"add": {
"products": [{
"id": "b55da",
"name": "Flexigen T-Shirt",
"price": "16.00",
"brand": "Flexigen",
"category": "T-Shirts",
"variant": "red",
"dimension1": "M",
"position": 0,
"quantity": 1
}]
}
}
});
Your code is standard e-commerce and the report says enhance e-commerce.
Standard
https://support.google.com/tagmanager/answer/6107169?hl=en
Enhance
https://developers.google.com/tag-manager/enhanced-ecommerce
Disable the enhance e-commerce in you view configuration, tab e-commerce and try to look again.