谷歌标签管理器支持

Zendesk has two versions of the Web Widget (Classic) snippet. You can use either the legacy or new snippet withGoogle Tag Manager(GTM).

If you're setting up the Web Widget with GTM for the first time, we recommend using the new snippet and following the procedure outlined below.

Adding the Web Widget (Classic) via Google Tag Manager

If you're using the new snippet, follow the steps in this section to get the widget working in GTM.

The new snippet looks as follows:

             
<scriptid="ze-snippet"src="https://static.zdassets.com/ekr/snippet.js?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">script>

To get the Web Widget (Classic) working in GTM:

  1. Create a newCustom HTML Tagin GTM.
  2. Sign in to your Zendesk Support account as an admin and go toAdmin > Channels > Widget.
  3. Select theSetuptab and copy the snippet code.
  4. Edit新标签粘贴复制的代码片段在the HTML textbox.
  5. Configure theFire On stepto run whenever you'd like on your website.

Adding the Web Widget (Classic) via Google Tag Manager (legacy snippet)

If you're using the legacy snippet, follow the steps in this section to get the widget working in GTM.

The legacy snippet looks as follows:

             
<script>/**/window.zEmbed||function(e,t){varn,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(e){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){vare=this.createElement("script");n&&(this.domain=n),e.id="js-iframe-async",e.src="https://assets.zendesk.com/embeddable_framework/main.js",this.t=+newDate,this.zendeskHost="{{zendeskSubdomain}}",this.zEQueue=a,this.body.appendChild(e)},o.write(''),o.close()}();/*]]>*/script>

Where{{zendeskSubdomain}}is your host e.g.subdomain.zendesk.com.

If you're configuring your GTM with the widget for the first time and are experiencing difficulty loading the widget, we have found that using the new snippet mentioned above may help.

To get the Web Widget (Classic) working in GTM:

  1. Create a newCustom HTML Taginside GTM.

  2. Editthe new tag and paste the following code in the HTML textbox:

                   
    <script>window.zEmbed||(function(){varqueue=[];window.zEmbed=function(){queue.push(arguments);};window.zE=window.zE||window.zEmbed;document.zendeskHost='{{zendeskSubdomain}}';document.zEQueue=queue;})();script><scriptsrc="https://assets.zendesk.com/embeddable_framework/main.js"data-ze-csp="true"asyncdefer>script>

    Where{{zendeskSubdomain}}is replaced by your host e.g.subdomain.zendesk.com.

    Note: Please preserve the extra attributes as they're needed for GTM support to function correctly.

  3. Configure theFire On stepto run whenever you'd like on your website.