Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: {host} Help
Status | Resolved |
Add-on / Version | |
Severity | Trivial |
EE Version |
Don Dikaio
Aug 11, 2012Hey Brian. I’ve been using your URL Helper to achieve a cool little trick for an MSM install. I use the same header and footer for all the sites but there was only on thing in the footer template that needed to be independent from all the other sites and that was the Google Analytics Domain Name. I downloaded the URL Helper and set it as so:
[removed]
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
_gaq.push(['_setDomainName', '{host}']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s[removed].insertBefore(ga, s);
})();
[removed]
All looked great! When I visited each site it showed the correct domain. Today however I found out that it also attaches the url segment that you’re currently on so instead of getting example.com across the board I would get example.comads because I was on example.com/ads. Is there a work around that I could use for this?
Thanks much!
BoldMinded (Brian)
Aug 11, 2012
I don’t see how {host} is getting appended with a segment value… but I’ll take a look at it.
BoldMinded (Brian)
Aug 11, 2012
Is it possible something else is coming into play? In my environment, with a URL of http://localhost:8888/ee/dev250/index.php/layouts/index, I get “localhost” as the {host} output, which is correct.
BoldMinded (Brian)
Aug 11, 2012
What happens if you put that {host} tag outside of the javascript and into the template somewhere else?
BoldMinded (Brian)
Aug 15, 2012
Don, what if you try this instead? https://gist.github.com/3360372
BoldMinded (Brian)
Aug 15, 2012
The Gist did the trick. Closing.