Firebase + GTM + GA implementation issue - firebase

I am using iOS Swift 3 and trying to track screen views in Firebase and push those data into GA with GTM.
My issue is that I cannot get the screen name from "screen_view" events pushed into GA.
In firebase, the initial automated screen view hit has no screen name and only screen class so I used Analytics.setScreenName to set the screen name and override the screen class.
However this causes two hits in Firebase, one automated with no screen name and one manually triggered with screen name.
Also, I want to pass the screen name from the event into GA as a screen view type. I set the screenName field in GTM to a variable.
I have tried various event parameters for the variable
"firebase_screen" : results in not found and (not set) in GA
"_sn" : results in "invalid event parameter" in xCode debug
So I guess all the parameters that start with _ are reserved in Firebase. So how do I get the reserved event parameters from firebase into GA. For example, I may want to store the App Version in a custom dimension for something.
The biggest problem here is the screen name not picking up in the screenview hit from GTM to GA.

In Google Tag Manager you'll want to set the following:
Tag type: Universal Analytics (Google Analytics)
Track Type: Screen View
Field Name: screenName
Value: [the variable I've identified below]
Trigger: Fire on "Event Name" contains screen
** Note the Trigger might be better as matches "screen_view", but I haven't had a chance to test
Variable:
Variable Type = Event Parameter
Event Type = Custom Parameter
Event Parameter Key = _sn
Other Things
Make sure the Analytics.setScreenName is working and in ViewDidAppear as that fills the _sn parameter.
Xcode Debug Example
In Xcode you should see something such as:
firebase_screen_id (_si) = 4233194112313113131331;
firebase_screen_class (_sc) = ViewController;
firebase_screen (_sn) = Home View;
firebase_realtime (_r) = 1;
firebase_debug (_dbg) = 1;
firebase_event_origin (_o) = auto;

Related

How to enable the RealisticView events in HERE iOS Premium SDK 3.18+

Using the HERE iOS Premium SDK 3.18 to create a routing App and I can't figure out what is needed in order to enable the Realistic View events in order to get signpost data for maneuvers in the route.
I have specified the NavigationManager Delegate and created functions for the event callbacks. When I create a route and run a simulation on the route, I never receive either of the realistic view events. I have scoured the User Guide and the API Reference but can't get the events.
func navigationManager(_ navigationManager: NMANavigationManager, didUpdateRealisticViewsForNextManeuver realisticViews: [NSNumber : [String : NMAImage]]) {
mapState.status = "Realistic View Updated for Next Maneuver!"
}
func navigationManager(_ navigationManager: NMANavigationManager, didUpdateRealisticViewsForCurrentManeuver realisticViews: [NSNumber : [String : NMAImage]]) {
print("RealisticViews: \(realisticViews.count)")
for key in realisticViews.keys {
print("key: \(key)")
}
mapState.status = "Realistic View Updated for Current Maneuver!"
}
======
Update: I located my problem, I was missing the step to register the realisticview aspect ratios after doing that I started receiving the events. From the User Guide:
"The Realistic View feature is disabled by default. To enable it, use NMANavigationManager.realisticViewMode property and set the view mode to NMARealisticViewDay or NMARealisticViewNight. Next, register the desired image aspect ratios by using NMANavigationManager.realisticViewAspectRatios property."
====== Update: I located my problem, I was missing the step to register the realisticview aspect ratios after doing that I started receiving the events. From the User Guide:
"The Realistic View feature is disabled by default. To enable it, use NMANavigationManager.realisticViewMode property and set the view mode to NMARealisticViewDay or NMARealisticViewNight. Next, register the desired image aspect ratios by using NMANavigationManager.realisticViewAspectRatios property."

Firebase Analytics Funnel why no option to filter by event parameters?

There is absolutely no option to do so in Firebase Console or am I just not seeing it?
What is the point of having all these parameters if I can't use them?
screen_view
(app)
when a screen transition occurs and any of the following criteria are met:
No screen was previously set
The new screen name differs from the previous screen name
The new screen-class name differs from the previous screen-class name
The new screen id differs from the previous screen id
firebase_screen, firebase_screen_class, firebase_screen_id, firebase_previous_screen, firebase_previous_class, firebase_previous_id, engagement_time_msec
https://support.google.com/firebase/answer/9234069?hl=en
You have to activate the parameters in the Analytics platform to be able to use them, otherwise you will only be able to see them on BigQuery if you have connected these two platforms.
Link Google Analytics 4 properties to Firebase: https://support.google.com/analytics/answer/9289234?hl=en
How do events and parameters work with Google Analytics 4 properties: https://developers.google.com/analytics/devguides/collection/ga4/tag-guide
GA4 BigQuery Export: https://support.google.com/analytics/answer/9358801?hl=en

link user parameter "value" into event value in firebase event console

I'm generating an event in my mobile app using this method:
var Param = {};
Param.VALUE = response[1];
firebase.analytics().logEvent(`Purchase_report`, Param);
and I am able to receive the log in StreamView and also Event dashboard. I also can see my parameter("VALUE") by correct sent value from my application in these views. However I don't know how may I link this value to the event value and I always see "0" as event value. Please refer to these images for more clarifications:
I found my answer. The point is if you set a value parameter, it takes about ONE DAY for an update to be appear in the firebase console.So I finally saw my report after one day.

Can't see the Custom Variables on Google Analytics

I want to add a Custom Variables called Custom Variables to my website.And I defined a datalayer on Google Tag Manager.I also add the code snippet on the page which I want to get the Custom Variable.
<script type="text/javascript">
var external_id = jQuery('#edit-external-id').attr("value");
dataLayer = [{
'externalID': external_id
}];
</script>
I debuged the configuration of GTM.Here's the picture
I got the message.But I can't see the value statics on my Google Analytics.I think the menu path of GA is Audience-Custom-Custom Variable.Am I right?Anyone can help me?
Writing values to the dataLayer does not make them appear in Google Analytics; it just makes them available in GTM.
You need to set up a Google Analytics Tag - there is a tag template for Universal Analytics where you can insert the Google Account id. Use the default "all pages" trigger. Since you are receiving data I assume you already have done this.
Now in GTM go to the "variables" menu, click "new" and select "Data Layer Variable" as type. Enter the key from the dataLayer that you want to be evaluated, i.e. "externalID". Give your variable a name, I suggest to simply use the dataLayer key. Save. Now you can use the variable by calling it via its name surrounded by {{curly brackets}}.
Go back to your GA tag. I assume you want to save the value as custom dimension, since custom variables are deprecated in the current GA version. You need to create a custom dimension in Admin/Property/Custom Definitions/Custom Dimensions. When you create a custom dimension you will get a numeric index to address the dimension by. Go to your GA tag, advanced configuration, custom dimensions and click "add". Enter the numeric index and after that select the variable you want to send.
Custom variables do not show up by default in the standard reports; you can either selected them as "secondary dimension" from the dropdown above the data table, or create a custom report.
First, you must never, ever use dataLayer = [{...}] after the container snippet (preferably don't use it ever). You're overwriting the container snippet by reinitializing it as a new Array. As you can see, in your Preview panel there is no "Page View" event (should be just before DOM Ready), which means e.g. the All Pages Trigger won't work.
Second, "Custom Variables" are deprecated. They've been replaced with Custom Dimensions in Universal Analytics.
Third, did you actually add this variable/dimension to a GA Tag?
Here's how it should work:
1) In your script replace dataLayer = [{...}] with:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'variablePushed',
'externalID' : external_id
});
This is the safe way to interact with dataLayer.
2) In GA Admin / Property Settings / Custom Definitions / Custom Dimensions, create a new Custom Dimension with the appropriate scope, and make note of the assigned Index number. If you are unfamiliar with Custom Dimensions, you have some reading to do. Start with https://support.google.com/analytics/answer/2709828?hl=en
3) Create a new Custom Event Trigger for Event Name variablePushed, name it e.g. "Event - variablePushed" (without quotes).
4) Create a new Data Layer Variable for Variable Name externalID, name it e.g. {{externalID}} (without curly braces).
5) Create a new Event Tag, with Event Category: External ID, Event Action: {{externalID}}, and set the Non-Interaction field to True.
6) Browse to More Settings -> Custom Dimensions in the Event Tag, and add a new Custom Dimension. Set the Index number from (2) and set the value to {{externalID}}.
7) Add the Trigger you created in (3) to this Event Tag.
What happens now is that when the externalID dataLayer.push() takes place, the Event Tag fires a non-interaction event to GA (so it won't affect Bounce Rate), which piggybacks the Custom Dimension with it.

Adobe DTM (adobe tag manager) set s.campaign with direct call rule

I need to set s.campaign with a value that is returned by some ajax. I figured I could just make a direct call to get that done. Nothing seems to be reported.
After ajax I call:
_satellite.track('ruleString');
I can see in the debugger my rule is fired. In the Adobe analytics admin, has been set for values to expire after MIN.
I have tried four ways of getting the campaign value set from here.
1 -
Set it to a dataElement like : (in the analytics preset)
Campaign Value -> %mySpecialValue%
This element runs custom JS and logs the value so I know it runs, but adobe never sees a value.
2 -
I set it with the following: (in custom code box)
var delm = _satellite.getVar('special_id');
_satellite.setVar("newVal",delm);
return true;
and then set campaing to %%newVal%%
-
I set it with the following: (in custom code box)
var delm = _satellite.getVar('special_id');
s.linkTrackVars='campaign';
s.campaign = delm;
s.tl();
-
I set it with the following: (in custom code box)
var delm = _satellite.getVar('special_id');
s.linkTrackVars='eVar0';
s.campaign = delm;
s.tl();
None of them seem to get data passed to adobe analytics. It's like my campaign var doesn't accept data. It should also be noted that if I just set in DTM the value of campaign to just "text" it never seems to get passed in either.
Is there a better way to set campaign with custom code.
Please remember that AJAX is asynchronous:
$.ajax({
url: "test.html",
});
_satellite.track('ruleString');
is wrong, but:
$.ajax({
url: "test.html",
context: document.body
}).done(function() {
_satellite.track('ruleString');
});
will work.
Also please add in direct call rule console.log with data element value in javascript section, to check that value is present when rule is fired.
As it turns out a consutant that set up dtm initially for us dropped in some custom code in our app measurement file. It must have been from another client Basically s.campaign was being set in there only when "cmpid" was passed as a query param.
Basically (1) above is all thats needed in the direct call to set it from a data element so long as you call _satellite.track('stringVal'); when your ajax is done
If the data element value is coming from work done via Ajax, then don't call that data element with any other rules prior.

Resources