{"id":22567816,"url":"https://github.com/openmost/datalayer","last_synced_at":"2026-04-28T08:38:53.872Z","repository":{"id":263414010,"uuid":"890309596","full_name":"openmost/datalayer","owner":"openmost","description":"Add dataLayer declaration with contextual informations on every page of your WordPress site","archived":false,"fork":false,"pushed_at":"2025-04-16T14:59:07.000Z","size":65,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-16T21:41:54.790Z","etag":null,"topics":["datalayer","datalayer-configuration","datalayer-standardization","datalayerpopulator","google-analytics-4","google-tag-manager","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://openmost.io/product/wp-datalayer","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openmost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-18T10:59:49.000Z","updated_at":"2025-04-16T14:59:10.000Z","dependencies_parsed_at":"2024-12-19T15:36:47.285Z","dependency_job_id":"a22690ef-3241-42bd-91d9-3c49dc151fd9","html_url":"https://github.com/openmost/datalayer","commit_stats":null,"previous_names":["openmost/wp-datalayer","openmost/datalayer"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/openmost/datalayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fdatalayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fdatalayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fdatalayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fdatalayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openmost","download_url":"https://codeload.github.com/openmost/datalayer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fdatalayer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32373514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"online","status_checked_at":"2026-04-28T02:00:07.250Z","response_time":56,"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":["datalayer","datalayer-configuration","datalayer-standardization","datalayerpopulator","google-analytics-4","google-tag-manager","wordpress","wordpress-plugin"],"created_at":"2024-12-08T00:09:18.161Z","updated_at":"2026-04-28T08:38:53.851Z","avatar_url":"https://github.com/openmost.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Description\n\nElevate your website analytics with the DataLayer plugin!\nThis robust plugin creates a fully populated and standardized dataLayer object, ensuring seamless integration with both Google Tag Manager and Matomo Tag Manager.\n\n- Instant Setup: Automatically generates and populates a dataLayer object with essential website and user interaction data.\n- Universal Compatibility: Works flawlessly with Google Tag Manager and Matomo Tag Manager, making it easier to manage your tagging needs.\n- Customizable Data: Easily add or modify data points to fit your specific tracking requirements.\n- Performance Optimized: Lightweight and optimized for speed to ensure your site remains fast and responsive.\n\n### Archive page `dataLayer` structure\n\nEasy access to your archive data with a standard event name and subject.\n\n```javascript\n{\n    \"event\": \"view_archive_date\", //_date may be replaces with _tax value\n    \"page\": {\n        \"type\": \"archive\",\n        \"title\": \"january 2025 - Example\",\n        \"url\": \"https://example.com/2025/01\",\n        \"path\": \"2025/01\",\n        \"locale\": \"en_US\",\n        \"archive_type\": \"date\",\n        \"taxonomy\": false,\n        \"post_type\": false,\n        \"date\": {\n            \"year\": 2025,\n            \"month\": 1,\n            \"day\": null\n        }\n    }\n}\n```\n\n### Author page `dataLayer` structure\n\nEasy access to all author details on his archive page.\n\n```javascript\n{\n    \"event\": \"view_author\",\n    \"page\": {\n        \"id\": 1,\n        \"nickname\": \"openmost\",\n        \"display_name\": \"openmost\",\n        \"first_name\": \"Ronan\",\n        \"last_name\": \"HELLO\",\n        \"description\": \"The creator of this super plugin\",\n        \"type\": \"author\",\n        \"url\": \"https://example.com/author/openmost\",\n        \"path\": \"author/openmost\",\n        \"title\": \"Author: openmost\"\n    }\n}\n```\n\n### Error page `dataLayer` structure\n\nThis `dataLayer` structure allows you to easily track the 404 error and detect the referring page that led to this error.\nWhat a great trick yeah?\n\n```javascript\n{\n    \"event\": \"view_error_404\",\n    \"page\": {\n        \"type\": \"error\",\n        \"title\": \"Page not found - Website\",\n        \"url\": \"https://example.com/url-that-encountered-a-404-error\",\n        \"path\": \"/url-that-encountered-a-404-error\",\n        \"locale\": \"en_US\",\n        \"error_type\": \"404\",\n        \"http_status_code\": 404\n    }\n}\n```\n\n### Search results page `dataLayer` structure\n\nThe search key in this object allows you to get the search term and total results to detect invalid searches.\nVery useful for Matomo Tag Manager, and nice hack for Google Tag Manager.\n\n```javascript\n{\n    \"event\": \"view_search_results\",\n    \"page\": {\n        \"type\": \"search\",\n        \"url\": \"https://example.com\",\n        \"path\": \"\",\n        \"title\": \"You searched for Demo - Example\",\n        \"locale\": \"en_US\"\n    },\n    \"search\": {\n        \"search\": \"Demo\",\n        \"search_cat\": \"\",\n        \"search_count\": 3,\n        \"query\": \"Demo\",\n        \"found_posts\": 3,\n        \"post_count\": 3\n    }\n}\n```\n\n### Home, Post Type `dataLayer` structure (blog posts, custom post type single page)\n\nThe following structure is generated for a single post page, but it automatically adapts to your custom post type, page, etc.\n\n```javascript\n{\n    \"event\": \"view_single_post\",\n    \"page\": {\n        \"type\": \"post\",\n        \"id\": 1,\n        \"url\": \"https://example.com/blog/super-article-path\",\n        \"path\": \"/blog/super-article-path\",\n        \"title\": \"Super article title | Example\",\n        \"locale\": \"en_US\",\n        \"is_home\": false,\n        \"is_front_page\": false,\n        \"post_name\": \"super-article-path\",\n        \"post_title\": \"Super article title\",\n        \"post_excerpt\": \"\",\n        \"post_status\": \"publish\",\n        \"post_date\": \"2024-08-17 13:30:00\",\n        \"post_date_gmt\": \"2024-08-17 13:30:00\",\n        \"post_modified\": \"2024-08-17 13:30:00\",\n        \"post_modified_gmt\": \"2024-08-17 13:30:00\",\n        \"post_type_name\": \"post\",\n        \"post_type_label\": \"Posts\",\n        \"post_type\": {\n            \"name\": \"post\",\n            \"label\": \"Posts\",\n            \"label_singular\": \"Post\",\n            \"label_plural\": \"Posts\",\n            \"description\": \"The super post type description\"\n        },\n        \"guid\": \"https://example.com/?p=1\",\n        \"post_mime_type\": false,\n        \"comment_status\": \"open\",\n        \"comment_count\": \"0\",\n        \"author\": {\n            \"id\": 1,\n            \"nickname\": \"openmost\",\n            \"display_name\": \"openmost\",\n            \"first_name\": \"Ronan\",\n            \"last_name\": \"HELLO\",\n            \"description\": \"The creator of this super plugin\"\n        },\n        \"taxonomies\": {\n            \"category\": {\n                \"name\": \"category\",\n                \"label\": \"Catégories\",\n                \"description\": \"\",\n                \"object_type\": [\n                    \"post\"\n                ],\n                \"terms\": {\n                    \"Uncategorized\": {\n                        \"term_id\": 1,\n                        \"slug\": \"uncategorized\",\n                        \"name\": \"Uncategorized\",\n                        \"term_group\": 0,\n                        \"term_taxonomy_id\": 1,\n                        \"taxonomy\": \"category\",\n                        \"description\": \"\",\n                        \"parent\": 0,\n                        \"count\": 1,\n                        \"filter\": \"raw\"\n                    }\n                },\n                \"primary_term\": [] //Filled only with YoastSEO plugin\n            }\n        },\n        \"category\": [\n            \"Uncategorized\"\n        ],\n        \"page_template\": \"\"\n    }\n}\n```\n\n### Term and taxonomy page `dataLayer` structure\n\n\n\n```javascript\n{\n    \"event\": \"view_archive_category\", // this event name changed for every taxonomy\n    \"page\": {\n        \"type\": \"archive\",\n        \"title\": \"Uncategorized archives - Example\",\n        \"url\": \"https://example.com/blog/category/uncategorized\",\n        \"path\": \"blog/category/uncategorized\",\n        \"locale\": \"en_US\",\n        \"archive_type\": \"taxonomy\",\n        \"taxonomy\": \"category\",\n        \"post_type\": \"category\",\n        \"date\": {\n            \"year\": null,\n            \"month\": null,\n            \"day\": null\n        }\n    }\n}\n```\n\n### Pagination `dataLayer` structure\n\nThe `pagination` object structure is automatically added to all pages that have pagination.\n\nEasy access to your pagination data, detect if users are using your pagination as much as you want.\n\n```javascript\n{\n    pagination: {\n        \"posts_per_page\": 10,\n        \"post_count\": 1,\n        \"paged\": true,\n        \"page_number\": 2,\n        \"max_num_pages\": 5\n    }\n}\n```\n\n### Authenticated user `dataLayer` structure\n\nThe `user` object is automatically added to all page when user is logged in.\n\nUser hashed data with SHA256 is very useful for GDPR consent with Google Ads services and user provided data.\n\n```javascript\n{\n    user: {\n        \"id\": 1,\n        \"user_login\": \"openmost\",\n        \"user_nicename\": \"Openmost\",\n        \"user_email\": \"no-reply@openmost.io\",\n        \"user_registered\": \"2024-01-01 12:00:00\",\n        \"display_name\": \"openmost\",\n        \"roles\": [\n            \"administrator\"\n        ],\n        \"sha256_id\": \"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b\",\n        \"sha256_user_login\": \"b2754b994c2fb636d1943ac0170f4ea192a891fb0f09cfdd100a9ffa983f053d\",\n        \"sha256_user_email\": \"679d031c25e557ee84ca86ecaf333ccd8d3d1a3900ee728da83d79a819daf535\"\n    }\n}\n```\n\n### Plugin : Contact Form 7 `dataLayer` structure\n\nThis plugin automatically detects the use of WP Contact Form 7.\nNo configuration needed.\n\nForm submitted\n\n```javascript\n{\n    \"event\": \"wpcf7_submit\",\n    \"wpcf7_form_id\": 145,\n    \"wpcf7_form_detail\": {} // See wpcf7_form_details below\n}\n```\n\nForm with invalid fields\n\n```javascript\n{\n    \"event\": \"wpcf7_invalid\",\n    \"wpcf7_form_id\": 145,\n    \"wpcf7_form_detail\": {} // See wpcf7_form_details below\n}\n```\n\nForm spamming detected\n\n```javascript\n{\n    \"event\": \"wpcf7_spam\",\n    \"wpcf7_form_id\": 145, \n    \"wpcf7_form_detail\": {} // See wpcf7_form_details below\n}\n```\n\nEmail sent successfully\n\n```javascript\n{\n    \"event\": \"wpcf7_mail_sent\",\n    \"wpcf7_form_id\": 145, \n    \"wpcf7_form_detail\": {} // See wpcf7_form_details below\n}\n```\n\nFailed to send mail\n\n```javascript\n{\n    \"event\": \"wpcf7_mail_failed\",\n    \"wpcf7_form_id\": 145, \n    \"wpcf7_form_detail\": {} // See wpcf7_form_details below\n}\n```\n\nAs each event handles `wpcf7_form_details`, here is an example of the object values ​​when the form is submitted with invalid fields.\n\n```javascript\n\"wpcf7_form_detail\": {\n        \"contactFormId\": 145,\n        \"pluginVersion\": \"6.0.3\",\n        \"contactFormLocale\": \"en_US\",\n        \"unitTag\": \"wpcf7-xxxxxx\",\n        \"containerPostId\": 0,\n        \"status\": \"validation_failed\",\n        \"inputs\": [\n            {\n                \"name\": \"your-message\",\n                \"value\": \"\"\n            },\n            {\n                \"name\": \"your-name\",\n                \"value\": \"\"\n            },\n            // All other inputs\n        ],\n        \"formData\": {},\n        \"apiResponse\": {\n            \"contact_form_id\": 145,\n            \"status\": \"validation_failed\",\n            \"message\": \"One or more fields contain an error. Please check and try again.\",\n            \"invalid_fields\": [\n                {\n                    \"field\": \"your-name\",\n                    \"message\": \"Please complete this field..\",\n                    \"idref\": \"last_name\",\n                    \"error_id\": \"wpcf7-f145-o1-ve-your-name\"\n                },\n                {\n                    \"field\": \"your-first-name\",\n                    \"message\": \"Please complete this field.\",\n                    \"idref\": \"first_name\",\n                    \"error_id\": \"wpcf7-f145-o1-ve-your-first-name\"\n                },\n                // All other invalid fields\n            ],\n            \"posted_data_hash\": \"\",\n            \"into\": \"#wpcf7-f145-o1\"\n        }\n    }\n```\n\n### Plugin : WP Forms `dataLayer` structure\n\n```javascript\n{\n    event: 'wp_forms_submit', \n    wp_forms_form_detail: {} // the HTML tag found in DOM\n}\n```\n\n\n## Installation\n\nTo start using the dataLayer plugin, you need to install it from the marketplace or manually.\nThen activate the plugin in the WordPress administration.\nYou don't need to configure anything special for standard use.\nOnce the plugin is activated, you will need to understand the different structures of the generated `dataLayer` object.\n\nIn your favorite Tag Manager:\n\n- To trigger a tag at a specific moment, you will need to create a trigger based on the value of the `event` key of the desired page.\n- To read values from the `dataLayer` object and report them to your audience analysis tools, you will need to create custom variables of the \"data layer\" type and enter the full path.\n\nExample of configuring a variable:\nfor a following `datalayer` object:\n\n```javascript\n{\n    \"event\": \"view_single_post\",\n    \"page\": {\n        \"type\": \"post\",\n        \"id\": 1,\n        \"url\": \"https://example.com/blog/super-article-path\",\n        \"path\": \"/blog/super-article-path\",\n        \"title\": \"Super article title | Example\",\n        \"post_type\": {\n            \"name\": \"post\",\n            \"label\": \"Posts\",\n            \"label_singular\": \"Post\",\n            \"label_plural\": \"Posts\",\n            \"description\": \"The super post type description\"\n        }\n    }\n}\n```\n\nTo collect the post type label, you will need to enter the value `page.post_type.label` in your custom variable.\nThis variable should be triggered with a custom trigger based on the custom event `view_single_post`.\n\nJob done !\n\n## Frequently Asked Questions\n\n### Is this plugin compatible with Google Tag Manager?\n\nYes of course, this plugin fills the data in the `dataLayer` object by default for GTM\n\n### Is this plugin compatible with Matomo Tag Manager?\n\nYes, even though this plugin fills data into the `dataLayer` object by default for GTM, your Matomo Tag Manager instance is able to read this data if you enable the container option: \"Actively sync from Google data layer Tag Manager\".\nNO specific configuration required.\n(Your Matomo instance must be at least updated to Matomo \u003e=5.2.0)\n\n### Is it possible to change the default dataLayer structure?\n\nYes, you can use all filters and actions available in the plugin source code to extend and adapt this plugin to your needs.\n\n### How to visualize the contents of the data layer?\n\nIf you want to check what data is available in the dataLayer, you can open your console tab (F12) in your browser.\nThen type `dataLayer` and press the “Enter” key.\nYour browser displays the `dataLayer` object with all the data it contains.\n\nYou can also use the Tag Assistant tool from Google to visualise your `dataLayer` with ease in a fancy user interace.\n\n### How to track forms submission using this plugin?\n\nIf your website uses the WP Contact Form 7 or WP Forms plugin, this plugin will automatically detect form events.\nThe list of all events is available in the documentation of this plugin.\n\nContact Form 7 sent mail event is `wpcf7_mail_sent`\n\nWP Forms form submit event is `wp_forms_submit`\n\n## Screenshots\n\n\n\n## Changelog\n\n### 1.0.1\nRelease data: 2025-01-17\n\nCreate documentation\n\n### 1.0.0\nRelease date: 2024-11-18\n\nPlugin first release, enjoy all the features !\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenmost%2Fdatalayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenmost%2Fdatalayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenmost%2Fdatalayer/lists"}