Skip to main content

Send PII (Contact Data) Using the JavaScript Tag

Add user contact info to Loop via the JavaScript tag.

J
Written by Juan Sebastian Franco
Updated this week

When you already user contact details (e.g., email, phone) from your site’s registration process, you can send that information to Loop through the JavaScript tag. Doing so allows Loop to recognize and segment your users more precisely.

This article explains how to implement the JS snippet, the recommended data formats, and why you should avoid sending raw personally identifiable information (PII) whenever possible.

Important requirement:

Before sending any demographic or contact data, ensure the Loop tag is already installed. Without the base tag, the methods described below won’t function properly.

Contact Data (Emails, Phones, National IDs)

We strongly discourages sending unencrypted user emails, phone numbers, or national IDs. Whenever possible, hash these values on your end before sending. The platform will store them in a secure, non-reversible hash (SHA‑256 and SHA‑512). Sending data already in a hashed format minimizes privacy risks and aligns better with data protection regulations.

Supported Keys and Formats

Data Type

Raw Key (_raw)

SHA‑256 Key (_sh2)

SHA‑512 Key (_sh5)

Format Requirements

Email

ml_raw

ml_sh2

ml_sh5

Lowercase email (e.g., [email protected]).

Mobile Phone

mb_raw

mb_sh2

mb_sh5

Numeric only: country code + area code (no zeros) + number. E.g., 541151190123

National ID

nid_raw

nid_sh2

nid_sh5

Numeric only, no spaces or special characters.

Send PII from web forms using the Retargetly Inspector (Recommended)

Make sure to install first the Retargetly Inspector Chrome extension in your browser

The Retargetly Inspector simplifies sending PII by allowing you to visually tag relevant input fields.

Here’s how to do it:

Step 1: Activate the Inspector

  1. Navigate to the specific website page that contains the form from which you want to collect PII.

  2. Click the Retargetly Inspector icon in your Chrome browser toolbar.

  3. The extension will activate, and a control panel will appear on the right side of the page.

Step 2: Select PII Form Fields

  1. Hover your mouse over the form fields that collect email addresses, phone numbers, or national IDs. You will see blue overlay boxes appear over these elements.

  2. Click on the desired input field to select it. The overlay will turn blue, and a field number will appear, indicating it's selected. The selected element will also be listed in the "Current Field" section of the Inspector's control panel.

Step 3: Categorize the Field

  1. In the Inspector's control panel, choose the Country that you expect most of your traffic to come from

  2. Then, locate the "Choose Category" dropdown.

  3. Select the appropriate data category for the selected field:

    • Choose "E-mail" for email address input fields.

    • Choose "Mobile #" for mobile phone number input fields.

    • Choose "National ID" for national identification number input fields.

Step 4: Add Field to Form Configuration

  1. After categorizing the field, click the "Add Field To Form" button in the Inspector's control panel.

  2. The tagged field will now appear in the form configuration area, indicating it has been added to your current setup.

  3. Repeat Steps 2-4 for all other PII fields you wish to collect from the form.

Step 5: Save and Export the Form Configuration

  1. Once you have tagged all desired PII fields (and any other relevant elements) on the form, ensure the correct Partner ID and Country are selected in the Inspector's control panel.

  2. Click "Save new form" to store the complete configuration for the current form.

  3. To obtain the configuration file, click "Download saved forms". This will export all your saved form configurations as a JSON-formatted text file.

Final Step: Contact Retargetly Support for Implementation Once you have downloaded your form configurations, please contact your account manager to upload the data into our storage system.

Send PII Using a JavaScript Snippet

<script>
// If sending hashed email
_rely.push({ 'ml_sh2':
'0e06ca8fb7433001b38b189ad677e591f44a934e50c771112179df4c93f53ad5',
'nid_sh5': 'c9302ce11aaf5a813296b7576fec7fb13256a2ee08b9d2fd194979a556f7a4dc8fee4010...' });
_rely.send();
</script>

You can also send data in multiple pushes if needed:

<script>
_rely.push({'nid_sh5': 'c9302ce11aaf5a813296b7576fec7fb13256a2ee08b9d2fd194979a556f7a4dc8fee401'});
_rely.push({'ml_sh2': '0e06ca8fb7433001b38b189ad677e591f44a934e50c771112179df4c93f53ad5'});
_rely.send();
</script>

Practical Example

Suppose you have a lead request form where users provide their email address. After hashing the email on your server, you can pass it to Loop like so:

<script>
_rely.push({
'ml_sh2': '7356faca65115f00dc32fa56d72f620acc7238581f546b24317123f5339332cf'});
_rely.send();
</script>

This ensures Loop can segment and recognize these users by their demographics and contact info while keeping their sensitive data protected.


Final Tips

  1. Avoid Sending Plain Personal Information: Hash emails, phone numbers, and national IDs whenever possible.

  2. One or Multiple Pushes: You can push multiple attributes at once or in several steps before calling _rely.send().

  3. Check Your Formats: Make sure raw or hashed data matches the formats listed above (e.g., phone number has no extra characters).

By sending hashed contact data, you can enrich your user segmentation without compromising personal information security.

Did this answer your question?