├── .distignore ├── .github └── workflows │ ├── deploy.yml │ └── update.yml ├── .wordpress-org ├── banner-1544x500.jpg ├── banner-772x250.png ├── icon-128x128.png ├── icon-256x256.png └── icon.svg ├── index.php ├── options.php ├── readme.txt ├── shortcodes.php └── wpmautic.php /.distignore: -------------------------------------------------------------------------------- 1 | # Exclude hidden files 2 | .git 3 | .github 4 | .wordpress-org 5 | .gitignore 6 | .gitattributes 7 | .distignore 8 | .travis.yml 9 | 10 | # Exclude development and build files 11 | node_modules/ 12 | composer.lock 13 | composer.lock 14 | package-lock.json 15 | webpack.config.js 16 | 17 | # Exclude test files 18 | dist/ 19 | tests/ 20 | vendor/ 21 | phpcs.xml 22 | phpunit.xml 23 | phpunit.xml.dist 24 | 25 | # Exclude local environment files 26 | .env 27 | *.log 28 | 29 | 30 | # Exclude Git 31 | LICENSE 32 | TODO 33 | CHANGELOG.md 34 | CONTRIBUTING.md 35 | README.md 36 | UPGRADE.md 37 | Makefile -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | # The name of the Github Action that displays in github.com///actions 2 | name: Deploy to WordPress.org Repository 3 | 4 | # Here we can define the events "on" which the action should be triggered. 5 | on: 6 | 7 | # Since we want to publish new versions of our plugin, we only want this action to 8 | # run when publishing a new release. 9 | # 10 | # The released version of the plugin will then be deployed to the repository. 11 | # 12 | # This allows us to run and manage plugin releases from a single location. 13 | release: 14 | 15 | # run only when a new release is published, but not when it's classified as a pre-release. 16 | types: [released] 17 | 18 | # A list of jobs involved in this workflow. 19 | jobs: 20 | 21 | # A unique job identifier. 22 | # 23 | # Github Actions can have multiple jobs and each can be referenced by its name. 24 | # However, we only need to run a few steps here and they can be handled in a single job. 25 | deploy_to_wp_repository: 26 | 27 | # The proper name for the job being run. 28 | name: Deploy to WP.org 29 | 30 | # The environment this job should run on. In the context of WordPress, ubuntu-latest is 31 | # pretty typical. Since we are only interacting with git and subversion, Ubuntu is perfect 32 | # for this. 33 | # 34 | # Github does offer other platforms if you need them: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on 35 | runs-on: ubuntu-latest 36 | 37 | # Every job has a specific set of steps that it goes through to do its "work". 38 | # 39 | # Each step has a two key elements: 40 | # • Name 41 | # • a "run" command (an arbitrary CLI command to execute) OR a "uses" command that pulls in and executes a 3rd party action. 42 | steps: 43 | 44 | # Most workflows begin by checking out the repository into the workflow filesystem. 45 | # 46 | # This is just like cloning a repository except it only checks out the specific commit 47 | # the job is executed for. In our case here, the commit that the release is attached to. 48 | - name: Checkout code 49 | uses: actions/checkout@v2 50 | 51 | # Optional: If your plugin is using composer dependencies, we want to include them 52 | # WITHOUT the dev dependencies. 53 | # - name: Build 54 | # run: | 55 | # npm install 56 | # npm run build 57 | 58 | - name: WordPress Plugin Deploy 59 | 60 | # You can add unique ids to specific steps if you want to reference their output later in the workflow. 61 | # 62 | # Here, this unique identifier lets us use the output from the action to get the zip-path later. 63 | id: deploy 64 | 65 | # The use statement lets us pull in the work done by 10up to deploy the plugin to the WordPress repository. 66 | uses: 10up/action-wordpress-plugin-deploy@stable 67 | 68 | # Steps can also provide arguments, so this configures 10up's action to also generate a zip file. 69 | with: 70 | dry-run: true 71 | generate-zip: true 72 | 73 | # Steps can also set environment variables which can be configured in the Github settings for the 74 | # repository. Here, we are using action secrets SVN_USERNAME, SVN_PASSWORD, and PLUGIN_SLUG which 75 | # authenticate with WordPress and lets the action deploy our plugin to the repository. 76 | # 77 | # To learn more about setting and using secrets with Github Actions, check out: https://docs.github.com/en/actions/security-guides/encrypted-secrets?tool=webui#about-encrypted-secrets 78 | env: 79 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }} 80 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} 81 | SLUG: wp-mautic 82 | 83 | # After the deploy, we also want to create a zip and upload it to the release on Github. We don't want 84 | # users to have to go to the repository to find our plugin :). 85 | - name: Upload release asset 86 | uses: softprops/action-gh-release@v2 87 | env: 88 | # Note, this is an exception to action secrets: GH_TOKEN is always available and provides access to 89 | # the current repository this action runs in. 90 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 91 | 92 | with: 93 | # Provide what the file should be named when attached to the release (plugin-name.zip) 94 | files: ${{ github.workspace }}/${{ github.event.repository.name }}.zip 95 | -------------------------------------------------------------------------------- /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: Plugin asset/readme update 2 | on: 3 | push: 4 | branches: 5 | - trunk 6 | jobs: 7 | trunk: 8 | name: Push to trunk 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | - name: WordPress.org plugin asset/readme update 13 | uses: 10up/action-wordpress-plugin-asset-update@stable 14 | with: 15 | dry-run: true 16 | env: 17 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} 18 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }} 19 | SLUG: wp-mautic -------------------------------------------------------------------------------- /.wordpress-org/banner-1544x500.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mautic/mautic-wordpress/665a4c7e46b2bbdd5ea4a834126e6aac089f127d/.wordpress-org/banner-1544x500.jpg -------------------------------------------------------------------------------- /.wordpress-org/banner-772x250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mautic/mautic-wordpress/665a4c7e46b2bbdd5ea4a834126e6aac089f127d/.wordpress-org/banner-772x250.png -------------------------------------------------------------------------------- /.wordpress-org/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mautic/mautic-wordpress/665a4c7e46b2bbdd5ea4a834126e6aac089f127d/.wordpress-org/icon-128x128.png -------------------------------------------------------------------------------- /.wordpress-org/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mautic/mautic-wordpress/665a4c7e46b2bbdd5ea4a834126e6aac089f127d/.wordpress-org/icon-256x256.png -------------------------------------------------------------------------------- /.wordpress-org/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 20 |
21 |

22 |

23 |
24 | 25 | 26 | 27 |
28 |

29 |
    30 |
  • [mautic type="form" id="1"]
  • 31 |
  • [mautic type="content" slot="slot_name"][/mautic]
  • 32 |
33 |

34 |
    35 |
  • 36 | 37 |
  • 38 |
  • 39 | 40 |
  • 41 |
  • 42 | 43 |
  • 44 |
  • 45 | 46 |
  • 47 |
  • 48 | 49 |
  • 50 |
51 |
52 | 112 | 120 | array(), 130 | 'code' => array(), 131 | ); 132 | 133 | ?> 134 |
135 | 147 |
148 | 160 |
161 | 175 |
176 | array(), 186 | 'code' => array(), 187 | ); 188 | 189 | ?> 190 | 198 | checked 199 | /> 200 | 205 | 215 | 223 | checked 224 | /> 225 | 228 | 42 | (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n; 43 | w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t), 44 | m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m) 45 | })(window,document,'script','http://yourmauticsite.com/mtc.js','mt'); 46 | 47 | wpmautic_send(); 48 | 49 | 50 | #### Custom attributes handling 51 | 52 | If you need to send custom attributes within Mautic events, you can use the `wpmautic_tracking_attributes` filter. 53 | 54 | add_filter('wpmautic_tracking_attributes', function($attrs) { 55 | $attrs['preferred_locale'] = $customVar; 56 | return $attrs; 57 | }); 58 | 59 | The returned attributes will be added to Mautic payload. 60 | 61 | ### Mautic Forms 62 | 63 | To load a Mautic Form to your WP post, insert this shortcode to the place you want the form to appear: 64 | 65 | [mautic type="form" id="1"] 66 | 67 | Replace "1" with the form ID you want to load. To get the ID of the form, go to your Mautic, open the form detail and look at the URL. The ID is right there. For example in this URL: http://yourmautic.com/s/forms/view/3 the ID is 3. 68 | 69 | ### Mautic Focus 70 | 71 | To load a Mautic Focus to your post, insert this shortcode to the place you want the form to appear: 72 | 73 | [mautic type="focus" id="1"] 74 | 75 | Replace "1" with the focus ID you want to load. To get the ID of the focus, go to your Mautic, open the focus detail and look at the URL. The ID is right there. For example in this URL: http://yourmautic.com/s/focus/3.js the ID is 3. 76 | 77 | ### Mautic Dynamic Content 78 | 79 | To load dynamic content into your WP content, insert this shortcode where you'd like it to appear: 80 | 81 | [mautic type="content" slot="slot_name"]Default content to display in case of error or unknown contact.[/mautic] 82 | 83 | Replace the "slot_name" with the slot name you'd like to load. This corresponds to the slot name you defined when building your campaign and adding the "Request Dynamic Content" contact decision. 84 | 85 | ### Mautic Gated Videos 86 | 87 | Mautic supports gated videos with Youtube, Vimeo, and MP4 as sources. 88 | 89 | To load gated videos into your WP content, insert this shortcode where you'd like it to appear: 90 | 91 | [mautic type="video" gate-time="#" form-id="#" src="URL"] 92 | [mautic type="video" src="URL"] 93 | 94 | Replace the # signs with the appropriate number. For gate-time, enter the time (in seconds) where you want to pause the video and show the mautic form. For form-id, enter the id of the mautic form that you'd like to display as the gate. Replace URL with the browser URL to view the video. In the case of Youtube or Vimeo, you can simply use the URL as it appears in your address bar when viewing the video normally on the providing website. For MP4 videos, enter the full http URL to the MP4 file on the server. 95 | 96 | Since the Mautic v2.9.1 release, the form-id is not mandatory anymore, mautic video can be tracked. 97 | 98 | ### Mautic Tags 99 | 100 | You can add or remove multiple lead tags on specific pages using commas. To remove an tag you have to use minus "-" signal before tag name: 101 | 102 | [mautic type="tags" values="mytag,anothertag,-removetag"] 103 | 104 | == Installation == 105 | 106 | ### Via WP administration 107 | 108 | Mautic - WordPress plugin [is listed](https://wordpress.org/plugins/wp-mautic/) in the in the official WordPress plugin repository. That makes it very easy to install it directly form WP administration. 109 | 110 | 1. Go to *Plugins* / *Add New*. 111 | 2. Search for **WP Mautic** in the search box. 112 | 3. The "WP Mautic" plugin should appear. Click on Install. 113 | 114 | ### Via ZIP package 115 | 116 | If the installation via official WP plugin repository doesn't work for you, follow these steps: 117 | 118 | 1. [Download ZIP package](https://github.com/mautic/mautic-wordpress/archive/master.zip). 119 | 2. At your WP administration go to *Plugins* / *Add New* / *Upload plugin*. 120 | 3. Select the ZIP package you've downloaded in step 1. 121 | 122 | == Upgrade Notice == 123 | 124 | = v2.2.1 = 125 | Fix an escaping error introduced in the 2.0.0 version. If you tried to use HTML inside Dynamic Content shortcode, the HTML code is escaped so it became unusable. 126 | 127 | = v2.0.4 = 128 | Fix a bug introduced in the 2.0.2 version, you must upgrade asap because the async attribute on form generator script blocks `document.write`. 129 | 130 | = v2.0.3 = 131 | Fix a bug introduced in the 2.0.2 version, you must upgrade asap because there was a typo in the option page name which forbid option to be saved. 132 | 133 | == Changelog == 134 | 135 | = v2.4.2 = 136 | 137 | Release date: 2020-12-14 138 | 139 | * Changes 140 | * Add missing style on shortcode embedded image. 141 | 142 | = v2.4.1 = 143 | 144 | Release date: 2020-12-14 145 | 146 | * Changes 147 | * Add an alt text on the `