Skip to main content

Send Demographic and Contact Data Using the JavaScript Tag

Add user demographic or contact info to Loop via the JavaScript tag.

J
Written by Juan Sebastian Franco
Updated over 5 months ago

When you already have demographic data (e.g., gender, age) or 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.

Basic Demographic Data

You can send demographic attributes like gender and age. Use whichever attributes you have regarding age or birth date—Loop needs only one to record the user’s age details.

Data Type

Key

Acceptable Values

Example

Gender

gender

'M' or 'F'

'gender': 'F'

Age

age

Numeric (current user age)

'age': 35

Birth Year

born

4‑digit year of birth

'born': 1987

Full Birthday

date

yyyymmdd format

'date': 19890319

Code Example

<script>
_rely.push({ 'gender': 'F', 'age': 29 });
_rely.send();
</script>

Contact Data (Emails, Phones, National IDs)

Loop strongly discourages sending unencrypted user emails, phone numbers, or national IDs. If 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.

Code Example

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

You can also send data in multiple pushes if needed:

<script>
_rely.push({'gender': 'F'});
_rely.push({'age': 29});
_rely.push({'ml_sh2': 'hashed_email_here'});
_rely.send();
</script>

Practical Example

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

<script>
_rely.push({ 'age': 29,
'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 combining demographic details and hashed contact data, you can enrich your user segmentation without compromising personal information security.

Did this answer your question?