Closed BillyCottrell closed 4 years ago
Yes but that's a different library as im using this library for my bachelor thesis which is a comparison study of 3 different analytic tools, so i have to use this library.
I have made changes to the singleton to be able to use this properly. Instead of creating the analytics only once i now create it everytime I use the getAnalytics() method. When I call the method I send the parameters object with it so when sending an event I can send the page information through the param object.
static getAnalytics(params) {
if(ExpoAnalyticsManager.instance ==null){
ExpoAnalyticsManager.instance = new ExpoAnalyticsManager();
}
this.instance._analytics = new Analytics("UA-153309176-1",params);
return this.instance;
}
Example of usage:
ExpoAnalyticsManager.getAnalytics({dt:"Get Ideas"}).event("Like","Like-" + recipes[recipeIndex].name.replace(/\s+/g, '-'), recipes[recipeIndex].name, 1);
Sending a regular events is not a problem, but when checking the events in google analytics under pages all events are categorized underneath "not set".
The issue occured when having 2 components (Homescreen with a list and item component), the hit is executed in the homescreen but the event is triggered in/by the item component and for some reason when sending it to ga it loses the page info.
I tried to test this out and move the event to the homescreen which gets called by the item component, but without success.
Screenshot:
I have been using React Native with managed expo and made a singleton for the analytics instance.
When the button was clicked the event was triggered through following code:
So the events get passed without any issue and prints the event in the console correctly.
Is it possible that i have to send a hit when sending an event so it gets linked or is there a different reason to why the page information isn't known?