By Miguel Angel Velasco on Thursday, 12 December 2013
Posted in Technical Issues
Replies 28
Likes 0
Views 630
Votes 0
Hi Mark,

It has been a long time, we are still very happy with Easyblog and Komento.

We send you this mail because we have implemented Google Analytics custom variables in order to get better and easier reports.
Now we want to get blog popular authors and categories. Could you please tell us which php variables shall we call to get this information.

The goal is to join all the results despite the language, to have a clearer view of the users behaviour.
What I have done with our products families is to get the item id, and with this result, launch a request to the Joomla database... So I always get the results in the same language.

Could you figure out a way to get authors and categories results ignoring language out of Easyblog?

If you need any further information please contact us.

Thanks and cheers,
M. Ángel Velasco
Hello Miguel,

Hm, sorry but I am actually a little lost here. Would you mind elaborating more on this please?
·
Thursday, 12 December 2013 23:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark,

sorry for the delay...

I paste the code I'm using for analytics here. It will be easier to explain my self.
That is the part of the code where we define and call the variable. In this case $section. The main issue is to get the whole thing in spanish, in order to read reports easily.
We need to define some variables for EasyBlog, Author and Categorie of each pageview. This way we could know which authors are more readed, popular categories... for having more accurate reports.
_gaq.push(['_setCustomVar',1,'Seccion','<?php
$db = &JFactory::getDBO();
$id = JRequest::getInt('id');
$db->setQuery('SELECT #__sections.title FROM #__content, #__sections WHERE #__content.sectionid = #__sections.id AND #__content.id = '.$id);
$section = $db->loadResult();
echo $section;
?>',3]);

Let me know if you need more information,
Thanks and cheers,
M. Ángel Velasco.
·
Thursday, 19 December 2013 21:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

The code that you have there seems to be looking up for sections on Joomla 1.5 and not EasyBlog. Am I Missing anything here?
·
Thursday, 19 December 2013 23:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark,

sorry for the delay. We where at christmas holidays.

You are write. This is a Joomla 1.5 code (We will migrate all to 3.5 this year). I was just showing you how we are passing the Custom Variables information to analytics actually.
What we need is the same thing but for easyblog tables in our joomla instalation. In order to get the author and categories information, per page.

I hope that will be enough,
contact if you have any doubt.

Thanks again,
M. Angel Velasco.
·
Tuesday, 07 January 2014 15:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Hm, I am not too sure what sort of values are you looking at and where do you want to place this?
·
Wednesday, 08 January 2014 03:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello again Mark,

what we do need is to track blog articles authors and categories, per page view. The only thing we need is 2 php variables $author, and $categorie, each time that a user visits the blog section (per page view). The values must be the same for all the different languages, and not numbers (an ID wont be useful), that's important for the categorie variable, the author always will remain the same.

As Easyblog works with different database tables, I am not sure of where to point to get that information. It's just that!... Just the query will be enough...
I think it will be easier if you have a look at the example to understand. We need the same for the values I told you above.

The code I showed you as a example is in the index file, and allow us to know $section, $category and $article for each pageview. That's the way we can join all the multilanguage information and have a global analytic.

I hope that will be clear enough information,
Thanks again,
M. Angel Velasco.
·
Wednesday, 08 January 2014 15:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

I am assuming that you are referring to the full blog entry view? If that's the case you can do something like this,


<?php
require_once( JPATH_ROOT . '/components/com_easyblog/helpers/helper.php' );

$id = JRequest::getInt( 'id' );
$blog = EasyBlogHelper::table( 'Blog' );
$blog->load( $id );

echo $blog->title;

$category = EasyBlogHelper::table( 'Category' );
$category->load( $blog->category_id );

echo $category->title;
?>
·
Wednesday, 08 January 2014 22:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark!,

Thanks for your quick response... At least I've been able to explain myself.
I've tried the code and an error occurs... The server is running PHP 5.2.10.
I've readed that launching querys to the database is a bit unsecure, but is the only way I made it work.
In the site you've got a working example, it will possibly give you the clue.

Any idea?...
Thanks and cheers,
M. Angel Velasco.
·
Thursday, 09 January 2014 16:53
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

I don't really know exactly where you placed the codes so I can't really tell what errors are you getting.
·
Thursday, 09 January 2014 17:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

the code is directly in the index.php file, as we need information of each pageview. All together with the analytics tracking code.
That is the way the previous custom variables are working. If you think there is a better way, fine... just let me know how, but we have to make sure analytics collects the results.

Thanks and cheers,
M. Angel Velasco.
·
Friday, 10 January 2014 16:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

I am really sorry but I can't really help you with this unless I have access to the site and ftp to really test this.
·
Friday, 10 January 2014 22:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok Mark!,

no problem. But remember you where unable to conect through Ftp to the site. You installed a plugin last time in order to access properly to the ftp.
I've created a superadmin user for you... Any problem please let me know.
http://www.saferain.com/administrator/, you first will need this...   User: admin Key: LyceletS@gra
With 1.5 version we had some hack issues solved this way. In the following form I add your user data.

Thanks,
M. Ángel Velasco.
·
Tuesday, 14 January 2014 16:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

I am sorry for the delay of this reply, where can I see the hacks that you have performed?
·
Tuesday, 21 January 2014 11:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark,

It´s not really a hack, just a data base query to get the info we need to include, the way we need it. That means, same result for different lenguages, as I told you already.
I haven`t touched anything about easyblog. This is the code I use for vars all the web through.
I repeat, nothing to do with easyblog. I need you to develop the easyblog part for getting the vars I told you before.

All the code is in the main template, just before the social tracking GA code:
_gaq.push(['_setCustomVar',1,'Seccion','<?php
$db = &JFactory::getDBO();
$id = JRequest::getInt('id');
$db->setQuery('SELECT #__sections.title FROM #__content, #__sections WHERE #__content.sectionid = #__sections.id AND #__content.id = '.$id);
$section = $db->loadResult();
echo $section;
?>',3]);
_gaq.push(['_setCustomVar',2,'Categoria','<?php
$db = &JFactory::getDBO();
$id = JRequest::getInt('id');
$db->setQuery('SELECT #__categories.title FROM #__content, #__categories WHERE #__content.catid = #__categories.id AND #__content.id = '.$id);
$category = $db->loadResult();
echo $category;
?>',3]);
_gaq.push(['_setCustomVar',3,'Articulo','<?php
$db = &JFactory::getDBO();
$id = JRequest::getInt('id');
$db->setQuery('SELECT title FROM #__content WHERE id = '.$id);
$article = $db->loadResult();
echo $article;
?>',3]);

Thanks again Mark,
I really though this would be much easier that what it has become, sorry about that.
M. Angel Velasco.
·
Tuesday, 21 January 2014 16:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry I need to know where did you place these codes
·
Tuesday, 21 January 2014 20:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark!,

they are in the template file.
In spanish/ extensiones -> gestor de plantillas. (template manager)
Inside there is only one template, not possible to get lost...

Thanks,
M. Ángel Velasco
·
Tuesday, 21 January 2014 20:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry!, I usually access through the administrator.

For ftp access to the file, just go to
/saferain.com/templates/saferain/index.php

I think if you access through joomla just get read of the first folder
/templates/saferain/index.php

Thanks again,
M.Ángel Velasco
·
Tuesday, 21 January 2014 21:19
·
0 Likes
·
0 Votes
·
0 Comments
·
I don't have the FTP access to the site.
·
Tuesday, 21 January 2014 21:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

I gave you a superdamin user because last times we had some trouble in order to let you access to the ftp, and you solved it installing a plugin.
I don't know what plugin was, so I asked you a couple of weeks ago to install it, in order to be able to work properly. (You did it last time)

You can edit the template anyway through template editor... in the administrator panel.
You will see all the code we have been talking about all this time.

Thank you,
M. Ángel Velasco
·
Tuesday, 21 January 2014 22:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

I am really sorry but I don't see anywhere in the code when I am editing the file through the template manager. This is what I am seeing on your site, http://screencast.com/t/rIUwfGwrtl1y . Also, editing the file there is almost impossible and I would request that you provide us with the FTP access.

I am trying to help you out of good faith but if you are reluctant to provide us with the FTP access, I am really sorry but I can't help you any further because this is just going nowhere.

Thanks for understanding.
·
Wednesday, 22 January 2014 01:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark,

first of all, we have no problem to provide you a ftp user, but in the past, you (it wasn't you, another people of your team) had some problems to access and you finally ended up installing a ftp plugin. That is why I told you to do so!... Now I have installed MijoFTP, in order to provide you full access. You can access through the component button.

The snapshot you sent to me is was the correct file, but the code is placed before the "head" closing tag. I attach a snapshot of the code of GA custom vars placed in the same file you saw yesterday. I really thought that would be a fast issue, sorry about that.

Thanks again,
M. Ángel Velasco
·
Wednesday, 22 January 2014 17:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

I am really sorry but this is not working at all as I am hitting this error:



ERROR(S)
index.php: File saving failed.


This is unfortunately going no where. I have downloaded the file and made some changes to the file with the assumption that it will work. I am sorry but I would not be able to assist you further on this if it is not working since it is so difficult to just modify a single file on the site.
·
Thursday, 30 January 2014 00:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark,

I've just tried MijoFTP component to make some changes in the index file and worked perfectly... Anyway, we are still running a 1.5 version and to make it secure we did a lot of hacks, so I believe that might be the cause of all this troubles... I feel embarrassed about all the time I made you lose, please accept my apology.

You've always behaved professionaly, and solved all the issues we had fluently, we are very happy with your support.

We will find another way to get the analytics we are looking for, don`t worry...

Thanks and cheers,
M. Ángel Velasco.
·
Thursday, 30 January 2014 22:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

No problem at all, but it's really frustrating because we are trying to help you here but on quite a number of occasions it was all failing for us because we can't write the file Does the index.php file I provided works for you?
·
Thursday, 30 January 2014 23:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark,

it does work perfectly!... Sorry, I didn't noticed the attached file.
Good job!!!

It would be possible to get authors as well? In a fast and easy way.
Otherwise forget it. If you pass me the query bit, it would be enough, the rest is the same that you've just done.

Thanks a lot!,
M. Angel Velasco.
·
Friday, 31 January 2014 16:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Miguel,

Try this file.
·
Friday, 31 January 2014 19:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Perfect Mark,

that was it... Thanks a lot!
You finally solved it.

Great job,
M. Angel Velasco
·
Tuesday, 04 February 2014 16:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

You are most welcome
·
Tuesday, 04 February 2014 17:14
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post