Search

I want to insert a tracking code (not google analytics) in website ,like below:

Why it shows a piece of code directly out in the website, how can I do?

Attachments:
2015-04-20_14-29-06.png

You would add the code to your XSLT template, not through the Symphony backend. Symphony doesn't assume anything about your frontend, so there's not a place to add this information in the backend as we don't generate any frontend markup.

As such, specific information of where to place this template is a little tricky as your setup may be implemented differently. Try looking for a master.xsl template, failing that, a project search on </body> should give you an idea of where you can place the snippet.

Hope that helps!

Yes,I named a tempalte,and insert the code in this template,then call-template in master.xsl.but it is still so.

Attachments:
2015-04-20_15-03-28.png and 2015-04-20_15-02-44.png

call-template is to be used on named templates, that is e.g. <xsl:template name="track">, not matching templates that have a match and/or a mode attribute.

Pls correct me if I'm wrong :) thnx

Per your example image...

You are utilizing a xsl:template match

<xsl:template match="siteinfo/entry" mode="analytics">...</xsl:template>

So you need to utilize an apply-templates in the template you want that code to render in...

So if that template matches data then you will use...

<xsl:apply-templates select="siteinfo/entry" mode="analytics"/>

Or the template you want to put it in is matching the root node /, then you will want to use...

<xsl:apply-templates select="data/siteinfo/entry" mode="analytics"/>

@juro @bzerangue

I know what to do like you say, this is not the point of this issue. My question is, after inserting this code, The site will show a page footer section of code, and the tracking code does not take effect.

The page sources like this image:

Attachments:
2015-04-21_8-43-40.png

@nonozone - could you post your XSL templates on http://pastie.org?

The solution is to enclose the JavaScript in an <xsl:text> tag with output escaping disabled so that angle brackets are not converted into HTML entities.

http://pastie.org/10106504

Thank you, this problem was solved

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details