Search through more than a hundred articles on every aspect of User.com

Aneta Koreba
Written by Aneta Koreba

Module guide: Send code Action

Learn how to send additional script to a user’s browser


What does it do? 

Let's say you want to add a code to someone's browser who is from New York and who is in your CRM on the first stage of the pipeline and who hasn't replied to any of your last 4 messages to a certain remarketing campaign.

Normally that would require a lot of work: connecting your remarketing ad network to User.com using an API and synchronising them to work together. 

However, there is another quick and clever way to achieve this objective: use Send code module.

Before you start

Please, read this article, so this action module will be easier to understand.

How to use it

Open "module configuration" and check the "Append to HTML" checkbox. Everything that you paste inside this module will be appended at the end of the body element of your page on which the module is activated.

Case study

Let’s say you want to send an event to Facebook pixel, and you want to activate it only for users who are in the CRM on the first stage of the pipeline and who haven't replied to any of your last 4 email messages.

Select a trigger, for example: Page visit. Connect the trigger to Filters: Deals stage - Lead, Segment: havenotreplied. Connect the action module, Send code, using the "yes" exit node.Take, for example, Facebook.

In order to send data about a conversion to Facebook, you need to activate such a snippet inside the user's browser:

fbq('track', 'Lead');

However, the problem is that this will be added after the page is evaluated. So if we simply paste a JS scripts such as

fbq('track', 'Lead'

they will not be triggered.

There is one way to solve this puzzle, and it's this script:

<img src="https://app.userengage.com/media/uploads/6238/ff4d00-0-0.png" onload="<<PASTE YOUR SNIPPET HERE>>">

So, for example, we might use:

<img src="https://app.userengage.com/media/uploads/6238/ff4d00-0-0.png" onload="fbq('track', 'Lead')">

Here is why it works:

This script loads a one pixel image to the end of the <body> element of your page. And when the pixel loads, it automatically triggers the Facebook tag. Of course, in order to make it work, we need to have basic Facebook pixel already implemented on our website.


Related articles

Categories: