Recognize a user action when using a campaign webhook

Your software
My Mautic version is: v4.4.4
My PHP version is: PHP 8.0 (ea-php80)
My Database type and version is: MySQL 5.7.40

Your problem
My problem is: I am sending a campaign Webhook to another app and I want to include a way to track the users. Specifically I want to generate a unique link per user to be able to change them from segment if they click in the link (or do any action). I haven’t found any documentation of how to manually create a link or anything to trigger an action in mautic except by built in functions or apps.

In other words:

  1. I create a campaign with a segment (with some users in it)
  2. I create a webhook to another messaging system to trigger a message in this other system
  3. I run the campaign and each person gets it’s message but that message is not personalized (except by the user name because I added in the webhook the user name tag)
  4. I want them to click in the included link and when clicking into that link, Mautic will know that user X did a click so it should change of segment in mautic
  5. Since I can’t personalize a link in the webhook, I don’t know how to create this trigger for mautic and change segments
    I am adding an image of how I am managing the webhooks on the campaign

These errors are showing in the log: This is not about an error

Steps I have tried to fix the problem: I am adding a webhook and here is the full line of the text content of the message: “Hello {contactfield=firstname}, this is a test message. https://www.xxxxxxxx.com Please answer the poll”

I want to find a way to identify the user, I thought about a link but is not dynamic when using webhooks

I am thinking about adding a variable at the end of the URL like
https://www.my-web-that-have-a-mautic-tag.com/{contactfield=email} or similar, but I am not sure that will be enough for mautic or if I have to add to mautic a way to “read” that email and know that that guy did a clic on the link

Ok, this worked: Tracking Visitor Data by Smart URL

Thanks @Woeler great solution, now I can add multiple tags or even change fields in my contacts.
BTW, this is very important to manipulate different fields:

mt('send', 'pageview', {email: 'my@email.com', firstname: 'John', tags: 'whatever-tag-you-want'});

Finally, did a little change to the code to be able to send the tags through the link (I am terrible at coding so my solution might be horrible but works):

Note that “v” is the variable of the email and “c” is the variable for the new tag so the link should be: https://www.yourmauticsite.com/?v=email@email.com&c=the-tag-you-want

BTW the code is there but I don’t know how to make it visible or if it’s approved in this forums, so in the image is the code added:
image

Update: I want to send mutiple variables and change multiple tags so the code changed a bit more:

First when declaring variables:

var email = getUrlParameter(‘a’);
var vartag1 = getUrlParameter(‘b’);
var vartag2 = getUrlParameter(‘c’);
var vartagn = getUrlParameter(‘n’);
var mergedtags = vartag1 + “,” + vartag2 + “,” + vartagn

Then used the mergedtags variable on the line that sends the values to mautic:

if(email !== ''){
	mt('send', 'pageview', {email: email, tags: mergedtags});

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.