DPO Radio

Free Website Privacy Check: Ensure Your Site's Compliant Now!

Install Guide on Web | AesirX Analytics

Step-by-step guide:

Step 1: Create an AesirX Account

  • Visit https://signup.aesirx.io/.
  • If you don't have an AesirX account, click on the option to create one.
  • Enter your email address, choose a privacy ID, and select "First Party Analytics" from the Solutions drop-down menu.
  • Enter your domain name and click "Verify" to submit your request.
  • Check your email (including spam folder) for a confirmation message containing your license ID.

image5.png

Step 2: Download Analytics

Download analytics.js from https://github.com/aesirxio/analytics/releases/latest.

Step 3: Add file

Copy file analytics.js to your project

Step 4: Enviroment

Add script to head

copy icon
<script>
  window.aesirx1stparty = "https://example.com"
  window.aesirxClientID="[REPLACE THIS WITH THE PROVIDED CLIENT_ID]"
  window.aesirxClientSecret="[REPLACE THIS WITH THE PROVIDED CLIENT_SECRET]"
</script>
<script async defer src="YOUR_PROJECT_PATH/analytics.js"></script>

(https://example.com is the link to your 1st party server)

(CLIENT_IDreplace this with the provided CLIENT_ID from https://dapp.shield.aesirx.io/licenses

(CLIENT_SECRET replace this with the provided CLIENT_SECRET from https://dapp.shield.aesirx.io/licenses

- Disable Consent Popup

copy icon
<script>
  window.disableAnalyticsConsent = "true"
</script>

Track events

To track events, simply add special data-attribute to the element you want to track. For example, you might have a button with the following code:

copy icon
<button
  class="button"
  data-aesirx-event-name="sign up"
  data-aesirx-event-type="login"
  data-aesirx-event-attribute-a="value-a"
  data-aesirx-event-attribute-b="value-b"
>
  Sign Up
</button>

Add data-attribute with the following format:

copy icon
data-aesirx-event-name="<event-name>"
data-aesirx-event-type="<event-type>"
data-aesirx-event-attribute-<attribute-name-1>="<attribute-value-1>"
data-aesirx-event-attribute-<attribute-name-2>="<attribute-value-1>"

Or you can use your own Javascript to Track events:

copy icon
window.trackEventAnalytics(endpoint, referer, data)

(endpoint is the link to your 1st party server which must be installed)

(event_uuid is the params get from url - it will auto generated)

(visitor_uuid is the params get from url - it will auto generated)

(referrer is the referrer domain)

(data is the data you want to track)

For example:

copy icon
trackEventAnalytics("https://example.com", "https://aesirx.io", {
  event_name: "<event_name>",
  event_type: "<event_type>",
  attributes: [
    {
      name: "<name-1>",
      value: "<value-1>",
    },
    {
      name: "<name-2>",
      value: "<value-2>",
    },
  ],
});

Opt-in Consent

copy icon
<script>
    window.optInConsentData = `[
      {
        title: "payment",
        content: "<div>YOUR_CONTENT_INPUT_HERE</div>",
      }
    ]`;
</script>

(We also provive option replaceAnalyticsConsent to replace Analytics Consent with Opt-in Consent)

copy icon
<script>
    window.optInConsentData = `[
      {
        title: "payment",
        content: "<div>YOUR_CONTENT_INPUT_HERE</div>",
        replaceAnalyticsConsent: "true",
      }
    ]`;
  </script>

Enjoyed this read? Share the blog!