Public
New Commentator

Custom Java Script Tag by environment

Hi, 

We are trying to add a custom piece of javascript tag into the wrapper header to be applied to all our pages.  The problem we are having is adding a unique tag per environment.  We followed the instructions here but were stopped in our tracks when we couldn't figure out what the "number" the name was supposed to be associated with.

Really all we are trying to do is apply a 2 line javascript tag to the wrapper header per environment.

Could someone help with this?

5 Replies 5
New Commentator

Hello, does anyone have any knowledge of this?

Honored Contributor

Hi

What are you trying to add is it something that displays in stage but not in prod or vis verse ? Not sure what you mean by tag or is this some tracking/analytics tag   

I have a wrapper this is in the header which only displays in stage as it looks up “what environment am i” if prod do this if stage do that? 

Stephen

Checkout some of the stuff i've built using the platform:
Community l Ideation l Blog l Product Hubs l Check & Report l Service Status 

My latest Ideas: Vanity URL Manager l @mention Roles l  LSW Password Policy

Honored Contributor

Hi @isaac_dessert - 

Are you using the Wrapper in Studio? (found under Studio > Community Style > Wrapper > [Your skin])

If so, you won't necessarily need the custom content component code from the article you referenced. 

You can instead use something along the lines of:

<#if !config.getString('phase', '')?matches('stage')>
<script type="text/javascript" src="[YOUR CODE FILE]"></script>
</#if>

in the Studio wrapper (e.g. the Hitbox) to use different code per environment 

Hope that helps!

Hey CarolineS,

This seems to be exactly what I'm looking for.  Is there a full article on this topic that I can reference for more reading material?

Best,

Isaac

Hi Isaac,

Great, I'm glad that was helpful! This doc explains the wrapper: https://community.khoros.com/t5/Skins-and-assets/Edit-the-page-wrapper/ta-p/109069. And if you scroll down to the comments you'll see some nice relevant example code.

Cheers!

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.