back to

Potential improvement to google tracking

I’m looking at reworking the google analytics tracking code with tthe objective

  • allow the default values provided by phplist to be over-ridden
  • support Matomo/Piwik parameters as an alternative

When composing a campaign, the Finish tab would let you change the default values for google analytics
or matomo

Those fields are displayed only when the option is checked

But I’m not sure what the default values should now be. It doesn’t seem that useful to me for pk_content to indicate whether the clicked link was in the html email or plain text email.

On the Settings page you would be able to select between Google and Matomo for the tracking parameters


I’d like any suggestions as how this might be improved by anyone who uses google anaytics, or Matomo analytics also.


Great you are considering this, thanks.

As I suggested before my main concern was grouping all phplist sources in my Analytics reports as “a” source. This is not happening now due to the phplistID currently implemented. To my understanding source should be either “phplist” or ideally a setting value I can tune at least globally. Medium should probably just be “email” and for campaign I suggest you could use a sanitize version of the campaigns slug or alternatively the ID.

This could well be a setting value but obviously if you offer personalising per campaign it will offer much more flexibility. If this second case, I suggest the values should be autocompleted from defaults (like advised) so there is at least no need to remember/change every time.

Another possible option of interest might be allowing [] placeholders there which to me would be the only thing that might make utm_term or utm_content of any use.

utm_term and utm_content are optional parameters in Analytics. No harm if they remain there empty.

Hope is of help. Thanks.

Thanks for the reply. Just to clarify what you mean by “the campaigns slug”.

Is it the campaign subject, the campaign title or something else? Those seem to be more useful than using just the campaign id, when viewing reports in google analytics.

Thank you for revamping this feature and giving more visibility to Matomo. Just a tiny thing, the parameter term/keyword is not shown within the print screen you attached. In general in an email I am used to use this parameter to include the anchor link text. Just to let you know. Cheers.

1 Like

Hi there,
I had the time to rethink about how to improve it.
Here is how you could really make a difference:

users should be free to insert the paramters they want, it is not only about GA or Matomo, it is really about the parameters themselves. In this video above I am showing it with a parameter named user id. Hope that helps.

@flossmarketingschool Thanks.

In your example you are adding a parameter to just one URL. I think that the way you have done that is probably the best way, by including the attribute name in the URL. But there is a problem when click tracking is enabled because the URL for each subscriber can be different, due to the attribute.
I think that there is a way around that by re-ordering the phplist processing so that only one URL is tracked, but that will need some investigation and testing.

If you want to add a parameter to all URLs then my intended approach will support that. A plugin will be able to provide the “analytics” parameters to be added to each URL, instead of the core phplist processing. Those parameters could be anything, including subscriber attributes. I will try to submit the code for the changes so that it can be more easily discussed.

Just remembered about this looking into analytics ecommerce conversions. The image is probably self explanatory. To me the “source” should be “phplist” on all (or whatever)

I also never replied to your last question, sorry:
Is it the campaign subject, the campaign title or something else? Those seem to be more useful than using just the campaign id, when viewing reports in google analytics.

Yes, could well be the campaign slug or the first X characters of it as their might be some limitations.

@luison @flossmarketingschool It has taken a while but the new phplist release candidate 3.5.3 has the change to support Matomo as an alternative to Google Analytics.
It would be great if you could install that then provide any feedback here.

The changes allow a plugin to provide the analytic query parameters which allows someone to use different values or use different query parameters. I have a demo plugin if you are interested.


Sorry I didn’t participate on this. Complicated times.
I will test it on the published version.