back to phpList.org

Change analytics tracking code behaviour

Hi. I would like to suggest a change to the google analytics code that gets generated on links if selected on the send page. I am happy to try to modify the code if someone can provide some guide on how to proceed.

phplist currently generates a pair of values on the links like:
test.com?utm_source=phplistXXX&utm_medium=email

I understand XXX being the ID of the newsletter. This makes it show on Analytics as different ungrouped sources. It can be filtered, segmented or changed in analytics with regex but I think the source should remain and the id of the email should be set up as a

test.com?utm_source=phplist&utm_medium=email&utm_campaign=IDXXX&utm_term=or_even_slug

This allows to see all traffic generated from the phplist source and the I can filter them by term or campaign ID, having the best of both options.

Just a suggestion for consideration to the development team which I would happy to help with.

The phplist code also sets the utm_content, and utm_campaign parameters.

See files lists/admin/sendemaillib.php and lists/lt.php which seem to be the only files that deal with google tracking for campaigns.

Thanks. We’ll have a look into it but in that case why set the source to “phplistXXX” instead of just “phplist”?

@luison I don’t know the background to this but possibly google analytics might have had fewer parameters in the past.

There have been some requests for phplist to support Matomo for analytics as an alternative. Possibly any reworking of this code could separate the processing into a plugin, to allow either google analytics or matomo to be used.