[SOLVED] How can I insert tracking analytics code in symphonycms?
This is an open discussion with 9 replies, filed under General.
Search
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.
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:
@nonozone - could you post your XSL templates on http://pastie.org?
@bzerangue
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.
Thank you, this problem was solved
Create an account or sign in to comment.
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?