Created
October 1, 2012 14:20
-
-
Save MarcStoecker/3812062 to your computer and use it in GitHub Desktop.
simple umbraco GA tracking (concept/mockup)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var foo = ""; | |
$("body").find("[data-tracking=='']").each(function(index) { | |
if ($(this).data("tracking")!='') | |
{ | |
var trackingTokens = $(this).data("tracking").split(","); | |
$(this).click(function() { | |
_gaq.push(["_trackEvent", trackingTokens[0], trackingTokens[1], trackingTokens[2]]); | |
}); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:for-each select="$linkliste//url-picker"> | |
<li> | |
<!-- tracking presets for javascript tracking plugin (google analytics) --> | |
<xsl:attribute name="data-tracking"> | |
<xsl:variable name="trackingContentTitle"> | |
<xsl:choose> | |
<xsl:when test="link-title!=''"><xsl:value-of select="link-title"/></xsl:when> | |
<xsl:otherwise><xsl:value-of select="url"/></xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<xsl:choose> | |
<xsl:when test="@mode='Media'">Media,Download,<xsl:value-of select="umbraco.library:HtmlEncode($trackingContentTitle)"/></xsl:when> | |
<xsl:when test="@mode='URL'">Ausgehende Links,Klick,<xsl:value-of select="umbraco.library:HtmlEncode($trackingContentTitle)"/></xsl:when> | |
<xsl:when test="@mode='Upload'">Media,Download,<xsl:value-of select="umbraco.library:HtmlEncode($trackingContentTitle)"/></xsl:when> | |
<!-- do not track (set empty string): 'Content', all others --> | |
<xsl:otherwise></xsl:otherwise> | |
</xsl:choose> | |
</xsl:attribute> | |
<a> | |
<xsl:attribute name="href"> | |
<xsl:choose> | |
<xsl:when test="@mode='Content'"><xsl:value-of select="umbraco.library:NiceUrl(node-id)"/></xsl:when> | |
<xsl:otherwise><xsl:value-of select="url"/></xsl:otherwise> | |
</xsl:choose> | |
</xsl:attribute> | |
<xsl:if test="Exslt.ExsltStrings:lowercase(new-window)='true'"> | |
<xsl:attribute name="target">_blank</xsl:attribute> | |
</xsl:if> | |
<xsl:value-of select="link-title"/> | |
</a> | |
</li> | |
</xsl:for-each> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment