How to delete a event from event tracking of Google Analytics? - google-analytics

I send some event to Google Analytics using this function
_gaq.push(['_trackEvent',category,action,label,value]);
but I sent them just for testing my code and now I want to delete them and start real tracking.
How can I delete them?should I use any code for this?
PS:I see my testing result in content>EventTracking section

You cannot delete it. That is why it is important to setup a test profile to send data to while you implement/qa.

You can create a Custom Report. There is a Filters section that will allow you to filter out specific event categories, actions, labels, etc. In the example shown below, I am filtering out categories/actions that contain the word "test":

For anyone finding this thread in 2022, there is now an option to create a Data-deletion request in GA4 Analytics with several options.
Details here:
https://support.google.com/analytics/answer/9940393?hl=en
Though it's still somewhat limited and you "schedule" it so it can take some time to actually run.

Related

Using event as view exclude filter in Google Analytics

I have an event that triggers from my tag manager every time someone clicks a certain URL link. This event appears to be tracking properly in GA. However, I am attempting to create a filtered view that excludes traffic that triggers this event. When I use the Filter Verification I get:
"This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small."
Indeed it does not change my data. I am using the event label as the field field/pattern if that makes a difference. Any suggestions?
Ok, there are issues with this question. But first, the answer is: filters aren't meant to remove more than particular hits. They aren't meant to remove sessions or users. Only hits. But there's a hackaround.
Now, more points:
You don't exclude "traffic". Traffic is not precise enough to be useful here. You have to decide what you want to exclude: an event, a session or a user. Or something inbetween, but then you need to define it properly.
A session in Google's understanding is really a bit different from what it seems like. It is custom to believe that a session is a series of interactional events with less than 30 minutes (configurable) inbetween. Not quite. If your source changes, that's a new session. Bear with me.
You... can hack around it if you really need to. By "painting" users or sessions. You do it by setting a specific custom dimension (user- or session-level) and then delete all events that have that custom dimension set using a view filter. The CD will be backfilled, so the filter should clean stuff close to how you expect it to do.
However! GA is... a little bit odd with how they record sessions and users. There may occur a situation when you end up having users or sessions with no events in them. However, if you find this issue at play, you still can export the data to BQ and query it properly. You may find that export cleaner.

Custom events in Firebase

I know this has been discussed a lot on SO, but even based on the previous questions and answers I still can't quite understand the details of how event logging is really supposed to work in Firebase.
Let's say somewhere in my code I have this:
FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putInt("card_id", 912);
mFirebaseAnalytics.logEvent("card_open", bundle);
Do I understand correctly that the "card open" even should now appear in Firebase Console with the "card_id" parameter?
Then I click More > Edit parameter reporting, enter the name of the parameter I added in my code, and it should appear on the list.
I have read the docs several times, but I still can't get it. Can I not even use any of the events and parameters provided by FirebaseAnalytics.Param and FirebaseAnalytics.Event and just send custom events/parameters (within the known limits, of course).
Another question is whether the limit on the number of global parameters force you to use Big Query?
Thank you!
You're correct. You should see the card_open event with card_id parameter in the analytics console.
Note that there's a delay in the analytics reporting, about 4 to 6 hours after it was logged and uploaded by the device.
Just to ensure that your implementation is correct. I mean, to verify that the events, parameters and user properties are logged in the right time and the right place correctly, use the DebugView console.
I also believe that you should be able see the card_id parameter in the custom reporting for card_open event, considering the delay in the reporting.
For your last question, the parameter limit is on a project level perspective now, compared before that it was per app. Parameters with the same name across different apps will be counted as 1. Not sure, maybe Firebase would like us (developers) to use the parameters accordingly.

How to delete an Analytics Event from Firebase

How can I delete an Analytics Event from Firebase?
While I am testing I wrote some events in Firebase Analytics. Firebase by default orders all events alphabetically. So these testing events interrupts with original events.
I could arrange them by count to push all the testing events to last. But it makes difficult to find the main events since those are not alphabetically sorted.
I didn't find any options in Firebase dashboard to delete a event. Is there a way to delete the old events from firebase?
There is currently no way to delete events once they are logged into Firebase Analytics that I am aware of. However, the events will drift out of the default view (which is set to "last 30 days") as time goes on, or you can switch the time period to a shorter time. As you mentioned, you can also click a column header to sort by some other value or "add filter" to filter by an audience or user property.
You can create a new Firebase project if you want to start from scratch. It's also a fairly common practice to use one project for experimentation and validation of your analytics implementation and then to switch to your production Firebase project when everything looks good.
It is not possible to delete analytics events AFAIK, but on some views you can set up the time interval with the filter at the right-top corner to limit the listed events. In the audience set up you need to rely on typing, I am afraid.
As of 31 May 2018, there is an API for this. Doesn't delete individual events, but you should be able to use it to delete all the events collected by a particular app instance:
User Deletion API v3 (UserDeletion.userDeletionRequest)
It was introduced in this blog post and the intended purpose (user privacy) is described here (last paragraph).
Unfortunately, based on my own question, no one seems to have figured out how to get it to work :(
EDIT
Turns out that, according to Google, this API does delete events (which technically is what the OP was asking), but since the aggregate total remains visible on the Firebase console, it won't help with the OP's specific use case.
As Steve Ganem suggested the simplest thing you can do to reset the Firebase Analytics data is to register new Firebase project and that in your app. You can also keep the old project around for debugging/development.

How to remove an e-commerce transaction?

I have implemented google analytics ecommerce tracking in my website. But there was a mistake while passing parameters to google analytics. My order get tracked but product sku code is not set.
Its a dummy order that i dont want show in any google analytics report.
Can you suggest how can i delete this order from google analytics?
I am afraid you cannot remove data from GA once it has been collected.
What you can do is:
hide it: create an Advanced segment, the transaction remains in your GA profile but at least it is not included in the reports.
make a copy: copy the profile and delete the old one (it means you lose historical data)
There is one more option:
1.- You could create a new transaction with the same amount in money, but with a negative sign. For example, if you have recored a transaction for 1,000 dollars, you could recreate it with a "-1000.00" amount. Doing this would "cancell" the wrong transaction.
Important: This will only work when the user sees a long period of time, including the wrong transaction and the fix.
Julien is right. You cannot remove the data.
There're a couple more options in addition to Julien's suggestions though
You can go to "Filters" option of the view and try to see if you can filter it out. Luckily, ecommerce transactions have their own category that can help you narrow down the variable you need to use. (screenshot attached)
Go a little more advanced than filters and use "Data Import" where you import the ecommerce transactions via a spreadsheet thereby overwriting the transactions for that day. So, what you would essentially do is take all the real transactions of ecommerce from your ecommerce application, export them to CSV and then upload it into GA without the test transaction.
Lastly, a tip: create a test profile for things like this.
One of the answers hinted at data imports (but in a way that would probably not have worked). Universal Analytics actually introduced a way to refund transactions (effectively canceling them out) via data imports. However this only works if the data was collected via enhanced e-commerce tracking. As per documentation:
In order to process refunds you need to have collected transaction
data with the ec.js plugin
With standard e-commcerce-tracking Omar Gonzales' answer is still the only working option (I'd like to add the additonal caveat that the negative transaction might be attributed to the wrong channel, so make sure to look at the source/medium/campaign data for the transaction you want to cancel out and supply that data via utm parameters).

Query Google Analytics by User ID

Is there a way to query results using the Core Reporting API (v3) and filtering those results by the User ID assuming that it is being sent to Google Analytics properly?
I've googled this question a lot and read a whole bunch of articles but I did not find one place that does that. Moreover, the fact that I cannot see the User ID anywhere in the reporting interface makes me doubt that this is even possible. I'm guessing I will have to dome something similar to what is recommended here in order to do it?
UPDATE
Apparently, the purpose of my question is not very clear as highlighted by Eike's comment below. What I want to do is generate a report for a specific user with a specific Id using the client API and then combine those results with information I have about this user in my system's database to do something as per my business requirements.
The best place to turn to for such questions is the Dimensions and Metrics Reference. If the dimension you're looking for is not there then you cannot query it or use it in a filter.
The list is really well maintained, so it's not very likely there are as-of-yet undocumented dimensions you could use.
User id is not there.
Well there is a way now.
The docs says the following steps
Set up User-ID in your account
Agree to the User-ID Policy
Read the User-ID Policy. Under I agree to the User-ID Policy, set the switch to ON. Agreeing to the policy enables the feature in your account.
Click Next Step.
2. Set up User-ID in your tracking code
After you enable User-ID by agreeing to the policy, you must implement User-ID in your tracking code.
To employ User-ID, you must be able to generate your own unique IDs, assign IDs to new users and consistently reassign the same IDs to returning users, and include these IDs in the data you send to Analytics.
In this step, you can see the line of code that you have to add to your Analytics tracking code:
ga('set', 'userId', {{USER_ID}}); // Set the user ID using signed-in
user_id.
3. Create a User-ID reporting view
User-ID data can appear only in a dedicated User-ID view.
Click Create.
Enter a Reporting View Name.
You might want to include the term "User ID" in the name to help you remember that this is a special User-ID view.
Select a Reporting Time Zone.
Under Show User-ID Reports, set the switch to ON.
Click Create.
Related resources
https://support.google.com/analytics/answer/3123666?hl=en

Resources