{"id":20894036,"url":"https://github.com/mautic/mautic-grav","last_synced_at":"2025-05-12T23:30:29.660Z","repository":{"id":2140371,"uuid":"45785790","full_name":"mautic/mautic-grav","owner":"mautic","description":"Mautic integration into Grav CMS","archived":false,"fork":false,"pushed_at":"2022-05-05T15:15:15.000Z","size":27,"stargazers_count":23,"open_issues_count":0,"forks_count":11,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-04-21T22:22:02.048Z","etag":null,"topics":["grav-plugin","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mautic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-08T15:18:50.000Z","updated_at":"2023-08-25T16:33:43.000Z","dependencies_parsed_at":"2022-08-08T11:16:59.751Z","dependency_job_id":null,"html_url":"https://github.com/mautic/mautic-grav","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mautic%2Fmautic-grav","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mautic%2Fmautic-grav/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mautic%2Fmautic-grav/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mautic%2Fmautic-grav/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mautic","download_url":"https://codeload.github.com/mautic/mautic-grav/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251556433,"owners_count":21608448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["grav-plugin","php"],"created_at":"2024-11-18T10:18:00.478Z","updated_at":"2025-05-12T23:30:29.291Z","avatar_url":"https://github.com/mautic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mautic - Grav Plugin\n\nThis is [Grav CMS](http://getgrav.org) plugin that helps you configure [Mautic](https://mautic.org) tracking and converts markdown \"links\" and shortcodes into HTML that embeds Mautic content on your Grav page.\n\n# Installation\n\nInstalling the Mautic - Grav plugin can be done in one of two ways.\n\n## GPM Installation (Preferred)\n\nThe simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line).  From the root of your Grav install type:\n\n    bin/gpm install mautic\n\nThis will install the Mautic - Grav plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/mautic`.\n\n## Manual Installation\n\nTo install this plugin, just [download](https://github.com/mautic/mautic-grav/archive/master.zip) the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `mautic`.\n\nYou should now have all the plugin files under\n\n    /your/site/grav/user/plugins/mautic\n\n# Config Defaults\n\n```\nenabled: true               # Global enable/disable the entire plugin\ntracking: false             # Enable/Disable tracking\nurl: 'https://mautic.loc'   # Mautic base URL\n```\n\nIf you need to change any value, then the best process is to copy the [mautic.yaml](mautic.yaml) file into your `users/config/plugins/` folder (create it if it doesn't exist), and then modify there.  This will override the default settings.\n\n# Usage\n\n## Mautic tracking\n\nTracking JS works right after you enable the plugin, enable tracking, insert the Base URL and save the plugin. After this, the plugin will insert JS into the head of your site from your Mautic instance. You can check HTML source code (CTRL + U) of your Grav website to make sure the plugin works. You should be able to find something like this:\n\n```\n\u003cscript\u003e\n    (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;\n        w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),\n        m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','{$mauticBaseUrl}/mtc.js','mt');\n\n    mt('send', 'pageview');\n\u003c/script\u003e\n```\n\nThere will be probably longer URL query string at the end of the tracking image URL. It is encoded additional data about the page (title, url, referrer).\n\nThe plugin allows to disable tracking, which allows you to control the injection of tracking code via a (3rd-party) consent manager.\n\n## Mautic content\n\nMautic content is included as shortcodes, identified by two parameters `type`\nand `id`, where `type` specifies the content type, and `id` specifies one\nparticular content element delivered by Mautic. The following table lists the\navailable content types, as well as their associated IDs:\n\n| Type      | ID                                                                                                        |\n|-----------|-----------------------------------------------------------------------------------------------------------|\n| `form`    | The ID of the form (from Mautic \"Components/Forms\" overview table)                                        |\n| `content` | The DWC slot name (from Mautic \"Components/Dynamic Content\" element in edit mode as \"Requested slot name\")|\n| `focus`   | The ID of the focus item (from Mautic \"Channels/Focus Items\" overview table)                              |\n| `asset`   | The ID of the asset. Additionally, the asset's *alias* is needed, appended to the ID by a colon (`:`)     |\n\nThe general syntax is:\n\n```\n[mautic type=\"\u003ctype\u003e\" id=\"\u003cid\u003e\"][/mautic]\n```\n\nThe following sections provide examples on the detailed usage for each content\nelement.\n\n### Forms\n\nThere are two options to include Mautic forms into Grav pages: shortcodes and\nMarkdown links. The reason is that the shortcode parser used by this plugin is\nnot yet mature enough to support nested shortcodes.\n\n1. Via Shortcode\n\n    To use this, we simply include the following:\n    \n    ```\n    [mautic type=\"form\" id=\"\u003cFORM_ID\u003e\"][/mautic]\n    ```\n    \n    Example: `[mautic type=\"form\" id=\"8\"][/mautic]` will load Mautic form with ID = 8.\n    \n    This code snippet will be converted into the following:\n    \n    ```\n    \u003cscript type=\"text/javascript\" src=\"https://mautic.loc/form/generate.js?id=8\"\u003e\u003c/script\u003e\n    ```\n\n2. Via Markdown link\n\n    There is a second option to include a form into a Grav page, which is to simply\n    include a Mautic Form ID in markdown link such as:\n    \n    ```\n    [plugin:mautic](FORM_ID)\n    ```\n    \n    Example: `[plugin:mautic](8)` will load Mautic form with ID = 8.\n    \n    This alternative form of including Mautic forms via link is very useful to\n    combine embedded forms with dynamic web content directives. One example use case\n    would be to only show a newsletter signup form if a visitor has not already\n    signed up:\n    \n    ```\n    [mautic type=\"content\" id=\"subscribed2newsletter\"]\n      [plugin:mautic](2)\n    [/mautic]\n    ```\n    \n    The above code snippet works as follows: If a user is already signed up, a\n    message is displayed like \"You are already signed up\" via dynamic web content.\n    Otherwise, if a user is not already signed up, a form is shown for the visitor\n    to enter her data.\n\n### Dynamic Web Content (DWC)\n\nTo use this, simply include the Mautic dynamic content shortcode in your content.\n\n```\n[mautic type=\"content\" id=\"slot_name\"]Default content to show when an unknown contact views this slot.[/mautic]\n```\n\nThis code snippet will be converted into the following:\n\n```\n\u003cdiv data-slot=\"dwc\" data-param-slot-name=\"slot_name\"\u003eDefault content to show when an unknown contact views this slot.\u003c/div\u003e\n```\n\n### Focus Items\n\nTo add focus items into a page, we simply add the following shortcode into the\ncontent of a Grav page:\n\n\n```\n[mautic type=\"focus\" id=\"ITEM_ID\"][/mautic]\n```\n\nFor example:\n\n```\n[mautic type=\"focus\" id=\"1\"][/mautic]\n```\n\nThis will be converted into the following\n\n```\n\u003cscript type=\"text/javascript\" src=\"https://mautic.loc/focus/1.js\" type=\"text/javascript\" charset=\"utf-8\" async=\"async\"\u003e\u003c/script\u003e\n```\n\n### Assets\n\nAssets are downloadable items which can be tracked with Mautic. Typically,\nassets are provided when a website user fills out a form. When assets are\nprovided after filling a form, this has to be set up in Mautic (and the form can\nbe included using this plugin).\n\nAssets can also be provided using direct links; the asset download will be\ntracked by Mautic, but not in exchange for some form data in this case. For\nassets downloadable via direct links, we add the following shortcode into the\ncontent of a Grav page:\n\n```\n[mautic type=\"asset\" id=\"\u003cID\u003e:\u003cALIAS\u003e\"]\n  Link text\n[/mautic]\n```\n\nThe shortcode to insert asset links expects two parameters; Besides the usual\n`type` parameter, for the `id` parameter, we also need to provide the *alias* of\nthe asset, joined with the asset's ID by a colon (`:`).  Both the ID and the\nalias can be found in the asset's details in Mautic. The text between the\nopening and closing shortcode tags is the text of the link that is generated to\ndownload the asset.\n\nThe following example shows a shortcode that generates a link for donwloading a\nlogo:\n\n```\n[mautic type=\"asset\" id=\"1:logopng\"]\n  Download our logo\n[/mautic]\n```\n\nThe above example converts into the following HTML:\n\n```\n\u003ca href=\"https://mautic.loc/asset/1:logopng\"\u003eDownload our logo\u003c/a\u003e\n```\n\n\u003e :warning: **WARNING:** A separate `alias` parameter is still supported, but\n\u003e deprecated since 1.5.1\n\u003e\n\u003e ```\n\u003e [mautic type=\"asset\" id=\"1\" alias=\"logopng\"]\n\u003e   Download our logo\n\u003e [/mautic]\n\u003e ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmautic%2Fmautic-grav","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmautic%2Fmautic-grav","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmautic%2Fmautic-grav/lists"}