ElkArte Community

Extending Elk => Addons => Topic started by: emanuele on November 06, 2014, 09:19:19 am

Title: [ADDON] Google Analytics tracking
Post by: emanuele on November 06, 2014, 09:19:19 am
A very small and quick addon that introduces a couple of admin settings to add a Google Analytics tracking code to the pages of the forum.
By default admin pages are excluded (I should have excluded the moderation center as well...), but there is a checkbox to enable the tracking here as well.
And another option is to track only guests. I'm not sure if the specular (track only registered members) is worth. Let me know. ;)

Repository:
https://github.com/emanuele45/GAnalytics
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on November 06, 2014, 09:42:08 am
Fastest addon ever released :D

I'll try it ;) thank you!
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on November 06, 2014, 11:53:23 am
lol

That was easy. ;D
Title: Re: [ADDON] Google Analytics tracking
Post by: Alphonse on November 07, 2014, 09:31:07 pm
Sweet :)
Title: Re: [ADDON] Google Analytics tracking
Post by: meetdilip on November 07, 2014, 10:05:15 pm
Good work @emanuele :thumbsup:
Title: Re: [ADDON] Google Analytics tracking
Post by: Adrek on November 09, 2014, 11:33:21 am
Useful :)

There is small 'typo' in uninstall instructions, there should be <remove-file but it is <require-file

/edit:
One more typo, also in uninstall instruction. After LANGUAGEDIR/english there should be / :)
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on November 09, 2014, 12:30:20 pm
/me blames copy&paste... O:-)
Title: Re: [ADDON] Google Analytics tracking
Post by: Alphonse on November 10, 2014, 07:53:39 am
The addon is not working. I enter the code and press save, but it doesn't save it.
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on November 10, 2014, 08:19:58 am
Updated with the fixes from @phantom thanks!

@Alphonse is the code you have any different from the "UA-1234567-1" structure?
Title: Re: [ADDON] Google Analytics tracking
Post by: Alphonse on November 10, 2014, 08:42:03 am
@emanuele same
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on November 10, 2014, 09:07:53 am
Strange, it works fine here...

Try copy and pasting the example in the comment next to the field.
Title: Re: [ADDON] Google Analytics tracking
Post by: Alphonse on November 10, 2014, 09:23:00 am
I see the problem.

is saves when I type UA-1234567-1
but when I type mine it doesn't. I believe it 's cause mine has 8 numbers in the middle,  UA-12345678-1
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on November 10, 2014, 09:36:51 am
Ahh!
I'm not much into GA stuff, so I thought they were all the same, but I also expected some may be different. lol

Quick fix, open the GAnalytics.integrate.php and change the two 7 here:
https://github.com/emanuele45/GAnalytics/blob/master/GAnalytics.integrate.php#L54
and here:
https://github.com/emanuele45/GAnalytics/blob/master/GAnalytics.integrate.php#L71
to 7,8 (seven comma eight)
Title: Re: [ADDON] Google Analytics tracking
Post by: Alphonse on November 10, 2014, 10:35:43 am
@emanuele
It works now, thanks for your help   :D
Title: Re: [ADDON] Google Analytics tracking
Post by: davemc on January 23, 2015, 12:46:58 am
Thanks for the add-on (and the fix)
Title: Re: [ADDON] Google Analytics tracking
Post by: stanstrup on June 15, 2016, 10:58:14 am
Same issue with the 8 digit code instead of 7. Might be nice to have this fixed...
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on June 15, 2016, 11:11:37 am
I'm not a fan of fixing my bugs. :P

You can change the line suggested and have it up-and-running while waiting for me to fix the package. ;)
I'll fix it sooner or later. Hopefully sooner now that 1-1 B1 is out. O:-)
Title: Re: [ADDON] Google Analytics tracking
Post by: stanstrup on June 16, 2016, 08:32:05 am
Yeah I got it working. Just thought it deserved a bump after 2 years :)
Title: Re: [ADDON] Google Analytics tracking
Post by: Jason on June 25, 2016, 12:49:18 pm
Thanks for the addon, i think 7,8 fix the issue for me. Hope it runs without any issues.
Title: Re: [ADDON] Google Analytics tracking
Post by: ahrasis on June 25, 2016, 08:21:20 pm
Any good guide on how to use this Google Analytics? I haven't got a chance to explore this thing yet. :(
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on June 26, 2016, 01:41:08 pm
Do you mean a guide on how to use analytics or a guide on how to use this addon? 
Title: Re: [ADDON] Google Analytics tracking
Post by: ahrasis on June 26, 2016, 03:10:11 pm
How to create and use GA. This addon should follow only after I learned that.
Title: Re: [ADDON] Google Analytics tracking
Post by: meetdilip on June 27, 2016, 10:45:27 pm
From what I remember, it is as simple as signing in with a Google account. Something like as in for Adsense. As for using, you will get a dashboard by default. It has a lot of useful information related your website.
Title: Re: [ADDON] Google Analytics tracking
Post by: ahrasis on June 28, 2016, 01:08:38 am
I had some facebook page for some domain but I also dont know how to use it like GA. If anybody can give a good link on how to use and utilize GA will be much appreciated.
Title: Re: [ADDON] Google Analytics tracking
Post by: Jorin on June 28, 2016, 01:52:43 am
https://www.google.com/intl/en/analytics/#?modal_active=none

Maybe the references list on the GA wiki site has some useful links too:

https://en.wikipedia.org/wiki/Google_Analytics
Title: Re: [ADDON] Google Analytics tracking
Post by: meetdilip on June 28, 2016, 06:01:20 am
@ahrasis , give this a try. Have screen shots

http://www.dkssystems.com/how-to-use-google-analytics-for-beginners
Title: Re: [ADDON] Google Analytics tracking
Post by: ahrasis on June 28, 2016, 06:47:42 am
Wow. Thank you @meetdilip and @Jorin , they are useful info indeed. Will try it out soon.
Title: Re: [ADDON] Google Analytics tracking
Post by: Jason on July 07, 2016, 09:28:24 am
Here is the updated version (value changed to 7,8)
Title: Re: [ADDON] Google Analytics tracking
Post by: shaitan on February 22, 2017, 01:35:10 pm
French translation in attachment
Title: Re: [ADDON] Google Analytics tracking
Post by: mmagss on March 21, 2017, 02:20:38 am
So which one works? I have tried to install and uninstall them it doesnt work at all. Is there a chance we can add the analytics code directly without using the addon?
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on March 21, 2017, 04:27:14 am
the one Jason posted should work fine, I use this addon on two forums and it works great
Title: Re: [ADDON] Google Analytics tracking
Post by: mmagss on March 21, 2017, 05:27:14 am
Yeah I tried that too. I only need to put the UI-XXXXXXXXX-XX right? It doesnt work at all and I dont know why.
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on March 21, 2017, 05:47:55 am
Quote from: mmagss – I only need to put the UI-XXXXXXXXX-XX right?
yes, go to Administration Center >> Configuration >> Add-on Settings >> Miscellaneous

(Link-4631)

can you be more specific with:
?
Title: Re: [ADDON] Google Analytics tracking
Post by: mmagss on March 22, 2017, 12:54:08 pm
Quote from: radu81 –
Quote from: mmagss – I only need to put the UI-XXXXXXXXX-XX right?
yes, go to Administration Center >> Configuration >> Add-on Settings >> Miscellaneous

[attach]4631[/attach]

can you be more specific with:
Quote from: mmagss – It doesnt work at all
?

Did the UA Code still show up after you clicked on save?
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on March 22, 2017, 03:54:34 pm
Usually repeat the installation doesn't really fix anything (unless a new version is involved). :)

Quote from: mmagss – Is there a chance we can add the analytics code directly without using the addon?
You can always: edit the template and put it where you prefer. :)
Title: Re: [ADDON] Google Analytics tracking
Post by: kucing on March 22, 2017, 10:28:02 pm
I use this to insert Google Analytics code: http://addons.elkarte.net/feature/BKE-Elk-Global_Header_and_Footer.html
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on March 23, 2017, 04:45:04 am
Quote from: mmagss – Did the UA Code still show up after you clicked on save?
yes
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on September 14, 2017, 04:58:13 am
I just installed this addon using the compatibility mode on 1.1 RC2 and seems to work fine ;)
Title: Re: [ADDON] Google Analytics tracking
Post by: kucing on September 28, 2017, 05:31:36 pm
Quote from: mmagss – Did the UA Code still show up after you clicked on save?

i have the same problem. the code is not saved. is this fixed?

--

edit

this one works:
Quote from: emanuele – hmm...
This looks different again.
Try the attached one.

on the addon site: http://addons.elkarte.net/enhancement/Google-Analytics.html it's still version 0.0.1.
Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on September 30, 2017, 10:41:36 am
/me has to update a lot of things. :'(
Title: Re: [ADDON] Google Analytics tracking
Post by: nous on October 29, 2017, 06:57:03 am
This is my first post, so hi everyone and thanks for this wonderful forum software.

My google tracking code has 9 digits (UA-123456789-1) and I've tried this addon (versions 0.0.1 and 0.0.3) in Elk 1.0.10 and recently in 1.1 without success. I've also tried by editing GAnalytics.integrate.php and extending the regex to a broader matching (UA-\d{6,10}-\d), without success either. The global header/footer addon is a no-go because in 1.1 malforms the pages and only shows blank. Any suggestions?

Edit: the tracking code is saved fine in admin/miscellaneous settings.
Title: Re: [ADDON] Google Analytics tracking
Post by: Spuds on October 29, 2017, 10:19:01 am
Hi and welcome :D

I've made a quick attempt to update the addon to install on 1.0 and 1.1 as well as use the async version of the GA tracking code.  There was a left over debug statement in .0.0.3 that may have caused problems.  I also consolidated the regex check to a string since it was used in a few spots and seems to need to be updated from time to time.

Anyway give this version a try!
Title: Re: [ADDON] Google Analytics tracking
Post by: nous on October 29, 2017, 11:09:30 am
Quote from: Spuds – Hi and welcome :D

I've made a quick attempt to update the addon to install on 1.0 and 1.1 as well as use the async version of the GA tracking code.  There was a left over debug statement in .0.0.3 that may have caused problems.  I also consolidated the regex check to a string since it was used in a few spots and seems to need to be updated from time to time.

Anyway give this version a try!

That did the trick! I updated the version info to 0.0.4 in  package-info.xml to allow installation over existing 0.0.3 versions. Thanks a lot!

@emanuele What's the easiest way for you to merge this update on Github? A pull request?

Title: Re: [ADDON] Google Analytics tracking
Post by: emanuele on October 30, 2017, 03:04:05 am
If you want, sure! :D
Title: Re: [ADDON] Google Analytics tracking
Post by: nous on October 30, 2017, 07:20:50 pm
Done, cheers!
Title: Re: [ADDON] Google Analytics tracking
Post by: Jason on April 24, 2018, 01:37:37 pm
Is the save issue fixed? Or when we click save it gets saved?
Title: Re: [ADDON] Google Analytics tracking
Post by: radu81 on April 24, 2018, 03:01:18 pm
I'm using this add-on on elkarte 1.1.3 but after the upgrade from 1.0.10 and after installing this add-on my analytics code was already there, so I didn't have to touch anything.
Install it and let us know if it works for you ;) 
Title: Re: [ADDON] Google Analytics tracking
Post by: Jason on April 25, 2018, 01:33:26 pm
It didn't showed any "Settings saved" message. But i checked in Analytics and it works without any issue :)
Title: Re: [ADDON] Google Analytics tracking
Post by: davemc on May 25, 2018, 04:00:45 pm
Heres the version modified for 9 digit numbers, I've checked it and google detected the number on 1.1.3

IE: UA-123456789-X