Created
October 27, 2016 22:03
-
-
Save alexandraj777/0d1f0629acce0f7303b553b2c4173af6 to your computer and use it in GitHub Desktop.
Track tumblr blog post views with Segment's analytics.js
This file contains hidden or 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
// This snippet goes in your tumblr html theme right after you've loaded the analytics.js library. | |
// Use this to replace analytics.page() in the generic analytics.js library setup code. | |
// Homepage blog views will be tracked as analytics.page("Blog", "Home"), | |
// whereas individual post views will be tracked as analytics.page("Blog", "Post") with metadata. | |
{block:PermalinkPage} | |
{block:Posts} | |
{block:Text} | |
{block:Title} | |
analytics.page("Blog", "Post", { | |
postTitle: "{PlaintextTitle}", | |
postId: {PostID} | |
}); | |
{/block:Title} | |
{/block:Text} | |
{/block:Posts} | |
{/block:PermalinkPage} | |
{block:IndexPage} | |
analytics.page("Blog", "Home"); | |
{/block:IndexPage} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment