Adding Google Tag Manager To AcyMailing Popup Buttons

Google Tag Manager

We recently received a request for a trial web page.  The Joomla 2.5 page needed click capture for a number of the page elements.  One of the page components that needed the mouse click event captured was an Acymailing (version: 4.1.0) newsletter module.  The module had been configured to use the mooTools popup for signup.

For this it was necessary to change the one of the Acymailing files on the server.


An alteration to the following line:

<a <?php echo $link; ?> id=”acymailing_togglemodule_<?php echo $formName; ?>” href=”<?php echo $href;?>”><?php echo $mootoolsButton ?></a>


<a <?php echo $link; ?> id=”acymailing_togglemodule_<?php echo $formName; ?>” onclick=”dataLayer.push({‘event’: ‘subscribe-link-click-<?php echo $module->id; ?>’});” href=”<?php echo $href;?>”><?php echo $mootoolsButton ?></a>

The additional entry: onclick=”dataLayer.push({‘event’: ‘subscribe-link-click-<?php echo $module->id; ?>’});” registers that on a mouse click the dataLayer will will be ‘pushed’ with the type of element, in this instance ‘event’, and the name of the element, in this instance ‘subscribe-link-click-<?php echo $module->id; ?>’.

The more familiar of you out there may ask why we have used the additional php code to define the element: <?php echo $module->id; ?>.  Good question and I am glad that you asked.  This code will uniquely define the newsletter element when multiple newsletter subscriptions are defined in a page, as was the situation with our work request.  I initially tried by using the <?php echo $formName; ?> element, but this is unique for each page load, and therefore of no use, as far as I could see, within Google Tag Manager.

Please let us know if you have any questions, and happy coding!

If you haven’t installed AcyMailing yet, you can get it directly from the developers (Acyba) by clicking on the image below:


Mantra: live as much as you can in the short time we're on this awesome planet, but try to leave our shared home as nice as when you arrived, perhaps even nicer.

Comments (2)

  • Hi,

    Thanks for this trick. I’m trying to do the same for a Joomla 2.5 website but I don’t use a popup for the signup. Where you I place the code then?



    • Hi Thomas,

      Thanks for your post. If you can find the php file that relates to the signup that you are using, back up the file, and then find the button code and follow a similar pattern to the code addition mentioned above, then that should work.

      Let me know how you get on?


Leave a Reply

Your email address will not be published. Required fields are marked *

Connect With Us

Contact Us

4 Redwood Lodge, Reigate
Surrey, RH2 0LU, UK

WebHolism Limited © 2006 - 2021
Registered in England and Wales, Registered Number 7290215
ICO Registered: ZB042427