• Home
  • Get help
  • Ask a question
Last post 12 min ago
Posts last week 94
Average response time last week 34 min
All time posts 67854
All time tickets 10487
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#1047 – PHP Cookie Promo Codes URLs and SH404SEF page titles

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Wednesday, 23 September 2015 09:31 UTC
tomaszciti
Hi

We are using SH404SEf for our Joomla 3.4 site SEO.

We have an "online application form with payment" on subdomain too - this is connected with our Symfony PHP application/database; not connected in any way with our Joomla site apart from links to online forms that are on Joomla pages.

main site - www.xxxx.com
application form subdomain - apply.xxxx.com; one of online forms URL https://apply.xxxx.com/apply/cc/r1

We would like to introduce Promo Codes (discount codes) for our customers and wrote a short PHP code to create a cookie and then "pass it" to online applications (hosted on subdomain).
The code is loaded by including it in template.php file and is working fine. Example of Promo Codes appended to URLs - "?m=E531068C" or "?m=P843776B"

All our Joomla pages have Custom Page Titles and meta descriptions set using SH404SEF "Title and metas manager" feature.

The problem we are facing is that after Promo Code is appended to URL, the page title and meta descriptions “go” to default, instead of custom set page titles and meta descriptions via SH404SEF), eg:

Example 1:

main URL without promo code - http://www.xxxx.com
custom page tile - “CitizenCard – UK Photo ID card” - set via SH404SEF

URL with promo code - http://www.xxxx.com/?m=E531068C
The page title “Home”, default page title generated by Joomla

Example 2:

URL without promo code - http://www.xxxx.com/what-is-a-citizencard
custom page tile - “What is a CitizenCard? - UK photo ID card” - set via SH404SEF
meta description set via SH404SEF - "CitizenCard is an official UK photo ID and proof of age card. Card displays police and SIA logos. PASS hologram endorsed by Home Office, retailers, airlines."

URL with promo code - http://www.xxxx.com/what-is-a-citizencard?m=P843776B
The page title “What is a CitizenCard?”, default page title generated by Joomla
meta description - "CitizenCard - official UK photo ID and proof of age card. Trusted identity cards since 1999 bear Home Office and police-approved PASS hologram." - default by Joomla

How do we make URLs with appended Promo Codes to use page titles and meta descriptions set by SH404SEF?

Any help would be greatly appreciated.

Thank you
Wednesday, 23 September 2015 10:31 UTC
wb_weeblr
Hi

Yes, all meta data is internally attached to the non-sef URL, so if you modify on the fly the non-sef URL (by adding the promo code in it) then the requested URL and the meta data identifier don't match anymore.

Right now I don't see any "good" solution. What I can think of is:

1 - modify one sh404SEF file to include your variable to the list of variables that must be stripped from non-sef:
in /administrator/components/com_sh404sef/configuration/configuration.php, around line 29:
/**
	 * List of tracking vars that should be removed from url when calculating canonical url or similar
	 * Note: 'hitcount' is introduced internally by Joomla! 3 vote plugin!!
	 * @var array
	 */
	private $_trackingVars = array('utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_id', 'utm_campaign', 'gclid', 'fb_xd_bust',
		'fb_xd_fragment', 'hitcount');
Change it to:
/**
	 * List of tracking vars that should be removed from url when calculating canonical url or similar
	 * Note: 'hitcount' is introduced internally by Joomla! 3 vote plugin!!
	 * @var array
	 */
	private $_trackingVars = array('utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_id', 'utm_campaign', 'gclid', 'fb_xd_bust',
		'fb_xd_fragment', 'hitcount', 'm');


Unfortunately, you would have to do that change again after all update of sh404SEF.

2 - An alternative, but rather shaky option would be to change the name of your variable 'm' to one of those we already exclude. You can find the list in the above code snippet. utm_source, utm_medium, and all utm_* are used by Analytics when using also Google adwords, so you can't use them if you plan to track Google adwords. The others, maybe an option, at least until a better one exist.
I can't add such parameter in the upcoming next release of sh404SEF, it's too late, but maybe in a future one.

Rgds
 
Wednesday, 23 September 2015 13:11 UTC
tomaszciti
Hi

Many thanks for quick reply.



Change it to:

/**

* List of tracking vars that should be removed from url when calculating canonical url or similar

* Note: 'hitcount' is introduced internally by Joomla! 3 vote plugin!!

* @var array

*/

private $_trackingVars = array('utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_id', 'utm_campaign', 'gclid', 'fb_xd_bust',

'fb_xd_fragment', 'hitcount', 'm');



This looks like a good solution for us. I would remember to update it after SH404SEF update.

I have added our tracking var 'm' like you suggested, saved the file, cleared Joomla cache, but for some reason it's doesn't work - custom page titles and meta descriptions don't work - go to default. Is there maybe another file I should update?

I can confirm that I tested other variables listed above like 'utm_source' and 'hitcount' and all is well with them. So I hope this could work for us.

Thank you again.

Wednesday, 23 September 2015 13:27 UTC
wb_weeblr
Hi

What could cause that is that you have "Remote configuration" enabled. This would cause the PHP-file default values to be overriden by the online ones.

So you should disable remote configuration, and also go to "Clear cache" under the Joomla System menu and delete the "sh404sef_rconfig" item. You probably have to do that on both the "Site" and "Administrator side of the Clear cache function.

Let me know.

Rgds
 
Wednesday, 23 September 2015 14:31 UTC
tomaszciti
Hi

I think the problem was Remote Configuration. I have disabled it and now the issue is partially solved.
Got Promo Codes URLs for most pages working with custom page titles and meta descriptions.
There are 2 problems now:

1) Home Page - the most important one

Home Page page title still defaults to "Home" instead of "CitizenCard - UK Photo ID card and Proof Of Age" when Promo Code is appended eg.

http://www.xxxx.com/?m=foo

The same issue occurs with other variables like http://www.xxxx.com/?utm_source=foo

2) Strange issue occurs with http://www.xxxx.com/online-application URL which is assigned to "Application" category.

When Promo Code is appended to it - http://www.xxxx.com/online-application?m=foo
the page is redirected to http://www.xxxx.com/Application/?m=foo
which is a "Category" page.

Many thanks for helping us


Wednesday, 23 September 2015 15:07 UTC
wb_weeblr
Hi

1 - I think we may have improved that home page detection. Can you download and install the dev version xxxx? If that still doesn't (and yes, you will have to apply the changes to the strip var list again!), I will have to look further.
Currently, my testing shows that site.com/?utm_source=xx works fine and return the custom meta data and title on home page, so I think that shouldn't be a problem (https://weeblr.com/?utm_source=12 for instance).

2 - I assume you have searched all aliases for "online-application"?

Rgds
 
Wednesday, 23 September 2015 15:56 UTC
tomaszciti
Hi

Thank you again for quick reply.

1. You have improved home page detection in 4.7.0.2893 version :-)
It works now. Is it stable for production as I tested it on dev server? If not when we could expect production release, please?

2. I sorted issue with "online-application" by deleting some old duplicates.

And my comment re "Your 404 error page is not configured properly." new notification feature in Control Panel if I may....

The issue with 404 page generated by SH404SEF is that it can be found by Joomla site Search.

eg.

https://weeblr.com/search?searchphrase=all&searchword=clicked%20to%20arrive

I have archived "sh404SEF custom content" Category to prevent this. The 404 page still works and it can't be found by Joomla site Search. But now I'm getting "Your 404 error page is not configured properly." which is not a problem, but I think it might be helpful for you to know about it.

One more time thanks for helping.
Thursday, 24 September 2015 08:53 UTC
wb_weeblr
Hi

Glad you got most of it sorted out. Indeed, there's no way to prevent Joomla from showing the 404 in search results, which is bit of pain.
I will revisit the matter today, we have an upcoming release and I might be able to sneak in some improvement there, including possibly setting the 404 article as archived as default.
This causes a usability issue on multilingual sites, where users are supposed to create themselves copies of the article in other languages, so they might struggle to find their article if they are with the Archived status. Likewise, on the front end, the article(s) will actually be showing on the archive pages - which of course are used much much less often than search, so that's still a good trade off.

I'll get back to you soon about this...

Cheers

 
Thursday, 24 September 2015 10:48 UTC
tomaszciti
Hi

Just a small clarification - If I remember correctly (I did it a year ago) if you archive SH404SEF 404 page it doesn't work at all.

But if you archive "sh404SEF custom content" Category the 404 page works fine and it's not displayed by Joomla site Search.

Please see attached screenshots.

The result:

404 working eg - http://www.xxxx.com/ddaaa

search for phrase from 404 page no results - http://www.xxxx.com/search-results?searchphrase=all&searchword=despite%20our%20computers%20looking

Hope this helps.
Thursday, 24 September 2015 10:53 UTC
wb_weeblr
Hi

Indeed. I was working on this right now, and found that archiving the article didn't work (because the article is not available any longer).

That's probably actually a bug in Joomla, as an article in an archived category should not be displayed, but for now it should help my case ;)

Aside from archiving, I have not found any actual, or rather short-term solution for this problem. The actual solution is to change the way 404 page is stored and displayed (do not make it a Joomla article, but instead display it myself).
There are multiple drawbacks to that, and it'snot something that can be done right away, as it involves many changes. It'll probably gets in only after I have split the Joomla 2 and Joomla 3 versions entirely, which should be soon anyway.

Thanks for your insights in this.

 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.