What is window.ENV in Google Tag Manager (GTM)? - google-tag-manager

I am seeing reference of window.ENV in GTM's custom HTML code. Where is this defined? Is this part of any configuration?

Related

Adding Programmable Search through Tag Manager

Is there a way to add the following script, required by Google Programmable Search to Google Tag Manager? Just trying to minimize separate scripts included in my code.
<script async src="https://cse.google.com/cse.js?cx=e14513e5d62xxxxxx"></script>
NM, figured it out. In case someone cares, here's how you do it:
Keep the code part where you want to include your search in the page code.
The above script can be added to GTM via Custom HTML tag. Just drop it there and it's done.
Cheers

Is there a way to get Content Security Policy 2 to work with Google Tag Manager?

I added the Content-Security-Policy header to our servers' responses, but the browser throws errors when Google Tag Manager (GTM) injects Custom HTML tags.
CSP3 has 'strict-dynamic' which appears custom-made for GTM, but currently only Chrome supports it, and CSP3 is a Working Draft.
I wrote code to get the Custom HTML tags via the GTM API, hoping I might take the scripts' hashes and add them to the header, but I found that the JavaScript provided by the API didn't match what GTM was injecting into the DOM, because GTM minifies/obfuscates the scripts before injecting them.
Now I'm wondering if maybe, just maybe, there's a way to tell GTM to add a nonce to each script it injects, but I can't find any documentation to support this hope/fantasy.
Has anyone run into this, and found a way to fix this?
(I can't just extract the hosts from the scripts as mentioned here - How to make Google Tag Manager and Content-Security-Policy coexist? - because the Custom HTML tags added by our Marketing Team are tags with non-empty bodies, not just tags with a source attribute and no body.)

Google tag manager adding async scripts in to head of page

I've recently moved some of our scripts into Google tag manager via Custom HTML with a document with write enabled. However, most, if not all scripts are being added to the head of the page as a async script.
For example:
<head>
<script async type="text/javascript" src="https://www.externalSite.co.uk/visitor.js?mhRand=1513770036670"></script>
</head>
Why are these being added to the head of the site, instead they should be loaded at the bottom of the page?
Am I missing a setting somewhere within GTM?
All Tag Manager Tags are loaded Async so no need to specify it.
You can not use the labels on the HTML Tag.
Since you can not control that i ll be load on the header you might want to do it as soon as possible. In order to do this just use a pageview trigger and firing priority. If any resourses depended on this script here is a nice post.

DOXFX using Application Insights end-user user analytics

How can you add Application insights end-user user analytics to DocFx to track the usage of every documentation page?
The Application Insights documentation states you need to insert the JavaScript snippet listed below immediately before the closing tag, but I'm not sure if this is possible in DocFx or the best way to accomplish.
Would you need a postprocessor, or could you use a custom template?
<!--
To collect end-user usage analytics about your application,
insert the following script into each page you want to track.
Place this code immediately before the closing </head> tag,
and before any other scripts. Your first data will appear
automatically in just a few seconds.
-->
<script type="text/javascript">
var appInsights=window.appInsights||function(config){
function i(config){t[config]=function(){var
i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
}({
instrumentationKey:"###-###-###-##"
});
window.appInsights=appInsights;
appInsights.trackPageView();
</script>
No PostProcessor is needed. You can achieve this by customizing the template. More information can be found in official tutorial or this question. You can add your code in partials/head.tmpl.partial. It will affect all the generated page.

How to acquire request parameter from url from Oracle Porta HTML Page Skin?

I hope any of Oracle Portal experts here could help me out regarding this question.
I have a portal template/page that is using a HTML Page Skin. The skin may looks like:
<html>
<head>
<title>#TITLE#</title>
</head>
<body>
#BODY#
</body>
</html>
By using Oracle Portal, I could add portlets (PL/SQL and Java portlet) to the body section, in its respective template/page. However there is no way that I am aware of that could enable me to add portlets to other section in the HTML Skin, eg in section.
I need to dynamically change the title with some value that I get from the page URL and query string.
eg. if the page's url is http://www.example.com/portal/page/portal/examplepagegroup/page1?param1=paramvalue
so that the title will be 'param1', and it should be done without javascript technique.
How could I get the request parameter param1 from the URL so that it will be available to the head section? I am thinking of PL/SQL code to be used here, but, I do not how to access query string of current page.
Please comment here if clarification to the question is needed. Thanks.
The page title is a static attribute of the Portal page. There is no supported way for a portlet to change the page title dynamically at runtime. The rendering engine combines the HTML from each portlet with some HTML it builds itself, and the title is part of what the renderer builds.
What is possible is to dynamically build pages with specific names by calling WWSBR_API.ADD_FOLDER (a folder is the same as a page). See So your portlet could build a page and then redirect to it.
You find the Portal 10.1.4 API at http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html

Resources