Multiple custom metric hits issue with GTM/GA transaction - google-analytics

I track eCommerce transactions with GA and GTM, and trying to create a custom metric which will count how many people are involved in each transaction.
So I created a hit-scoped custom metric and try to pass its value along with the transaction tag in GTM:
Please see screenshot here:
As we know, a transaction in GA is a series of hits: one "transaction" hit and one or more "item" hits. The problem is that GTM sends the custom metric value with ALL of the hits, not just with one. So when I use my hit-scoped metric to measure something, it's measured more than once.
For ex., in a transaction where 2 people are involved, this value (2) is send twice (once with "transaction" hit, once with "item" hit) and in the GA reports I see figure 4 (instead of 2) associated with this transaction.
I didn't find a way to ask GTM to send the custom metric just once.
Am I missing something here? Any suggestions?
Thanks!

You can use a separate tag with the custom metric information, which is triggered on the same event as the transactions. This will create another request to GA, which isn't the best solution in terms of performance.
Maybe you can combine this information with a tag, which is already triggered on the same page? An "all pages" Universal Analytics tag is maybe present and has the information {{QuantityOfInsured}} available at the time the "all pages analytics tag" is triggered.

Related

GA view filter on server-side tracking not working

I use server-side GA tracking with universal analytics measurement protocol parameters:
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
Transaction and product items (with enhanced e-commerce parameters) are shown in GA. I have multiple views and wanted to set a filter for individual view, but no data showed up even though I waited several hours in case there was a delay for data filtering. I only created one filter in my GA account. Say I filtered on Application Name. Here is filter settings:
Filter setting
I am sure parameters were sent to GA. As you can see from post request parameters (hide tid), an=ustest was sent.
POST request parameters:
transaction:
"an=ustest&cu=AUD&ti=US_test_order_2022-05-18_38&tr=100&ts=5&tt=2&ta=galdtest&dr=http%3A%2F%2Fwww.galdtest.com%2Fus%2F&dl=http%3A%2F%2Fwww.galdtest.com%2Fus%2F&cd1=%2Fus%2F&v=1&tid=UA-XXXXXXXXX-Y&cid=5d80d21d-bb0d-477e-b0b0-2b288203df6f&t=transaction"
product data in this transaction:
"an=ustest&cu=AUD&ec=sales&ea=transaction&ti=US_test_order_2022-05-18_38&pa=purchase&pr1id=513&pr1nm=testproduct_1_title%20-%20L42%20%2F%20Blue&pr1br=test_brand&pr1ca=testcategory1%2Ftestcategory2%2Ftestcategory3&pr1pr=390&pr1qt=7&pr1ps=1&v=1&tid=UA-XXXXXXXXX-Y&cid=5d80d21d-bb0d-477e-b0b0-2b288203df6f&t=event"
I tried to create a filter on other parameters as well, but none of them worked.
Did anyone run into similar issue before? Thanks for helping.

Custom Metric data not showing up in Google Analytics

Background
I am currently using Google Tag Manager to populate the Sales amount into a Custom Metric in Google Analytics. This is the code I use to push Sales amount to Google Analytics.
ga('set', 'metric2', {{salesvalue}});
Other information
My custom metric set up in Google Analytics: https://i.imgur.com/kX3aUto.png
I know that the metric is firing with the correct values since it is showing up in GA Debugger: https://i.imgur.com/lGIxCw1.png
Error
Despite the above, I do not see any information in Google Analytics: https://i.imgur.com/WtxChgY.png
Questions
Is there anything wrong with my setup? I have waited over 3 days but still no data.
By using ga('set') does it mean that if a user makes 2 separate purchases in the same session, only the latest sales figure will be reflected instead of the total of the 2 purchases?
Thank you
In your GA Debugger console, the metric2 parameter should be appearing within the pageview send data (along with all the other data being sent to GA at that time). If it is not there, you could be running into a race condition or some other technical issue. If it is there, then you'll know that it is definitely being sent to Google Analytics and something else is wrong. It should not take long to appear, and if you see any rows of data (as you did with your screenshot) the metric data would be there at that time.
Regarding your 2nd question, custom dimensions have scopes that are configured when you create them, but custom metrics simply add up. If I had a custom metric of "clicks on a button" and user clicked it 3 times in their session, the custom metric would be 3. Likewise, if your custom metric is listening for sales value, it will add up to the total value in that session.
Hope that helps at least get you some more clues as to what is wrong.

Duplicate transaction under same transaction ID

I am having an issue tracking my transactions via Tag Manager.
I have a GA Universal Analytics Transaction tag which fires on transaction completes. All cool until here.
So I have added another tag to be able to record Checkout behaviour but suddenly I am getting double transactions for a single transaction ID.
Can an event populate the actual transactions in the Acquisition > Source/Medium data table? This second tag is an Event tag actually, so it confuses me a bit.
Sure (actually for some scenarios sending e-commerce events is even considered best practice, e.g. for product list tracking).
However this would send a transaction only when a purchase action is specified in your e-commerce variable (the one you specify in the E-commerce section in "Read data from Variable"). Unless this contains a purchase event your problem is probably elsewhere.
GA does not deduplicate transactions, so even a reload can potentially cause double transactions.
Is the screenshot you included of the second tag? If so, you'll likely want to remove or modify the ecommerce setting from that tag as GTM will populate the ecommerce reports with whatever data is in the EE Funnel Step 4 variable, even if it's the same data that has already been sent in a previous ecommerce beacon. So if EE Funnel Step 4 is sending an ecommerce purchase action and the same transaction id as your previous ecommerce beacon it would be counted twice in GA.

Submitting eCommerce analytics to Google Analytics prior to completing transaction

We're using Google Analytics to track transactions, products, browser data, etc on our shopping cart. I am interested in pushing some data to GA prior to completing the transaction. Normally I push data to GA on the success/order confirmation page.
My Question: If I push custom variables to Google Analytics prior to completing an order, will GA be able to associate that session with my completed transaction - allowing me to cross reference my custom variables with the transaction IDs?
Background: We use an address validation service and sometimes the address that the validation service submits to us isn't correct. It can "over correct" and completely strip vital details from certain addresses. Happens less than 1% of the time but when that is multiplied against 1000 - 2000 orders a day it can really become a problem for our fulfillment department. Yes, we have reported this to the address validation service and they tell us they are investigating it. I plan to use jQuery to grab the form data in the billing and shipping fields and when the user fills out all necessary fields, do a push to GA.
Yeah, you should be able to set a session-level custom variable (a unique id or any other value that isn't PII) prior to the transaction, and then create a custom report in GA that looks at that custom variable against the transaction Id. Because it's a session-level variable, it will associate anything that happens for that session.
More info on session-level variables here - Custom Variables - Web Tracking (ga.js)

How are dynamic segments in Google Analytics retroactive?

Are dynamic advanced segments retroactive at the session or visitor level? Can it retroactively recalculate session data or can it retroactively recalculate visitor data?
Here is an example as this is a foggy question.
Say I add an event tag to GA today. Tomorrow i run a report where the dynamic segment is for visitors who have triggered the event. The report requests unique visitors over time.
Now, if it is retroactive at the visitor level, the visitor is now tagged as having triggered the event. The report should show data going back in time (assuming these are not first time visitors). In this scenario GA will see if the visitors tagged arrived 2 days ago even though the events did not exist yet.
This answer no longer reflects up to date information.
Advanced Segments are not queried at the visitor level, and are thus not able to query data across sessions. They query particular sessions (or, visits), not visitors.
So, if you visit the site today, trigger an event, and then visit the site again tomorrow and don't trigger the event, an advanced segment for that event will be a query that says "Show me all sessions in which this event was trigger"; the former will be included and the latter excluded.
Similarly, if you do an advanced segment for a particular page, what you're saying is "Filter down to all the sessions in which this page was viewed" (this can be confusing for people who apply an advanced segment for a particular page, and the result contains more than just that page.)
However, they are dynamic and can be applied to the retroactively. In other words, the results of the advanced segmentation are not contingent on when the advanced segment itself was created. (This stands in contrasts to, say, account filters, that do not apply themselves retroactively.) They tend to be calculated on the fly; you'll notice that complex advanced segments can often take a long time to process, and tend to increase the likelihood that Google Analytics will return sampled (or, "fast access") data.
There is no way to use advanced segmentation to query across sessions.

Resources