Support

Admin Tools

#9711 Redirect URLs

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Friday, 10 December 2010 11:21 CST

user20478
Hello, I'm using an extension called JoomlaWatch as a replacement for Google Analytics. It's really awesome, but it does not track outgoing URLs. I've been thinking of how to fix this, and the best way I could come up with was this:

When a user clicks an external link on my site (www.example.com/uk), I have the link go to another internal page and from there automatically redirect them to the external link. So I set up a page called www.example.com/uk/redirect, and in admin tools URL Redirection feature I made it redirect the /redirect page to the real external link.

So now when I click the link to www.example.com/uk/redirect, it redirects me to the external link I set up in admin tools, but the thing is, JoomlaWatch still doesn't track it. I think it's because the /redirect page doesn't load at all when it's done this way, am I right?

For JoomlaWatch to work it needs to load the code (I guess it's the same with Google Analytics). My JoomlaWatch code is currently in the footer, so for every page that loads the footer it shows statistics for.

Is there anyway I can achieve this, or am I in head over heels?

Appreciate any help I can get, as I really want to be able to track my outgoing links! :)

Thanks in advance,

nicholas
Akeeba Staff
Manager
Sometimes the solution to a complex problem is so simple it eludes us. Here's how Joomla! itself can help you do that without any 3rd party components.

Joomla! comes with the Weblinks component. Every link you create is assigned a Joomla! URL. Upon accessing it, the hit counter increases (it tracks clicks!) and the user is redirected to the external site. So, all you need to do is to create one Weblinks item per external link on your site and link to the Weblinks item in your content. The user clicks on the link, it calls up Weblinks, the click is tracked and the user is redirected to the external site. Simple, functional and out-of-the-box.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user20478
Wow, thanks. Don't know how I missed that component! Oh well, you learn something new every day! :)

But my problem still persists, it does not load the internal page before it redirects, so my JoomlaWatch does not track it unfortunately. :(

Do you have any other solution to this? Can I make it load the page and then redirect?

On a site note, what are you using for this site, to track traffic etc.? Any recommendations besides JoomlaWatch? Only reason I'm using it is because it's very simple, and real-time, and also straight from the admin backend.

nicholas
Akeeba Staff
Manager
I think I didn't explain it properly. Let's say you want to track links to http://www.mysite.com. First create a weblinks item. Get the URL to the weblinks item on your site, i.e. http://www.example.com/web-links/3-my-links/1-my-other-site.html. Now, replace all links to http://www.mysite.com in your content with links to http://www.example.com/web-links/3-my-links/1-my-other-site.html. This is all you have to do ;)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user20478
I'm not sure we are on the same page here :P

I'm trying to track clicks from my website to amazon.co.uk, so I created a weblink for each separate amazon link, as you described. This works great, as it tracks the clicks in the Weblinks component.

However, what I was trying to achieve was to be able to track these clicks in the same place as I track the rest of my site, in the JoomlaWatch component. And to be able to do that, the page I want to track needs to load the code I inserted in the footer for JoomlaWatch. Basically, every time the code loads another hit is registered etc.

So, right now it tracks the clicks through the Weblinks component, but not through JoomlaWatch.

Perhaps I am doing something wrong?

nicholas
Akeeba Staff
Manager
Aha! If you need to load a piece of Javascript to track the stats, there is no way you can track external links with this method. Simply put, it would only be possible if the external site included your site's tracking code.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user20478
Hmm, isn't it possible to have a separate internal page for each external link, which firstly loads the internal page and then, with the help of a php script or something, redirects to the external page? That way it would track every time someone clicks the link to the internal page (for example www.example.com/uk/amazon1 would redirect to a certain product, www.example.com/uk/amazon2 would redirect to another product etc. etc.). If this is possible I would be able to see the hits on my internal pages (www.example.com/uk/amazon1 etc.).

I know how to do this on a static website, however I am having trouble doing it inside joomla :P

By the way terribly sorry for going so much off topic, I am aware that this has nothing to do with admin tools any more, which I thought it would be when I first created the topic.

If you feel this is a discussion for another forum I completely understand! :)

nicholas
Akeeba Staff
Manager
That would be cumbersome for your visitors. Since you have to load a piece of Javascript, you have to give the page ample time to load the JS and the browser to execute it (about 5 seconds). Your user would stare at a blank or "please wait while you are being redirected" page for that long. Most of them would say "screw that, I'm closing that tab". If you want to do that in Joomla!, you can always edit your content configuration settings to not trim our Javascript and write your own delay & redirect Javascript in an article and call that article instead of the external site's URL.

Anyway, this is now drifting very far away from the scope of this support forum (we provide support our software, not Joomla! in general). Maybe you'd like to ask this question to forum.joomla.org in case someone in there knows of a better/simpler way to do that and which simply eludes me.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!