I have a function to remove special characters but it's not working...not sure why. Can anyone help?
Code:
<script type="text/javascript">
function removeSplChars(inStr) {
inStr = inStr.replace(/[^a-zA-Z0-9 ]/g, "");
return inStr;
}
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-33021136-1']);
removeSplChars('Kitchen Tools', 'Textiles', 'Chef's Apron', '');
_gaq.push(['_setCustomVar',
2, // This custom var is set to slot #2.
'Kitchen Tools', // The top-level name for your online content categories.
'Kitchen Tools|Textiles|Chef's Apron|', // Records value of breadcrumb name
3 // Sets the scope to page-level.
]);
_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.parentNode.insertBefore(ga, s);
})();
</script>