ePrivacy and GPDR Cookie Consent by Cookie Consent Skip to main content

How to deploy Meiro Events on the website

Create Meiro Events server 

Below is the sequence of steps to follow for setting up Meiro Events SDK on your website:

  1. The Meiro IT team will create a Meiro Events server that runs only for your website.
  2. Your technical point of contact at Meiro will send you the public IP address of the Meiro Events server. 

Set up DNS records for Meiro Events on your own domain

    3. You need to set up one DNS record of type A. 

    • For instance, “example.com” is an example domain where your web page runs, and you want to deploy Meiro Events to the “me.example.com” subdomain. The subdomain can be anything you choose as long as it is a subdomain. The DNS records for web "example.com" with Meiro Events running at "me.example.com" will need the following DNS record:

Type: A, domain: me.example.com, destination: IP address of the ME

   4. Inform the Meiro team once it is completed.   
   5. Meiro’s IT team will reconfigure your Meiro Events server to accept the connection and use SSL termination from the newly created DNS endpoint.

Deploy Meiro Events basic tracking scripts on your website

   6. After the DNS record is set up, the following script needs to be included in the website's head (after <title> HTML tag).           This script needs to be placed on EVERY page on your website, it needs to always be present on the web. 

   7. Specify the collector’s domain (for example "me.example.com") and define the events you want to track. 

  8. The script assumes the source will be served from //{{COLLECTOR_DOMAIN}}/sdk/ location and it handles events by collecting POST requests on {{COLLLECTOR_DOMAIN}}/ API route.

Learn more: about how to exclude specific domains from being tracked with outboundLinkClick

<script type="text/javascript">
  (function () {
    var domain = "{{COLLECTOR_DOMAIN}}";
    var script = document.createElement("script");
    script.onload = function() {
      MeiroEvents.init({
        domain: domain,
        sync: {
          ga_cid: true,
          fb_cid: true
        },
        outbound_link_tracking: {
          enabled: true
        }
      });
      MeiroEvents.track("pageView");
    };
    script.src = "//" + domain + "/sdk/";
    script.async = true;
    document.head.appendChild(script);
  })();
</script>

Remember: By default, after inserting the above code into your website, Meiro Events will collect Outbound Link Click and Page View. It is also possible to track other types of events including  Custom Event and Contact Form.

Remember: The SDK has the capability for users to specify if customers have consented to the storage of cookies and local storage items in the configuration of init() method. If consent is given, these items will be permanently stored. If consent is not given, they will automatically be deleted upon the end of the user's session. In the absence of any specifications, the items will be stored permanently. You can easily update the consent configuration later using the updateStorageConsents() method.

Remember: The SDK automatically gathers Facebook, and Google client IDs, but this functionality can be customized using the sync config object passed into the MeiroEvents.init method.

Warning: Placing it in a different place may result in an empty document.title in pageView event).

Warning: Please double-check for any typos as they may result in Meiro Events not working as expected. 

Warning: The script can be deployed using any tag manager as long as you ensure data from dataLayer are propagated properly. This is not recommended though as using the deployment with tag manager may cause data loss. 

Warning: Please note that a separate ME SDK needs to be implemented if your website has a language mutation site with a different structure, renamed selectors, or renamed form input names. For more information, please contact the Meiro team.

    9. Begin with the most straightforward and secure option, which can be modified later on: execute the script only after the visitor has granted their consent.

Storing UTM parameters

    10. In scenarios where a user arrives via a campaign with designated UTM parameters embedded in the URL, a subsequent click to another page, followed by granting consent, can result in the loss of UTM parameters from the URL. To address this, save the UTMs to local storage on the first visit and add them as custom_payload to the first pageview tracked after consent is given. Read more on this step here.


Learn more: How to verify that Meiro Events SDK has been correctly implemented.

Learn More: How are Meiro Events different from Google Analytics & Google Tag Manager

Learn more: How to collect page view events from the single-page application.

Learn more: All events possible to track

Learn More: Events: custom events (optional)

Learn More: Events: contact forms (optional)

 FAQs

Is the DNS record required internally and externally (public)?

The DNS record has to be a public record as it is for public usage.

What would be the source clients connecting to this DNS record?

It will be for general website visitors.

Why is there a need for the wildcard DNS A record *.me.example.com

Wildcard *.me.example.com is needed due to the backwards compatibility with the older version of Meiro Events without changing the collector's domain in the website script.