Skip to content

Guide

Last Updated 2021/04/07

Magento 2 is an open-source e-commerce platform by Adobe that powers hundreds of thousands of online stores. It is a highly extendable platform developed in PHP and powered by MySQL or MariaDB for storage. Magento also stores personal data about your customers. The NiX extension module for Magento 2 helps your company manage this data.

To complete the installation and configuration of NiX in your Magento 2 environment, you will:

  • Install the extension module using Composer
  • If you don't have an existing NiX account:
    • Sign up for NiX
    • Create a Company
    • Create a Project for this store within that Company
    • Apply the Magento schema template to that Project
    • Create a new API Key for your Magento 2 instance.
  • Configure the NiX extension module
  • Migrate your existing customer data into NiX online

Before we begin, you will need:

Installation

Magento 2 uses Composer for installing and managing libraries, extensions, and other software components. NiX provides a Composer-compatible repository containing the latest versions of our Magento extension and supporting PHP libraries.

From the server running your Magento 2 extension (connected directly, over SSH, or however you prefer), perform the following installation steps.

Connect as the Magento 2 user

Remember to run the following steps as the user that your Magento 2 instance uses. This may be magento, apache, www-data or something else. If you do not, you may need to repair file permissions after installation.

Navigate to the directory in which Magento 2 is installed. This may vary depending on your installation.

cd /var/www/magento2

Add the NiX PHP repository to composer.

composer config repositories.nix composer https://api.nix.software/repo/php

Install the NiX extension module using composer.

composer require nix/nix-magento2-nc

Enable the module in Magento 2.

./bin/magento module:enable Nix_Nix

Run the setup upgrade command to make sure the module is registered.

./bin/magento setup:upgrade

The module is now installed.

NiX Account Setup and API Key

At this point, please setup (as needed for each entity) a NiX account, company, project, schema including the Magento schema template, and an API Key with permissions to the Magento schema fields.

You can find the details of each step here.

Configuration

API Key And Secret

Log into the administrative dashboard for your Magento installation. Configuration options for NiX are under Stores > Configuration > NiX > General.

Stores Menu

Copy the API Key and Secret from the NiX dashboard into the appropriate boxes and click Save. When you save, the extension will check with NiX to test the validity of the API Key and Secret (so if you get the green checkbox alert after you click Save, everything should work from this point forward).

Stores Menu

Note If the check fails, make sure that <magento_directory>/Nix/Nix/Client/nix-client is marked executable. We use a helper executable to talk to NiX. It is statically linked, entirely self-contained, and should run on any modern x86-64 Linux distribution. The way in which we use it is similar to the way php projects might use ImageMagick or other tools, but it is designed from the start to be executed from a separate environment safely.

Configuring Third Party Data (Optional)

Many Magento extensions may store personal data about your customeres in third party services. Although NiX does not know what information the services have without additional extensions for those services, the NiX Magento 2 extension can be used to keep track of which third party services may be storing your customer's personal data to facilitate and automate requests. NiX will present descriptive text to your customers explaining what kinds of data may be given to third parties and the basis for those parties having that information. If a customer requests access to that data or that the data be deleted, NiX can send automated notifications to each third party service if configured.

The extension will list any other installed extensions that it finds under “Track Third Party Data Use”. Check off any extensions that you know are storing information like Names, Phone Numbers, Addresses, Email Addresses, customer-identifiable tracking data, etc.

Third Party Extensions

Click "Copy to Dashboard" to be taken to the NiX dashboard with the selected third party extensions. On this page, enable each extension that was copied over. You may use this page to configure NiX to reach out to these third parties to notify them of requests that your customers make regarding data they have. This can be either through an automated email to a point of contact, or through a webhook to an HTTP(S) API. Otherwise, this feature can be used to keep track of manual processes. Please contact NiX support if you need help with this step.

Configuring Features

Return to the NiX configuration on the Magento 2 dashboard.

The NiX extension is passive by default. This is to allow you to configure and test the extension without any change to the way your store operates or risk to your customers' experience. You can then enable features as you become more comfortable with the extension and with NiX.

The Features section of the configuration allows you to Enable Basic Customer Tracking. If you set this to yes and save, create, update, and delete operations around customer accounts and the personal data of your customers will begin being tracked by NiX. This will only apply to new customers or updates to existing customers. To import all data about existing customers, perform the migration described step below. Note that this tracking does not affect Orders, Invoices, Shipping information, or others. The personal data in those records are covered under separate regulations.

Features Configuration

The Features section also contains Enable Registration User Emails. This feature is currently being redesigned by NiX and is disabled within NiX itself. Please leave it disabled.

The last feature allows you to requests that all NiX requests be queued and performed asynchronously. By default, NiX encrypts data and tracks it in NiX at the time the user makes the request. If an error occurs, NiX puts the request in the asynchronous queue to retry later. We recommend this mode of operation as it leads to faster updates and prevents data getting out of sync, so you don’t need to change this setting. If you are experiencing significant responsiveness degradation that you believe may be related to NiX, you can try enabling this feature to see if responsiveness improves.

Automation

NiX supports automatically removing records from Magento when consumers request that their data be deleted (exercising their right to be forgotten).

There are three levels of automation:

  1. The default which will record that a user's delete has been requested, but the delete must be performed by an administrator in the Magento backend. When the delete is performed, NiX will track the change and delete its corresponding record.

  2. A semi-automated mode which will record that a user's delete has been requested, but then the administrator must acknowledge it and trigger the delete from the NiX dashboard. NiX will then reach into Magento to perform the delete, track the change, and delete its corresponding record.

  3. Fully automated - when the user requests through NiX that their data be deleted, NiX will immediately trigger the delete in Magento, track the change, and delete its corresponding record. No action is required on the part of the administrator.

In the store configuration, there is a second tab under NiX called Automation. The Authorization Key in this tab should be copied into NiX dashboard to enable automation (more on that below).

The tab also has the option to enable the delete endpoint. It is disabled by default, so enable it to use it. This adds API endpoints to your Magento server that are authenticated using the key above. NiX will call these endpoints to trigger deletions.

Migration

Additionally, you can enable email comment support. Magento does not typically allow customers to use emails addresses with comments in them. It is rare, but some NiX customers maybe have migrated data from external systems into their Magento instance that contain comments. These emails will have addresses along the lines of (duplicate123)user@email.com. NiX ignores and removes email comments, so if your production data has comments like this, you should enable this feature too. Note that it may negatively affect performance of these features, so only enable it if you need it.

Migration

Migrating data will create tracking information for all of your existing users. To begin, click Restart. We use a migration cron job that runs once per minute. It should pickup the task the next time it runs. At the bottom of the configuration, you should be able to see the last time the cron job ran and completed.

If you refresh this page and do not see any changes after a few minutes and the Cron Status area doesn’t change, you may not have Magento’s cron job configured properly. Please see the Magento2 documentation on how to set this up.

Migration

This page will not update automatically, but if you refresh the page after a minute or two, you should see that the migration is making progress. Note that errors may occur during the migration, but the migration will attempt to continue. As long as the status says "Running", the errors were not significant enough to halt the migration. The Last Error field shows details of the most recent error that occurred.

While the migration is running, you should begin seeing data and activity in the dashboard. When the migration is completed, refreshing this page will show a status of Completed.

If errors do occur, you can get more details on the NiX Info Log at System > NiX Log. The most common errors are due to customers with invalid email addresses. These can be fixed manually from the Customer > All Customers page. Please contact support with any questions.

Automation in the NiX Dashboard

In the NiX dashboard on the Schema page, you can edit the schema data associated with the customerAccount and customerAddress fields to add a delete webhook to trigger automated deletes from the Magento instance. Click the purple edit icon to the left of the customerAccount field to bring up the schema editor.

NiX Schema Page

  • Scroll to the bottom and select Enable on the Delete HTTP(S) Webhook.
  • Expand the webhook configuration and choose the Magento Plugin template.
  • Fill in the website where Magento is running in place of <MAGENTO_WEBSITE>.
    • Remember to also check HTTP vs HTTPS, the port, and any path prefix with respect to where it is hosted.
  • Copy the authorization key from the NiX Automation tab in the store configuration and replace <AUTHORIZATION_KEY>.
    • Keep the Bearer portion, so it will read something like Bearer q4pjfHvKWptAlkCIcOtE1m8wvfbayt1M5TENBypHRZ0.
    • Make sure you get the full key when copying as it may be longer than the visible part of the text box.
  • Replace <MAGENTO_STORE_ID> with the integer ID of the store on the Magento instance - for example: {"storeID": "1", "email": {{userEmail}}, "fld": {{fld}}, "id": {{id}} }
  • To determine the level of automation:
    • Check "User requests should trigger Webhook without approval" if you want full automation (as soon as the user requests the delete, NiX will attempt to delete data from Magento)
    • Uncheck this box to require administrative approval via the NiX dashboard.
  • DO NOT CHECK API Calls should trigger webhook as this is not supported by the Magento 2 extension.
  • After configuring a Delete Hook, the Dashboard will show the option "Execute Remote Delete Hook" in addition to the "Delete (from NiX)" button on each data element. You may use the "Name" at the top to change the "Execute Remote Delete Hook" text. You may also disable the NiX Action Button -- the button that says "Delete (from NiX)" -- by checking the box at the top or change the text that it will display by giving a NiX Action Name.
  • Save these changes and test it.

You will need to perform these steps twice - once for the customerAccount and again for the customerAddress.

NiX Delete Hook Configuration

If you have selected the semi-automated configuration that requires confirmation, when you are looking at the Data tab or at the data of an individual user on the Users tab, expand the data view and select "Execute Remove Delete Hook" to trigger the remote delete.

Next Steps and Support

At this point, NiX will track your customer accounts and the contact information and other personal details that your customers store in your Magento 2 instance. You should test that you can create a customer account and that creating and deleting addresses and other data updates the corresponding data in NiX. Additionally, you should test the automated delete requests if you configured them.

You can contact NiX to learn about how other services in your ecosystem that are storing personal data can also be integrated into NiX.

Additionally, please don't hesitate to contact NiX with questions, to ask for help, or give us feedback. We're excited that you have taken an interest in what NiX has to offer!