{"id":19308913,"url":"https://github.com/optimics/gtm-template-article-tracker","last_synced_at":"2026-03-19T09:13:01.964Z","repository":{"id":197196790,"uuid":"698163390","full_name":"optimics/gtm-template-article-tracker","owner":"optimics","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-16T15:31:28.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T03:18:38.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Smarty","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/optimics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-29T09:50:41.000Z","updated_at":"2023-10-02T12:22:12.000Z","dependencies_parsed_at":"2025-01-06T01:40:27.277Z","dependency_job_id":"7b63255d-864d-4685-9351-e8df4459c02c","html_url":"https://github.com/optimics/gtm-template-article-tracker","commit_stats":null,"previous_names":["optimics/gtm-template-article-tracker"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/optimics/gtm-template-article-tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fgtm-template-article-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fgtm-template-article-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fgtm-template-article-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fgtm-template-article-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/optimics","download_url":"https://codeload.github.com/optimics/gtm-template-article-tracker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fgtm-template-article-tracker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29927557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T00:16:58.400Z","updated_at":"2026-02-28T07:31:06.658Z","avatar_url":"https://github.com/optimics.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Article Tracker GTM Template \n\n\u003e Track your multimedia articles with ease\n\n* [Configuration](#user-content-configuration)\n  * [Selector](#user-content-selector)\n  * [Content Types](#user-content-content-types)\n    * [Custom Content Type Provider](#user-content-custom-content-type-provider)\n  * [Event Bindings](#user-content-event-bindings)\n    * [Event Binding Example](#user-content-event-binding-example)\n  * [Extra Properties](#user-content-extra-properties)\n    * [Extra Properties Example](#user-content-extra-properties-example)\n\n## Developing\n\n⚠⚠⚠ The content of this repository is auto-generated from\n[@optimics/analytics](https://github.com/optimics/analytics) multirepo, because\nGoogle Tag Manager does not have it's own artifact repository. The contents are\noverwritten with each release.\n\n## Workflow\n\nThe template has inline documentation, so please refer to it, while configuring\nit. \n\n### Selector\n\nSet up the article selector, which points to element containing the entire\narticle content, including videos and main headings.\n\n![screenshot](./screenshot-selector.png)\n\n### Content Types\n\nGenerally, you want to \"Track all Default Content Types\", unless you have\ncreated your custom replacement trackers for each Content Type. You can provide\nyour custom Content Type providers by defining a function, that returns a class\nextending the\n[ArticleElement](https://github.com/optimics/analytics/tree/master/browser/article-tracker)\nor one of it's subclasses.\n\n![screenshot](./screenshot-content-types.png)\n\n#### Custom Content Type Provider\n\n```\nwindow.customArticleTypes = {\n  customVideoPlayer({ ArticleElement, ArticleParagraph, VisualArticleElement }) {\n    return class CustomVideoPlayer extends ArticleElement {\n      static selector = '.what-the-player'\n\n      constructor(el) {\n        super(el)\n        this.subscribeToMyPlayer()\n      }\n\n      getMetadata () {\n        return JSON.parse(this.el.dataset.metadata)\n      }\n\n      estimateFastestTime() {\n        return this.getMetadata().totalTime * 0.76\n      }\n\n      estimateSlowestTime() {\n        return this.getMetadata().totalTime\n      }\n\n      subscribeToMyPlayer() {\n        magicPlayer.on('play', () =\u003e this.recordConsumptionTime())\n        magicPlayer.on('pause', () =\u003e this.stopConsumption())\n      }\n    }\n  }\n}\n```\n\n![screenshot](./screenshot-content-types-custom.png)\n\n### Event Bindings\n\nArticle Tracker produces a [lot of\nevents](https://github.com/optimics/analytics/tree/master/browser/article-tracker#user-content-events),\nso you must choose, which ones you want to track in your datalayer by pairing\nthe Article Tracker Event Name with the desired data layer event name. \n\n![screenshot](./screenshot-event-bindings.png)\n\n#### Event Binding Example\n\n```\nArticle Tracker Event: consumptionStartedFirst\nGTM Event: article_consumption_started\n```\n\nExtra properties can be bundled with each event binding. See the\n[Extra properties](#extraproperties) for examples.\n\nFor example:\n\n### Extra Properties\n\nExtra properties will be appended to each event triggered by Article Tracker.\nThey must be JSON encoded. Invalid JSON inputs will crash the code. GTM\nTemplate Tags may be used in the JSON.\n\n#### Extra Properties Example\n\n```\n{\"pageTitle\": \"{{PAGE TITLE VARIABLE}}\", \"staticVariable\": true}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimics%2Fgtm-template-article-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptimics%2Fgtm-template-article-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimics%2Fgtm-template-article-tracker/lists"}