When you work with multiple data sources (CRM, eCommerce, apps, legacy systems), it’s normal for the same contact to be identified in different ways: email, customer ID, external code, phone number.
With secondary keys, you can tell magnews how to recognize that this data belongs to the same person — without forcing everything into a single identifier.
In practice: you import data from different systems and magnews automatically links it to the correct contact.
Why use (also) secondary keys
The database primary key is often not enough. Typical examples:
- your CRM uses a customer ID
- your eCommerce uses a different user ID
- marketing campaigns use email or mobile number
- ...
Without effective identity resolution management, you risk having duplicate contacts, losing information because it’s not associated with the right customers, and you can’t update contacts in a simple and consistent way.
With secondary keys:
- you update the correct contacts even if the identifier changes
- you easily integrate multiple systems
- you maintain a single, consistent contact profile
- you solve duplicate issues
- you have more reliable data
- you can create better, more realistic segments.
What secondary keys are
Secondary keys are fields that magnews uses to identify a contact in addition to the primary key.
You can choose as secondary keys:
- a contact detail (email or mobile number, as long as it is not already the primary key)
- a contact field of type text (they are case sensitive, so ABC ≠ abc ≠ Abc)
- a contact field of type integer
The user code cannot be used as a secondary key.
Example of using secondary keys
- You have a database in magnews with user code as the primary key.
- You have a CRM where your customer identifier is “customer ID”.
- You also have an eCommerce where your customer identifier is the email address.
You can set as secondary keys:
- the email contact detail
- the “customer ID” contact field.
Result: you update the same contact in magnews by integrating data from both CRM and eCommerce, without duplicates.
How secondary keys work
Priority among secondary keys
You can define multiple secondary keys and set their priority order.
For example:
- Let’s say your secondary keys are, in order: email contact detail, contact field my_ID.
- You import a contact file that contains both columns email and my_ID.
- If the email field is filled in, magnews will search for a contact using the email.
- If it is empty, it will search using my_ID.
If both email and my_ID are empty, the row will be discarded.
To define the priority order, you need to access the list of contact fields in the database. From here, click on Secondary keys using the button at the top.
If you already have secondary keys, you will see them here (see the next sections to learn how to create them).
Drag the keys to change the priority order among the secondary keys. The order is very important for the reconciliation logic.
Reconciliation logic
When you import or update contacts, magnews follows this order:
- Primary key — the primary key always has priority
- Secondary keys (in priority order).
Let’s summarize the reconciliation logic. We import a contact file with the following rows:
| Primary key | Secondary key (1st) | Secondary key (2nd) | Contact field A | Contact field ... | |
| CASE 1 | MN00001 | email@example.com | CRM0001 | ... | |
| CASE 2 | email1@example.com | CRM0002 | ... | ||
| CASE 3 | CRM0003 | ... |
CASE 1: primary key is present
magnews ignores any secondary keys in the row and uses the primary key to find the contact:
- Finds the contact → updates it
- Does not find it → creates a new contact
CASE 2: the secondary key set as highest priority is present
The primary key is not present, but the secondary key defined as first in priority is present. magnews ignores other secondary keys and uses this one to find the contact:
- Finds 1 contact → updates it
- Does not find it → creates a new contact, but only if the primary key is the username and the option “Assign a value automatically if empty” is enabled. In other cases, no operation is performed because contacts cannot be inserted in magnews with an empty primary key
- Finds more than 1 matching contact → no update or insertion is performed because it cannot determine which contact to update.
CASE 3: a non-priority secondary key is present
The primary key is not present, and the first-priority secondary key is not present. magnews uses the next secondary key in order and behaves the same as above:
- Finds 1 contact → updates it
- Does not find it → creates a new contact, but only if the primary key is the username and the option “Assign a value automatically if empty” is enabled
- Finds more than 1 matching contact → no update or insertion is performed
The search continues with any additional secondary keys following the same logic.
How to create a secondary key
Go to the database settings and open the top menu “Keys”. Click on “Secondary keys”.
If you already have secondary keys, you will see them here and need to click “Add key”. If it’s the first one for this database, the creation window will open directly.
Select the type of field you want to use:
- a contact detail: choose which one
- a contact field: a new field of the required type (text or number) will be automatically created.
How to remove it
To remove a secondary key, from the ordered list click the trash icon on the right side of the row.
You will be asked to confirm the removal. If the key was a contact detail, you will be able to set it again as a secondary key.
If instead the removed key is another contact field, you will not be able to set the same field again as a secondary key, and you will need to create a new key (and therefore a new field).
How to use them in contact import
Manual import
During mapping, associate the secondary keys if you want to use them for recognition.
Scheduled import activity
In the field mapping, include the primary key or the secondary keys you want to use, according to the logic described above.