Google Analytics

Hi, is it correct that it is currently not possible to have Google Analytics or any other tracking tool in the app (iOS and Android)?

How do other AppGyver users track what app users are doing in their app?
I would at least want to know basic metrics like how many users open the app per day,…

Is there a workaround or any other tool that would work here?

Thanks for your help!

1 Like

Hi!

We are using google analytics in some of our apps, but there is no ready-made solution available at the moment. Our current solution is implemented through custom javascript, so that requires some coding if you’d like a similar setup. If you’re comfortable to use javascript, I can give you some pointers as to what you’d need to do :slight_smile:

2 Likes

hey @Mevi , I was just searching for Analytics posts in the forum and saw this reply. It would be great to see a sample setup for doing some app tracking. Thank you!

1 Like

Hi Mevi,

thanks for your reply.

Yes, please share how we could use custom javascript for that purpose. That would be great!

Alright, but as this is not my code, I don’t know if I can answer all questions :sweat_smile: But please ask away and I’ll do my best.

The custom javascript we use is divided in two parts (this is a simple page view event):
Screenshot 2020-11-12 at 15.48.52

Setup URL:


(tracking code and app name you’ll set up and get from google analytics, page title and path etc. you can come up with yourself. You can add any other information google analytics can receive to the URL setup with help of the docs for google analytics in regards to what format they should be in)

Request:

4 Likes

Thanks @Mevi! I will try this later.

1 Like

this is working for me, thanks Mevi!

I wasn’t including uid in the POST request at first, but it turns out a pageview hit won’t be valid unless there’s either a uid , or aid (anonymous) provided in the call.

4 Likes

Hi Kieran!

How do I add an AID in this java code? I do not have a good UID variable I guess

hey jordan, I’ve attached a screenshot of what I use!

Screenshot 2021-04-22 at 17.11.57|690x278

1 Like

note: it’s actually cid , not aid that I’m sending as a parameter.

reference

You can make a uuid app variable to then use as your cid input. choose UUID as the variable input type and it will create one for you.

hope this helps!

Hi @Kieran_Doyle
thanks for your reply.

I’ve implemented it all, but it does not seem to work for me yet.
Could you take a look in the setup underneath? (the things you cannot see are all setup exactly like the tutorial above)


Looks like you’re missing the commas between each param (compare to my screenshot).

Right now there are commas after your title and user_agent params. So I think that’s the issue.

1 Like

Thanks!
It seems like I am now generating a pretty legit URL (https://www.google-analytics.com/collect?v=1&t=pageview&tid=mytrackingcode&cid=randomUUID&dh=appname&dt=Homepage&dp=External&ua=Netscape - some of these variables are changed on purpose here)

Though, the second part of the process seems to fail. It keeps giving me the [object Response] error message, although I’ve set it all exactly like the screenshot above.

Anything I might be missing?

@Mevi I know this is not your java code, but could you check out what’s wrong with my code?

It seems like I am now generating a pretty legit URL (https://www.google-analytics.com/collect?v=1&t=pageview&tid=mytrackingcode&cid=randomUUID&dh=appname&dt=Homepage&dp=External&ua=Netscape - some of these variables are changed on purpose here)

Though, the second part of the process seems to fail. It keeps giving me the [object Response] error message, although I’ve set it all exactly like the screenshot above.

Hi! Check the content of the error message by using e.g. ENCODE_JSON for the error. Other than that, I don’t know unfortunately. You can try googling about the URLs for google analytics and see if there’s an error in what you are doing there.

I got it to work!

The variable was still called ‘input1’ (as you can see on the last screenshot), while I referred to ‘url’
Thanks for the help anyway!
:slight_smile:

Hi Jordan,

I’ve worked through the details of this thread and I think I’ve got the Javascript correctly deployed as there are no errors but I’m not seeing data in Google Analytics.

There are so many Google Analytics screens! Where do you get your app_name and tracking_code from in Google Analytics?

So the solution for this is setting up the older style of Google Analytics tracking call Universal Analytics.

This article “Set up Analytics for a website (Universal Analytics)” details how to.
[Set up Analytics for a website (Universal Analytics) - Analytics Help] (Set up Analytics for a website (Universal Analytics) - Analytics Help)

Hi Dave,

The app_name is something you put in yourself, you can totally make it up as you want (in this example, they made it into an app variable).

The tracking code can be found when you make a new Google Analytics property, then click “show advanced options” and toggle on the ‘create Universal Analytics property’ and then 'only the Universal Analytics property" (texts might vary, I have not set my Google Analytics in English).

Once the property is created, you can find the tracking code in the settings area.