Custom Metric data not showing up in Google Analytics - 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.

Related

Google Tag Manager click event tracking working but not displaying anywhere

I have successfully created a GTM trigger and tag using the click_text parameter. When I preview and when I published the change both were successful in showing up on my Google Analytics 4 debug and real time tabs. I cannot seem to find a recorded total for this new tag trigger in either GTM or GA4 anywhere. Does this exist in either of these, or do I need to create an event in GA4 unrelated to what I set up in GTM. I have read most of Google's provided documentation on this specific step and it stops flat at this step of things.
Thank you in advance.
If you see your event in real time data report in GA, you're good. The data is in that property. It, however, is not yet available for aggregation, so you won't be able to count them or use them in other reports.
You should wait up to two days for the data to be in the non-real time reports. Vast majority of the data will be available for aggregation in one day, however. Some starts showing up in hours. GA 360 (paid version of GA) shortens the two days to four hours until all data is there.
I'd also suggest using Adswerve plugin for GA debugging: it will print all DataLayer changes as well as everything that is being sent to GA in the console. It's much more comfortable than using real time hits report and it will show you all dimensions that are being sent to GA.

GA measurement protocol tracks event but not enhanced ecommerce purchase

I am currently successfully tracking purchases from website using enhanced ecommerce (via GTM).
I have Goals configured that correctly track these in real time. E.g. event goal for Category = Enhanced Ecommerce and Action = transaction.
However, when I try to track purchases using the measurement-protocol I get the event for the enhanced ecommerce, but I can find nothing in conversion (under the goals or otherwise) about the purchase. I am using the hit-builder.
I have configured various goals and tried many different variations. In my last attempt I created a goal which should match if the label is equal to "serverevent".
Then I sent this:
v=1&t=event&tid=MY_TID&cid=5ca7c46d-a46a-4e0b-a395-b4d1bb228fee&ti=T123415789&ta=test&tr=150&pa=purchase&pr1id=P123459&pr1nm=GiftCard_150&pr1ca=test&cu=EUR&iq=1&ec=Ecommerce&ea=Activation&ni=1&pr1qt=1&el=serverevent
In GA I can see the event coming in with event category "Ecommerce", action "Activation" and label "serverevent", but I see nothing in conversions and the goal still has 0 hits.
I have used POSTMAN to post to https://www.google-analytics.com/debug/collect, and I get back "valid" and "Found 1 hit in the request."
I don't know what else I can try. To be clear I am trying to track server side purchases because these are sales by third parties through our API.
The google analytics standard reports take time to process Google stats it can take between 24 -48 hours for the data to complete processing.
You can see if your hits are being recorded by checking the real time api. As for the standard reports your going to have to wait between 24 - 48 hours to see if the results have completed processing.

Multiple custom metric hits issue with GTM/GA transaction

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.

"There is no data for this view." in reports with custom dimensions in Measurement Protocol of Google Analytics

Our application needs to gather usage data through the Measurement Protocol of Google Analytics.
We can successfully send "appview" hits to the Google Analytics server, and get a proper response by it (a GIF image). The appview hits appear on the GA Dashboard, along with the country of origin, session duration, etc.
We also have several custom dimensions and metrics that we want track for each hit. We have set those up in the GA Admin panel with the correct scope, index and active state. We have 3 Hit-scoped dimensions, 3 User-leveled dimensions and 1 Hit-scoped metric, all set to Active state.
We send the dimensions and metrics as described in the docs at
Custom Dimensions / Metrics
attached to the hits they apply for, like so:
...&cm1*=3 <--for the metric
and
...&cd6*=15 <--for the dimensions (some dimensions have numeric values, others are text)
The problem is that those metrics and dimensions don't show up in our custom reports: the reports always say "There is no data for this view.". For example, we have a report that has one dimension and one metric, without any filters, set to "Any view". It doesn't matter if the Type of the report is Explorer, Flat Table or Map Overlay, it never shows anything.
There have been several days since the hits were received and appeared in the dashboard, but the reports are still empty. So scratch out any processing lag.
We tried sending "event" hits instead of "appview" hits - again, the hits show up in the Dashboard, but the reports are empty.
We cannot get any useful insights without using dimensions and metrics - so there is no way to get by without this.
Because of reasons too long to describe, we cannot use any of the Google-provided Analytics libraries.
Is there anything else we need to do to see data in those reports?
When using the measurement protocol you need to that the profile is not set to exclude bot and spiders.
Go to the google analytics website under the admin and the settings under the profile in question.
Beyond that check the realtime reports you should see the hits coming in. You will need to wait 24 -48 hours for data to appear in the standard reports due to data processing lag.

Doing cohort analytics on Google Analytics

Suppose I have 65 people that register on January 1, 2012.
I want to find out how many of those 65 people returned to the site that same week. (More generally, if n people signup on date A, I want to be able to find out how many of those n people return in a given date range.)
Is there a way to do this using Google Analytics? If so, how? I am currently getting the user's username for each page hit.
If you only need to track people who sign in then you don't need to get very fancy. You can copy the relevant user attributes, such as sign up date, from your DB to GA using events or session level custom variables.
But if you want to track everyone, including those who don't sign up, then you'll need to use visitor level custom variables (GA cookies).
I explain how to set this up in detail in this post so I'll just highlight the key points here:
First, decide how to layout the data in Google Analytic's custom variables based on your requirements. For example, are you storing retention dates for daily, weekly or monthly tracking? Do you also want to track cohort goals? Partition this data into the available custom variable slots.
Write the cohort data to these custom variables when visitors arrive or achieve goals using Google Analytic's _setCustomVar function. Setting the fourth parameter of that function to 1 indicates you want to do visitor-level (cookie) tracking.
For each cohort you wish to analyze, create an advanced segment in Google Analytics. Using a regex expression in the condition will give you the flexibility to segment for interesting cohorts. ex: "All users whose first visit was the week before Christmas".
Analyze the results with reports by specifying a date range and the corresponding cohort-sliced advanced segments. Another option is to extract the data using the Google Analytics Data Feed Query Explorer or their API.
Once you've put in the work your new visitors will be stamped by their first visit date and nicely fall into each daily or weekly retention bucket. This is what it might look like if you were tracking weekly retention, for example:
This is not a full solution, but here are some points on how I would approach this problem with the help of Google Analytics:
You have to make sure that you somehow store the registration date of each user, either in your database or in a cookie. Then have a look at Google Analytics Event Tracking. You could for example set up a new category based on the registration date. On every page load in your page, you then have to set up this event tracking call, for example like:
_trackEvent("returns", "2012-01-01", "UserId:123123123")
This way you will receive all page views for users that registered on that particular date. To add a date range in this, you have to make sure that these events only get fired for the number of dates after the signup (e.g. 7 days).
After your date range, you will be able to see how many page views and how many users returned - you even know which users came back.

Resources