Jump to content

How to integrate Google Analytics code ?


mickmik

Recommended Posts

pir8radio

Hi everyone,

 

Someone can explain how or where I put the code ?

 

THX :)

 

Depending on how geeky you are you can run an nginx reverse proxy and inject any code you want anywhere. 

Link to comment
Share on other sites

Swynol

are you wanting to use google analytics to see who is accessing your emby server? 

 

there are probably easier ways using a firewall with syslog. otherwise NGINX reverse proxy but my knowledge of NGINX is limited.

Link to comment
Share on other sites

dcrdev

https://gist.github.com/jirutka/5279057

 

Didn't try it tho, just googled it.

 

I do similar things with another self hosted tracking platform I use, only with Apache and mod_substitute. I don't know much about nginx, but that code snippet appears to place the tracking code in the head tag - that's not good, you want to place it before the closing body tag.

 

You should always load these tracking scripts at the very last minute, otherwise they are going to have a detrimental affect on loading times.

Link to comment
Share on other sites

are you wanting to use google analytics to see who is accessing your emby server? 

 

there are probably easier ways using a firewall with syslog. otherwise NGINX reverse proxy but my knowledge of NGINX is limited.

 

Yes thats the point ! But Google analytics is ... more sexy :D

Link to comment
Share on other sites

pir8radio

Yes thats the point ! But Google analytics is ... more sexy :D

 

I don't know..... what stats are you looking to get? I bet I have some that google doesn't...    :)   I can get just about any info you want down the the emby user level, for just about any stat...   Here are a few.  I can pretty much trace the path every visitor to my emby server took...   If I wanted....    This is all using nginx and a log analyzer... You can taylor nginx to grab emby headers to get all kinds of info.  Plus the google analytics code is java script based which means it will not load in the various apps, it will only work for web browser users.  But a reverse proxy will catch all requests, no matter what app is used. 

 

5a56c020a01d8_generalstats.png

 

5a56be60e1ea2_embyclienstats.png

 

 

Monthly Roku (or any emby client) version used:5a56be6b59886_RokuVersions.png

 

The screen resolutions of my visitors:

5a56be77825af_screenres.png

 

Reasons Emby had to transcode a file:5a56be7ee0c44_transcodereasons.png

Edited by pir8radio
  • Like 2
Link to comment
Share on other sites

Jdiesel

I don't know..... what stats are you looking to get? I bet I have some that google doesn't... :) I can get just about any info you want down the the emby user level, for just about any stat... Here are a few. I can pretty much trace the path every visitor to my emby server took... If I wanted.... This is all using nginx and a log analyzer... You can taylor nginx to grab emby headers to get all kinds of info.

 

5a56c020a01d8_generalstats.png

 

5a56be60e1ea2_embyclienstats.png

 

 

Monthly Roku (or any emby client) version used:5a56be6b59886_RokuVersions.png

 

The screen resolutions of my visitors:

5a56be77825af_screenres.png

 

Reasons Emby had to transcode a file:5a56be7ee0c44_transcodereasons.png

This is amazing. You just sold me on setting up my reverse proxy again.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
Jdiesel

I don't know..... what stats are you looking to get? I bet I have some that google doesn't...    :)   I can get just about any info you want down the the emby user level, for just about any stat...   Here are a few.  I can pretty much trace the path every visitor to my emby server took...   If I wanted....    This is all using nginx and a log analyzer... You can taylor nginx to grab emby headers to get all kinds of info.  Plus the google analytics code is java script based which means it will not load in the various apps, it will only work for web browser users.  But a reverse proxy will catch all requests, no matter what app is used. 

 

5a56c020a01d8_generalstats.png

 

5a56be60e1ea2_embyclienstats.png

 

 

Monthly Roku (or any emby client) version used:5a56be6b59886_RokuVersions.png

 

The screen resolutions of my visitors:

5a56be77825af_screenres.png

 

Reasons Emby had to transcode a file:5a56be7ee0c44_transcodereasons.png

 

Which log analyzer are you using? I'm going to give this a go

Link to comment
Share on other sites

  • 8 months later...

I don't know..... what stats are you looking to get? I bet I have some that google doesn't...    :)   I can get just about any info you want down the the emby user level, for just about any stat...   Here are a few.  I can pretty much trace the path every visitor to my emby server took...   If I wanted....    This is all using nginx and a log analyzer... You can taylor nginx to grab emby headers to get all kinds of info.  Plus the google analytics code is java script based which means it will not load in the various apps, it will only work for web browser users.  But a reverse proxy will catch all requests, no matter what app is used.

Hi,

Can you share some code with us. weblog seems to be IIS dedicated, so how did get these details out of the Emby server log ?

Link to comment
Share on other sites

pir8radio

Hi,

Can you share some code with us. weblog seems to be IIS dedicated, so how did get these details out of the Emby server log ?

 

it works with nginx (or apache) logs as well...    I use nginx as a reverse proxy in front of my emby server, and use those nginx logs for the stats.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
vaise

 

Hi @@pir8radio.

That system costs a bit of money.  Looks great though.

I bet some of the stuff you got in there needed a bit of coding.

I quickly got up goaccess in a docker pointed it to my nginx emby.log (access.log) and I got lots of cool stuff - but more 'generic' rather than emby specific like yours.  The users would be very handy.

I wacked it on a subdomain password protected on cloudflare too for access from everywhere.

I wonder if goaccess can be modded to get more stuff like that.

V.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...