javascript - How to force SSL in Google Tag Manager - Stack Overflow

Can someone tell me how to force SSL in Google Tag Manager? Google has documentation on how to force SS

Can someone tell me how to force SSL in Google Tag Manager? Google has documentation on how to force SSL for Google Analytics. But I cannot seem to find one for Tag Manager. Also, it does not look like I have access to ga object either, so I cannot set that config.

Can someone tell me how to force SSL in Google Tag Manager? Google has documentation on how to force SSL for Google Analytics. But I cannot seem to find one for Tag Manager. Also, it does not look like I have access to ga object either, so I cannot set that config.

Share Improve this question asked May 9, 2014 at 19:14 Peter HanPeter Han 5471 gold badge6 silver badges13 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

I don't know any official answer, but it should work if you change the protocol-less urls for the tag manager code to always use ssl:

<!-- Google Tag Manager -->
<noscript><iframe src="https://www.googletagmanager./ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager./gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->

See the change to the iframe source attribute and source attribute for js injection in the first and sixth line respectively to include the protocol. That is not a change that could be done via the GTM interface (since the code has to be loaded before the settings take effect).

UPDATE: I misunderstood the question (which really was how to force the Google Analytics tag inside to tag manager to SSL). This can be done in two ways, either via "set Fields" (with forceSSL als field name and true as value) or simply by checking "always use SSL" in the advanced configuration tab.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745116402a4612150.html

相关推荐

  • javascript - How to force SSL in Google Tag Manager - Stack Overflow

    Can someone tell me how to force SSL in Google Tag Manager? Google has documentation on how to force SS

    10小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信