Skip to content

Allow tracking stats for users from custom recipient handlers.

The module is heavily reliant on checking for, and storing, a subscriber ID. So instead of trying to get around all that the changes check if the current subscriber doesn't have an ID, but is a Drupal user, and creates a temporary subscriber ID with a leading zero based on the user ID. I'm not sure if there are better checks for that. The subscriber entity also has a new "is_recipient_handler" property set so as the subscriber entity is accessed in the module we can tell if the user comes from a recipient handler.

With the subscriber ID in place the rest of the checks have been altered to check if it's a recipient handler user. This allows the tracking code to be added with the ID being the custom ID created with the leading zero. That ID is then checked when creating the stats assigning the tracking event to that user, but with a 0 subscriber ID since there isn't one to record.

I considered altering the sstc tracking string to add in a new param, but with "u" already being used for the subscriber ID, I didn't want to add any further confusion adding in something else that actually is a user ID. So keeping it as is with the leading zero seems OK to me.

Merge request reports