Skip to content

Commit

Permalink
Move tracking script from within Cron Jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Priyanshi Gaur <[email protected]>
  • Loading branch information
nox1134 committed Mar 15, 2024
1 parent a38ad61 commit db73ed2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
19 changes: 0 additions & 19 deletions docs/configuration/cron_jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,22 +338,3 @@ Example output
If you have SSH access, try to run the command directly to Select for errors. If there is nothing printed from either in a SSH session or in the cron output, verify in the server's logs. If you see similar errors to ``'Warning: Invalid argument supplied for foreach()' in /vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:287``, you either need to use ``php-cli`` instead of ``php`` or try using ``php -d register_argc_argv=On``. `

Tracking script
###############

After installation and setup of the :doc:`/configuration/cron_jobs` you're ready to begin tracking Contacts. You need to add a piece of JavaScript to the websites for each site you wish to track through Mautic.

This is straightforward process, you can add this tracking script to your website template file, or install a Mautic Integration for the more common Content Management System platforms.

Here is an example of the tracking JavaScript which you can access by clicking on **Tracking Settings** in the Global Configuration.


.. code-block:: javascript
(function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://example.com/mautic/mtc.js','mt');
mt('send', 'pageview');
You should replace the site URL, ``example.com/mautic`` with the URL to your Mautic instance in the example provided, but it's recommended to copy the whole code block from the tracking settings in your Mautic instance.
27 changes: 27 additions & 0 deletions docs/configuration/tracking_script.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. vale off
Tracking script
###############

.. vale on
After installation and setup of the :doc:`/configuration/cron_jobs` you're ready to begin tracking Contacts. You need to add a piece of JavaScript to the websites for each site you wish to track through Mautic.

This is straightforward process, you can add this tracking script to your website template file, or install a Mautic Integration for the more common Content Management System platforms.

Here is an example of the tracking JavaScript which you can access by clicking on **Tracking Settings** in the Global Configuration.


.. code-block:: javascript
(function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://example.com/mautic/mtc.js','mt');
mt('send', 'pageview');
You should replace the site URL, ``example.com/mautic`` with the URL to your Mautic instance in the example provided, but it's recommended to copy the whole code block from the tracking settings in your Mautic instance.

Type: Page Redirect

Check warning on line 25 in docs/configuration/tracking_script.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Colons] ': P' should be in lowercase. Raw Output: {"message": "[Google.Colons] ': P' should be in lowercase.", "location": {"path": "docs/configuration/tracking_script.rst", "range": {"start": {"line": 25, "column": 5}}}, "severity": "WARNING"}

Check warning on line 25 in docs/configuration/tracking_script.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Landing Page' instead of 'Page'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Landing Page' instead of 'Page'.", "location": {"path": "docs/configuration/tracking_script.rst", "range": {"start": {"line": 25, "column": 7}}}, "severity": "INFO"}
From URL: /docs/build/html/configuration/cron_jobs.html#tracking-script

Check failure on line 26 in docs/configuration/tracking_script.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'HTML' instead of 'html'. Raw Output: {"message": "[Vale.Terms] Use 'HTML' instead of 'html'.", "location": {"path": "docs/configuration/tracking_script.rst", "range": {"start": {"line": 26, "column": 23}}}, "severity": "ERROR"}

Check failure on line 26 in docs/configuration/tracking_script.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'HTML' instead of 'html'. Raw Output: {"message": "[Vale.Terms] Use 'HTML' instead of 'html'.", "location": {"path": "docs/configuration/tracking_script.rst", "range": {"start": {"line": 26, "column": 52}}}, "severity": "ERROR"}
To URL: /docs/build/html/configuration/tracking_script.html

Check failure on line 27 in docs/configuration/tracking_script.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'HTML' instead of 'html'. Raw Output: {"message": "[Vale.Terms] Use 'HTML' instead of 'html'.", "location": {"path": "docs/configuration/tracking_script.rst", "range": {"start": {"line": 27, "column": 21}}}, "severity": "ERROR"}

Check failure on line 27 in docs/configuration/tracking_script.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'HTML' instead of 'html'. Raw Output: {"message": "[Vale.Terms] Use 'HTML' instead of 'html'.", "location": {"path": "docs/configuration/tracking_script.rst", "range": {"start": {"line": 27, "column": 56}}}, "severity": "ERROR"}
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ There are different types of documentation available to help you navigate your w
configuration/maxmind_license
configuration/command_line_interface
configuration/cron_jobs
configuration/tracking_script
configuration/variables
configuration/settings

Expand Down

0 comments on commit db73ed2

Please sign in to comment.