Mailing List Archive

Tracking Codes and Java Script
I was wondering if there was a simple and systematic way to configure a
tracking code into Forrest, for every page.

So for a concrete example I would like to add a
Google Analytics tracking code to the bottom of each page.

Currently I am having to do this by modifying files in the Forrest
directories.
(This works file with the exception that I have 2 forrest project and I have
to keep remembering to change these files...)

I would like to just be able to specify a tracking code and style or
possibly an html/javascript segment,
in a Config file such as site.xml or something like that.


Bryce
RE: Tracking Codes and Java Script [ In reply to ]
Bryce,



I think this will work.



You could add the google analytics code in the <xsl:template match="site"/>
of the common skin file 'site-to-xhtml.xsl' in the directory
'main\webapp\skins\common\xslt\html' with a variable for the tracking site
ID hat will come from the skinconfig.xml file. Then put your tracking site
ID in the skinconfig.xml file on some new created element and modify the
'skinconf.xsl' in the directory 'main\webapp\skins\common' to make sure that
you handle defaults properly.



Steve



From: Bryce Alcock [mailto:u912boilermaker@gmail.com]
Sent: Monday, September 20, 2010 3:01 PM
To: user@forrest.apache.org
Subject: Tracking Codes and Java Script





I was wondering if there was a simple and systematic way to configure a
tracking code into Forrest, for every page.



So for a concrete example I would like to add a

Google Analytics tracking code to the bottom of each page.



Currently I am having to do this by modifying files in the Forrest
directories.

(This works file with the exception that I have 2 forrest project and I have
to keep remembering to change these files...)



I would like to just be able to specify a tracking code and style or
possibly an html/javascript segment,

in a Config file such as site.xml or something like that.





Bryce
RE: Tracking Codes and Java Script [ In reply to ]
Bryce,



I think this will work.



You could add the google analytics code in the <xsl:template
match="site"/> of the common skin file 'site-to-xhtml.xsl' in the
directory 'main\webapp\skins\common\xslt\html' with a variable for the
tracking site ID hat will come from the skinconfig.xml file. Then put
your tracking site ID in the skinconfig.xml file on some new created
element and modify the 'skinconf.xsl' in the directory
'main\webapp\skins\common' to make sure that you handle defaults
properly.



Steve





From: Bryce Alcock [mailto:u912boilermaker@gmail.com]
Sent: Monday, September 20, 2010 3:01 PM
To: user@forrest.apache.org
Subject: Tracking Codes and Java Script





I was wondering if there was a simple and systematic way to configure a
tracking code into Forrest, for every page.



So for a concrete example I would like to add a

Google Analytics tracking code to the bottom of each page.



Currently I am having to do this by modifying files in the Forrest
directories.

(This works file with the exception that I have 2 forrest project and I
have to keep remembering to change these files...)



I would like to just be able to specify a tracking code and style or
possibly an html/javascript segment,

in a Config file such as site.xml or something like that.





Bryce
Re: Tracking Codes and Java Script [ In reply to ]
Ok so far so so...
I have added the Tracking JavaScript to the site-to-xhtml.xsl file. And
that seems to be working fine.
I have added the variable to my skinconfig.xml file in the project
directory, And finally I have been looking
at how to pull the variable out of the skinconfig.xml and use it in the
site-to-xhtml.xsl as a variable.


However, when I go to build the site I get the following Error:

validate-skinconf:
/home/bryce/repos/brycealcock/
brycealcock.com/src/documentation/skinconf.xml:64:21: Element type
"project-tracking" must be declared.
/home/bryce/repos/brycealcock/
brycealcock.com/src/documentation/skinconf.xml:438:14: The content of
element type "skinconfig" must match
"(search?,disable-print-link?,disable-pdf-link?,disable-pod-link?,disable-txt-link?,disable-xml-link?,disable-external-link-image?,disable-compliance-links?,obfuscate-mail-links?,obfuscate-mail-value?,disable-font-script?,project-name?,project-description?,project-url?,project-logo,group-name?,group-description?,group-url?,group-logo?,host-url?,host-logo?,favicon-url?,disable-copyright-footer?,year?,vendor?,copyright-link?,trail?,toc?,headings?,feedback?,motd?,extra-css?,colors?,pdf?,credits?)".

BUILD FAILED


So it is obviously getting validated against a DTD or something, and does
not like the fact that I added the
<project-tracking>PCDATA</project-tracking>

So I need more help.

Bryce


On Tue, Sep 21, 2010 at 7:49 AM, Steve Wolke <Swolke@roughbros.com> wrote:

> Bryce,
>
>
>
> I think this will work.
>
>
>
> You could add the google analytics code in the <xsl:template
> match="site"/> of the common skin file ‘site-to-xhtml.xsl’ in the directory
> ‘main\webapp\skins\common\xslt\html’ with a variable for the tracking site
> ID hat will come from the skinconfig.xml file. Then put your tracking site
> ID in the skinconfig.xml file on some new created element and modify the
> ‘skinconf.xsl’ in the directory ‘main\webapp\skins\common’ to make sure that
> you handle defaults properly.
>
>
>
> Steve
>
>
>
>
>
> *From:* Bryce Alcock [mailto:u912boilermaker@gmail.com]
> *Sent:* Monday, September 20, 2010 3:01 PM
> *To:* user@forrest.apache.org
> *Subject:* Tracking Codes and Java Script
>
>
>
>
>
> I was wondering if there was a simple and systematic way to configure a
> tracking code into Forrest, for every page.
>
>
>
> So for a concrete example I would like to add a
>
> Google Analytics tracking code to the bottom of each page.
>
>
>
> Currently I am having to do this by modifying files in the Forrest
> directories.
>
> (This works file with the exception that I have 2 forrest project and I
> have to keep remembering to change these files...)
>
>
>
> I would like to just be able to specify a tracking code and style or
> possibly an html/javascript segment,
>
> in a Config file such as site.xml or something like that.
>
>
>
>
>
> Bryce
>
RE: Tracking Codes and Java Script [ In reply to ]
Bryce,



You can turn off validation of the skinconfig.xml in the forrest.properties
file like the following



##############

# validation properties



# This set of properties determine if validation is performed

# Values are inherited unless overridden.

# e.g. if forrest.validate=false then all others are false unless set to
true.

forrest.validate=true

#forrest.validate.xdocs=${forrest.validate}

forrest.validate.skinconf=false

#forrest.validate.sitemap=${forrest.validate}

#forrest.validate.stylesheets=${forrest.validate}

#forrest.validate.skins=${forrest.validate}

#forrest.validate.skins.stylesheets=${forrest.validate.skins}







Then to get your property you can just call



<xsl:value-of select='//skinconfig/project-tracking'/>









From: u912boilermaker@gmail.com [mailto:u912boilermaker@gmail.com] On Behalf
Of Bryce Alcock
Sent: Friday, September 24, 2010 1:30 AM
To: user@forrest.apache.org
Subject: Re: Tracking Codes and Java Script



Ok so far so so...

I have added the Tracking JavaScript to the site-to-xhtml.xsl file. And
that seems to be working fine.

I have added the variable to my skinconfig.xml file in the project
directory, And finally I have been looking

at how to pull the variable out of the skinconfig.xml and use it in the
site-to-xhtml.xsl as a variable.





However, when I go to build the site I get the following Error:



validate-skinconf:

/home/bryce/repos/brycealcock/brycealcock.com/src/documentation/skinconf.xml
:64:21: Element type "project-tracking" must be declared.

/home/bryce/repos/brycealcock/brycealcock.com/src/documentation/skinconf.xml
:438:14: The content of element type "skinconfig" must match
"(search?,disable-print-link?,disable-pdf-link?,disable-pod-link?,disable-tx
t-link?,disable-xml-link?,disable-external-link-image?,disable-compliance-li
nks?,obfuscate-mail-links?,obfuscate-mail-value?,disable-font-script?,projec
t-name?,project-description?,project-url?,project-logo,group-name?,group-des
cription?,group-url?,group-logo?,host-url?,host-logo?,favicon-url?,disable-c
opyright-footer?,year?,vendor?,copyright-link?,trail?,toc?,headings?,feedbac
k?,motd?,extra-css?,colors?,pdf?,credits?)".



BUILD FAILED





So it is obviously getting validated against a DTD or something, and does
not like the fact that I added the

<project-tracking>PCDATA</project-tracking>



So I need more help.



Bryce





On Tue, Sep 21, 2010 at 7:49 AM, Steve Wolke <Swolke@roughbros.com> wrote:

Bryce,



I think this will work.



You could add the google analytics code in the <xsl:template match="site"/>
of the common skin file 'site-to-xhtml.xsl' in the directory
'main\webapp\skins\common\xslt\html' with a variable for the tracking site
ID hat will come from the skinconfig.xml file. Then put your tracking site
ID in the skinconfig.xml file on some new created element and modify the
'skinconf.xsl' in the directory 'main\webapp\skins\common' to make sure that
you handle defaults properly.



Steve





From: Bryce Alcock [mailto:u912boilermaker@gmail.com]
Sent: Monday, September 20, 2010 3:01 PM
To: user@forrest.apache.org
Subject: Tracking Codes and Java Script





I was wondering if there was a simple and systematic way to configure a
tracking code into Forrest, for every page.



So for a concrete example I would like to add a

Google Analytics tracking code to the bottom of each page.



Currently I am having to do this by modifying files in the Forrest
directories.

(This works file with the exception that I have 2 forrest project and I have
to keep remembering to change these files...)



I would like to just be able to specify a tracking code and style or
possibly an html/javascript segment,

in a Config file such as site.xml or something like that.





Bryce
Re: Tracking Codes and Java Script [ In reply to ]
So I will be giving this a try tonight or over the weekend...
However, I wanted to ask a couple of more questions:
(just to start people thinking...)

1. I would ultimately like to have a solution that requires only
modifications to my website data, not changes to the Forrest XSL Files.
Therefore, can we design/architect a change that can be contributed
back to Forrest.
2. Most users would want tracking, but they may not want the "Google"
proprietary tracking,
Therefore, is it possible to design it to accept a "CDATA" as aposed to
a "PCDATA" thus allowing Arbitrary code in the website data.
3. Is it possible to update the DTD Docs with optional fields. I Kinda
like the validation.

Bryce




On Fri, Sep 24, 2010 at 10:43 AM, Steve Wolke <smwolke@geistig.com> wrote:

> Bryce,
>
>
>
> You can turn off validation of the skinconfig.xml in the forrest.properties
> file like the following
>
>
>
> ##############
>
> # validation properties
>
>
>
> # This set of properties determine if validation is performed
>
> # Values are inherited unless overridden.
>
> # e.g. if forrest.validate=false then all others are false unless set to
> true.
>
> forrest.validate=true
>
> #forrest.validate.xdocs=${forrest.validate}
>
> forrest.validate.skinconf=false
>
> #forrest.validate.sitemap=${forrest.validate}
>
> #forrest.validate.stylesheets=${forrest.validate}
>
> #forrest.validate.skins=${forrest.validate}
>
> #forrest.validate.skins.stylesheets=${forrest.validate.skins}
>
>
>
>
>
>
>
> Then to get your property you can just call
>
>
>
> <xsl:value-of select='//skinconfig/project-tracking'/>
>
>
>
>
>
>
>
>
>
> *From:* u912boilermaker@gmail.com [mailto:u912boilermaker@gmail.com] *On
> Behalf Of *Bryce Alcock
> *Sent:* Friday, September 24, 2010 1:30 AM
>
> *To:* user@forrest.apache.org
> *Subject:* Re: Tracking Codes and Java Script
>
>
>
> Ok so far so so...
>
> I have added the Tracking JavaScript to the site-to-xhtml.xsl file. And
> that seems to be working fine.
>
> I have added the variable to my skinconfig.xml file in the project
> directory, And finally I have been looking
>
> at how to pull the variable out of the skinconfig.xml and use it in the
> site-to-xhtml.xsl as a variable.
>
>
>
>
>
> However, when I go to build the site I get the following Error:
>
>
>
> validate-skinconf:
>
> /home/bryce/repos/brycealcock/
> brycealcock.com/src/documentation/skinconf.xml:64:21: Element type
> "project-tracking" must be declared.
>
> /home/bryce/repos/brycealcock/
> brycealcock.com/src/documentation/skinconf.xml:438:14: The content of
> element type "skinconfig" must match
> "(search?,disable-print-link?,disable-pdf-link?,disable-pod-link?,disable-txt-link?,disable-xml-link?,disable-external-link-image?,disable-compliance-links?,obfuscate-mail-links?,obfuscate-mail-value?,disable-font-script?,project-name?,project-description?,project-url?,project-logo,group-name?,group-description?,group-url?,group-logo?,host-url?,host-logo?,favicon-url?,disable-copyright-footer?,year?,vendor?,copyright-link?,trail?,toc?,headings?,feedback?,motd?,extra-css?,colors?,pdf?,credits?)".
>
>
>
> BUILD FAILED
>
>
>
>
>
> So it is obviously getting validated against a DTD or something, and does
> not like the fact that I added the
>
> <project-tracking>PCDATA</project-tracking>
>
>
>
> So I need more help.
>
>
>
> Bryce
>
>
>
>
>
> On Tue, Sep 21, 2010 at 7:49 AM, Steve Wolke <Swolke@roughbros.com> wrote:
>
> Bryce,
>
>
>
> I think this will work.
>
>
>
> You could add the google analytics code in the <xsl:template
> match="site"/> of the common skin file ‘site-to-xhtml.xsl’ in the directory
> ‘main\webapp\skins\common\xslt\html’ with a variable for the tracking site
> ID hat will come from the skinconfig.xml file. Then put your tracking site
> ID in the skinconfig.xml file on some new created element and modify the
> ‘skinconf.xsl’ in the directory ‘main\webapp\skins\common’ to make sure that
> you handle defaults properly.
>
>
>
> Steve
>
>
>
>
>
> *From:* Bryce Alcock [mailto:u912boilermaker@gmail.com]
> *Sent:* Monday, September 20, 2010 3:01 PM
> *To:* user@forrest.apache.org
> *Subject:* Tracking Codes and Java Script
>
>
>
>
>
> I was wondering if there was a simple and systematic way to configure a
> tracking code into Forrest, for every page.
>
>
>
> So for a concrete example I would like to add a
>
> Google Analytics tracking code to the bottom of each page.
>
>
>
> Currently I am having to do this by modifying files in the Forrest
> directories.
>
> (This works file with the exception that I have 2 forrest project and I
> have to keep remembering to change these files...)
>
>
>
> I would like to just be able to specify a tracking code and style or
> possibly an html/javascript segment,
>
> in a Config file such as site.xml or something like that.
>
>
>
>
>
> Bryce
>
>
>
Re: Tracking Codes and Java Script [ In reply to ]
In addition to the previous email, while I am investigating this issue a bit
I was curious:
Is the XML/DTD validation done with Local or Remote (web based) dtd docs?

It seems like the DTD's are located here
http://forrest.apache.org/dtd/skinconfig-v08-1.dtd

Can the DTDs be made local?


On Fri, Sep 24, 2010 at 12:41 PM, Bryce Alcock <ba.lists@brycealcock.com>wrote:

> So I will be giving this a try tonight or over the weekend...
> However, I wanted to ask a couple of more questions:
> (just to start people thinking...)
>
> 1. I would ultimately like to have a solution that requires only
> modifications to my website data, not changes to the Forrest XSL Files.
> Therefore, can we design/architect a change that can be contributed
> back to Forrest.
> 2. Most users would want tracking, but they may not want the "Google"
> proprietary tracking,
> Therefore, is it possible to design it to accept a "CDATA" as aposed
> to a "PCDATA" thus allowing Arbitrary code in the website data.
> 3. Is it possible to update the DTD Docs with optional fields. I Kinda
> like the validation.
>
> Bryce
>
>
>
>
> On Fri, Sep 24, 2010 at 10:43 AM, Steve Wolke <smwolke@geistig.com> wrote:
>
>> Bryce,
>>
>>
>>
>> You can turn off validation of the skinconfig.xml in the
>> forrest.properties file like the following
>>
>>
>>
>> ##############
>>
>> # validation properties
>>
>>
>>
>> # This set of properties determine if validation is performed
>>
>> # Values are inherited unless overridden.
>>
>> # e.g. if forrest.validate=false then all others are false unless set to
>> true.
>>
>> forrest.validate=true
>>
>> #forrest.validate.xdocs=${forrest.validate}
>>
>> forrest.validate.skinconf=false
>>
>> #forrest.validate.sitemap=${forrest.validate}
>>
>> #forrest.validate.stylesheets=${forrest.validate}
>>
>> #forrest.validate.skins=${forrest.validate}
>>
>> #forrest.validate.skins.stylesheets=${forrest.validate.skins}
>>
>>
>>
>>
>>
>>
>>
>> Then to get your property you can just call
>>
>>
>>
>> <xsl:value-of select='//skinconfig/project-tracking'/>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *From:* u912boilermaker@gmail.com [mailto:u912boilermaker@gmail.com] *On
>> Behalf Of *Bryce Alcock
>> *Sent:* Friday, September 24, 2010 1:30 AM
>>
>> *To:* user@forrest.apache.org
>> *Subject:* Re: Tracking Codes and Java Script
>>
>>
>>
>> Ok so far so so...
>>
>> I have added the Tracking JavaScript to the site-to-xhtml.xsl file. And
>> that seems to be working fine.
>>
>> I have added the variable to my skinconfig.xml file in the project
>> directory, And finally I have been looking
>>
>> at how to pull the variable out of the skinconfig.xml and use it in the
>> site-to-xhtml.xsl as a variable.
>>
>>
>>
>>
>>
>> However, when I go to build the site I get the following Error:
>>
>>
>>
>> validate-skinconf:
>>
>> /home/bryce/repos/brycealcock/
>> brycealcock.com/src/documentation/skinconf.xml:64:21: Element type
>> "project-tracking" must be declared.
>>
>> /home/bryce/repos/brycealcock/
>> brycealcock.com/src/documentation/skinconf.xml:438:14: The content of
>> element type "skinconfig" must match
>> "(search?,disable-print-link?,disable-pdf-link?,disable-pod-link?,disable-txt-link?,disable-xml-link?,disable-external-link-image?,disable-compliance-links?,obfuscate-mail-links?,obfuscate-mail-value?,disable-font-script?,project-name?,project-description?,project-url?,project-logo,group-name?,group-description?,group-url?,group-logo?,host-url?,host-logo?,favicon-url?,disable-copyright-footer?,year?,vendor?,copyright-link?,trail?,toc?,headings?,feedback?,motd?,extra-css?,colors?,pdf?,credits?)".
>>
>>
>>
>> BUILD FAILED
>>
>>
>>
>>
>>
>> So it is obviously getting validated against a DTD or something, and does
>> not like the fact that I added the
>>
>> <project-tracking>PCDATA</project-tracking>
>>
>>
>>
>> So I need more help.
>>
>>
>>
>> Bryce
>>
>>
>>
>>
>>
>> On Tue, Sep 21, 2010 at 7:49 AM, Steve Wolke <Swolke@roughbros.com>
>> wrote:
>>
>> Bryce,
>>
>>
>>
>> I think this will work.
>>
>>
>>
>> You could add the google analytics code in the <xsl:template
>> match="site"/> of the common skin file ‘site-to-xhtml.xsl’ in the directory
>> ‘main\webapp\skins\common\xslt\html’ with a variable for the tracking site
>> ID hat will come from the skinconfig.xml file. Then put your tracking site
>> ID in the skinconfig.xml file on some new created element and modify the
>> ‘skinconf.xsl’ in the directory ‘main\webapp\skins\common’ to make sure that
>> you handle defaults properly.
>>
>>
>>
>> Steve
>>
>>
>>
>>
>>
>> *From:* Bryce Alcock [mailto:u912boilermaker@gmail.com]
>> *Sent:* Monday, September 20, 2010 3:01 PM
>> *To:* user@forrest.apache.org
>> *Subject:* Tracking Codes and Java Script
>>
>>
>>
>>
>>
>> I was wondering if there was a simple and systematic way to configure a
>> tracking code into Forrest, for every page.
>>
>>
>>
>> So for a concrete example I would like to add a
>>
>> Google Analytics tracking code to the bottom of each page.
>>
>>
>>
>> Currently I am having to do this by modifying files in the Forrest
>> directories.
>>
>> (This works file with the exception that I have 2 forrest project and I
>> have to keep remembering to change these files...)
>>
>>
>>
>> I would like to just be able to specify a tracking code and style or
>> possibly an html/javascript segment,
>>
>> in a Config file such as site.xml or something like that.
>>
>>
>>
>>
>>
>> Bryce
>>
>>
>>
>
>
Re: Tracking Codes and Java Script [ In reply to ]
Bryce Alcock wrote:
> In addition to the previous email, while I am investigating this issue a bit
> I was curious:
> Is the XML/DTD validation done with Local or Remote (web based) dtd docs?
>
> It seems like the DTD's are located here
> http://forrest.apache.org/dtd/skinconfig-v08-1.dtd
>
> Can the DTDs be made local?

They are local. See the "Catalog Entity Resolver".

Use the forrest.apache.org site search or the
"Forrestbar" search, and look for "catalog" gives
some docs.

-David
Re: Tracking Codes and Java Script [ In reply to ]
Bryce Alcock wrote:
> So I will be giving this a try tonight or over the weekend...
> However, I wanted to ask a couple of more questions:
> (just to start people thinking...)
>
> 1. I would ultimately like to have a solution that requires only
> modifications to my website data, not changes to the Forrest XSL Files.
> Therefore, can we design/architect a change that can be contributed
> back to Forrest.
> 2. Most users would want tracking, but they may not want the "Google"
> proprietary tracking,
> Therefore, is it possible to design it to accept a "CDATA" as aposed to
> a "PCDATA" thus allowing Arbitrary code in the website data.
> 3. Is it possible to update the DTD Docs with optional fields. I Kinda
> like the validation.

See other occasions when this has been done.

Sorry, i don't have time to help much.

One way is to look at the SVN logs and follow what
was done on a previous occasion and see related commits.
http://forrest.apache.org/svn.html
http://svn.apache.org/viewvc/forrest/trunk/main/webapp/resources/schema/dtd/skinconfig-v08-2.dtd?view=log
and follow the "Revision" link to find related changes:
i.e.
http://svn.apache.org/viewvc?view=revision&revision=776976

Also install "Forrestbar"
http://forrest.apache.org/tools/forrestbar.html
and use it to search for "skinconf"

It would be better to discuss this on the "dev" list.

-David