Track registered users content in google analytics - Joomla 2.5 - joomla

I have a Joomla 2.5.9 website and I need to track what content has been read by registered users (it's a training program website).
For that, I tried to create a custom variable in Google Analytics as follows:
/ set custom variables
_gaq.push(["_setCustomVar", 1, "RegisteredUsers", "{UserName}", 1]);
// track page view
A custom variable was in fact created in GA but it is useless: it just gives me the number of page views of all users.
Does anyone know how to fix the code above so I can see what pages registered users have seen?
Thanks!

I think the easiest way is add check for logged in users in template:
if (!JFactory::getUser()->guest)
{
JFactory::getDocument()->addScriptDeclaration("
_gaq.push(["_setCustomVar", 1, "RegisteredUsers", "{UserName}", 1]);
");
}
depends how you add Google Analytics tracking code (using JDocument methods or as raw template html) but concept is same.

Related

Where to add Google Remarketing tag in Magento

I am trying to figure out in which file I need to add the Google remarketing tag. I know it needs to be added before the closing of the body tag. Can anyone point me in the right direction?
Thanks
here is I did in the past:
Depending on what kind of google tracking you are using you have a few different way to use:
1) If only add a custom code and should be in all the Magento page, use the "Miscellaneous Scripts" value going to admin section, System > Configuration > Design > HTML Head - Miscellaneous Scripts. (This will be included before head closing tag in page HTML.)
2) By native Magento already have Google Analytics tracking code and you can find this configuration going to admin section System > Configuration > Google API - Google Analytics.
3) If you are looking something more complex and use the Google adWords I used the extension magento connect link. For a particular Client I did some extra modification to include some extra code if a client subscribe to newsletter or a new client etc.
I hope you can find something helpfully in the post.
Best,
GrinGo.
There are different template file for different pages in magento so at first I think you should decide where to place it.For example if you want to place it in footer than you should place that code snippet in
"app/design/frontend/base/default/page/html/footer.phtml"
Similarly you can check other different template files to place your code.
NB:Best practice is to overide the core file of magento before making changes to it.
Hope this will help.
There's no indication as to which Magento version you're using 1 or 2. At the end of the day it depends how much technical knowledge you have and if you're using a version control system to manage your Magento build.
Miscellaneous Scripts as another answer mentioned earlier, this approach is straight forward and very easy to use to plug and play your code.
Google Module depending which version of Magento you use (CE/EE) there will be a built-in section for you to plugin your account ID in backend Magento configuration and then the platform will generate necessary code for you.
Write custom module by writing your own module you can place it the snippet anywhere on the page by targeting before_body_end node in your layout XML file. This is more technical but gives you more control over what you can do.
Google Tag Manager this also depends on if your Magento version comes pre-built with Google Tag Manager module, then you can create a container and place all your logic in there. This is also more technical and require the output of some values in JS format on the frontend to let GTM read the values.
At the end of the day go with what is easy to setup, portable and easy to manage. I usually go with Google Tag Manager as it takes time to create initial setup of exposing data on the frontend but then I have full control of what I want to do with that data through tag manager. In most cases you'll end up using the same data (ex. totals, shipping method, product IDs, SKUs, cost, etc.) in more than one third party API so this gives you flexibility to do just that.

How to integrate Magnolia CMS with Spring app in limited range

I have a question to Magnolia CMS (integrated with Spring) users.
I have to write e-shop integrated with CMS where we can divide all pages into two categories:
Edited and added by admin
static pages like user account settings, shopping cart etc.
First ones, must be totally customizable by admin - I mean, admin must be able to create his own template, add text areas or graphics/video whenever he wants. He also must be able ( this is very important) to create new products which must be also stored in db to be accessible for the application code ( to fill the products list by myself in the code or to set the prices on the static admin pages).
So user can add as many products as he would like, create separate template for some of them and I have to be able to search for this products in db ( for example when user try to use search criteria). The search panel must be created by me - but where admin will place it is up to him.
The second type of pages are static pages done in JSP and I do not expect to change it using CMS.
As the second type of pages is of course not a problem, I do not know what CMS solution I should use for first type of pages.
I thought about Magnolia CMS, but as I can see all templates must be created by programmer in the code.
Also I'm not sure if it's possible to implement mechanism to maintain products ( inside the e-shop) - from one hand admin must be able to add templates for them in CMS, but I must be able to access them from the code ( to maintain them at shopping cart, make invoice etc). The product prices are set from admin panel ( static pages) as well- not from CMS of course. Maybe I can add any single product at the static pages ( insert it into the db) and somehow connect CMS page with it ?
I also need to add that main page template must be designed by HTML designer, so perhaps it would be plain HTML and this main template would be updated due to the admin needs in CMS.
Cloud anybody please advice me the best CMS solution where I can achieve all this ?
Best Regards
I've seen fair number of shops implemented that way with Magnolia where you use spring & web flow to manage a shopping cart and checkout process, while letting editors to create & customise products & categories & promos available in the shop.
You can also get similar (w/o spring) integration just by installing shop module of Magnolia. It's product and product category management might come in handy even if you were to replace checkout by your own.
To answer the other questions and stipulations
you can write your templates in ftl and models in groovy and have those hosted inside of the repository, thus giving access to them to editor and allowing her to change whatever needs to be changed. However there is also danger in that since templates are responsible for generating html, editor might be able to break html layout by making changes directly to the templates. While you want editor to create new products and modify existing ones, Magnolia lets you separate template of products from the content of products so you can let editor to edit just all the fields that you deem editable for given product without having her to ever access html or ftl directly.
as you mention, html will come from designer, so what you pbly want is to take that html, break it into functional blocks that repeat in multiple pages, save it as ftl templates and replace sample text in there with FM tags to retrieve such data from Magnolia. Actually, even better, download the STK static prototype and hand it over to your graphic designer. Tell her to create design by changing css/js/images only, but not to change structure of the html itself in the prototype, then you can truly just drop in css/js/img provided back to you by the designer.
regarding static pages - you can always serve them from Magnolia even if you don't expect anyone to ever edit them (since it usually happens sooner or later that someone wants to edit them) or you can simply configure bypass for the url for such pages and have Magnolia ignore them so they can be served by underlying application server container
to bring in Spring based application, you might consider looking in more details at and using Magnolia's Blossom module which will in turn let you annotate your spring controllers to be treated as Magnolia templates to make integration even more simple.
HTH, Jan

How do I create/obtain a permalink to user profile in Joomla?

I have just migrated a lot of content from an old webpage to a 2.5 Joomla website. Almost every imported page contains a contact detail of one person from a 3-10 people pool.
I would like to define these contacts as Joomla contacts and just simply link to these profiles from every page.
How do I find or create a permalink to these user profiles?
I don't know of a native Joomla way of doing this, but due to the frequent ugliness of Joomla urls, we use YOURLS as an all-around link shortener on all of our sites. It comes with a front end that users are able to create their own links, etc., but we just use the mechanism, and some of the other features on the admin site of things - the mechanism itself is quite straightforward and easy to use once you create one to see what needs to be in the database for it to do it's magic.

Is it possible to display and search data using orchard cms from an external datasource?

I'm just starting to play around with Orchard CMS. I like what I see so far, but I need to be able to create pages that display record details for data stored in another system. Does any one know if that is possible?
I have a SQL Server database that hold real estate property record information. This information gets displayed on the web. On that same website are informational content pages (FAQs, Contact Us, Home, etc...) What I would like to to is leverage the CMS portion of Orchard for the content pages. Then I would like to write a module using the Orchard that would get the real estate info, allow users to search parcels, and display detail pages for each parcel.
If you view the site http://www.sc-pa.com/search you can search by last name "smith" and select one record. That may help illustrate what I need Orchard to do.
Yes, that is possible, but your scenario is way too vague to get into any specifics. Can you elaborate on exactly what you are trying to do: what does the external data look like, where is it stored, how do you want to integrate it into Orchard, do you need any integration with content types and parts, or with search, etc.
One alternative is to expose ur data as web service or odata endpoint and then use jquery to do asynch call to get json data. Then ur home free.
Create a page and put the javascript in that or include a ref to js file.

How to create my own form in joomla

I want to create my own form that are submitted and values of that form will be stored in joomla database. How can i used the Joomla connection code to interacte with the joomla database.
If you just want to get your work done, there are some components already avaiable in Joomla Extension's website to your form's needs. CkForms is a good one, you can create simple forms with it that are automatically saved in the database (supports upload of files too).
If you want to learn how to write extensions in Joomla, you should read Joomla Official Documentation website.
Extensions in Joomla are divided in "Components", "Modules" and "Plugins". More informations about these differences can be found here and here.
What you're trying to achieve sounds a "component" to me. Downloading the CkForms and reading it's source code should get you started to Joomla's way of writing components.
EDIT: Joomla has a huge API with a lot of features. It has a database module of it's own, with insert methods and such. Reading Joomla's API website before implementing your component it's a good idea to avoid "reinventing the wheel" and it's a good practice since those methods are extensively tested by all Joomla users.
The JForm class helps you build forms.
Documentation can be found here:
joomla CMS: http://docs.joomla.org/API16:JForm
joomla API: http://api.joomla.org/11.4/Joomla-Platform/Form/JForm.html
This class provides you with ready to use form elements and form loading and/or processing methods
This class includes validation methods, date picker control, color picker, etc.
Of course, as another mentioned above, if you are building a module, component, or application, you will need to learn how to to develop a module, component or application. Of these three, the module is the easiest to implement.
The application gives you much freedom b/c you are not constrained to the CMS paradigm, front and back end complexities. However, there is little documentation about how to develop applications with Joomla framework b/c joomla as a framework is relatively new
This tutorial gets you started understanding how to use JForm to create a form in Joomla: http://www.ostraining.com/blog/how-tos/development/getting-started-with-jform/
Or you could just create add a html module to any position and then write the form in html i.e.
<form method="post" action="mycreatedpage.php"> <input type="text"/> <input type="submit">
Now just create a page that handles the code by emailing or inserting into db. I havent tried it but i think it should work.
Looks like everyone already told you almost everything I know except for the component creator. Very easy to use, and it follows Joomla standards. Will get you up and running within minutes.
I have got good working experience with Joomla RSForm Pro. It has got options for
validation
user email/admin emails on submit
file uploads
and many more
Good tutorials too. Get started with http://www.rsjoomla.com/support/documentation/view-knowledgebase/21-rsform-pro.html
Good luck!
Create View.
Create Model.
Create Table.
Create Controller ( if Needed ).
Create Form xml file.
Go here for more information:
http://docs.joomla.org/Standard_form_field_types
Take a look at the Chronoforms extension - does more than you want.
You have two options:
Use an already built custom form extension
Create your own custom form extension (or outsource it)
Now if you only want to modify the user registration form, then you can do some PHP customization to accomplish your goal.
Making forms in Joomla can be done in a couple of ways.
If you just wanted a contact us, you can just create a page with a menu item for the User contact form. This gives you a page with a Members address and contact form. So all you would need to do was add the user as the company of the websites home address and email. But the form is very basic, name, title, textarea for message.
Next up from that you could just make a Custom HTML module add add a form to it in plain HTML like +Sean said above this, you would need to code in PHP your own form process script. You would not get error in form data checking unless you also wrote it.
Next you might rather look on the Joomla Extension Directory JED for one of the good extensions for 3 and 2.5 Joomla RSForms!Pro is good, and can do all we have needed. This lets you add fields one by one and move your form around. Then can auto generate or custom the html of the form.
You can easily create your own forms with Fabrik
Chronoforms are now a days a very popular solution for custom forms in joomla. Chornoforms support twitter bootstrap also. In simple 5 steps you can create a contact form with unlimited fields and also embed various function like DB save, Email, Thanks Message, Redirection on any page. There is events and events will have particular events.
Also possibility of extension of Normal joomla registeration. It will not extend the core registration but at the time of registration you can take various information from users.
I would use Chrono Forms, they work really well and are easy to use.
Download here
Here is a full tutorial on the new Chronoforms 5 to help you get started quickly and understand most of the features available.
CLICK HERE
You can use plugin to insert external php form in content. It is easy and you don't need to make plugin etc. Please use this.
I suggest you to use breezingforms: http://crosstec.de/en/extensions/joomla-forms-download.html
It's one of the best solutions for custom form creation in joomla.

Resources