Adding event properties

Let's add some properties to our event, for example the category of the product viewed by the user.

<script type="text/javascript">
    /* YOU SHOULD NOT EDIT THIS PART */
    !function(a,b,c){"use strict";function d(a){var b=e[c]||{};e[c]=b,b[a]||(b[a]=function(){e._queue[c].push({method:a,args:Array.prototype.slice.apply(arguments)})})}var e=a.scimhtiraidem||{},f="init call config push pushDefault addProperties addProperty onFinish onStart _reset".split(" ");e._queue=e._queue||{},e._names=e._names||[],e._names.push(c),e._queue[c]=e._queue[c]||[],e._startTime=(new Date).getTime(),e._snippetVersion="2.0";for(var g=0;g<f.length;g++)d(f[g]);a.scimhtiraidem=e,a[c]=e[c];var h=b.createElement("script");h.setAttribute("type","text/javascript"),h.setAttribute("src","https://static.mediarithmics.com/tag/1/tag.min.js"),h.setAttribute("async","true"),b.getElementsByTagName("script")[0].parentNode.appendChild(h)}(window,document,"mics");

    mics.init("<SITE_TOKEN>");

    mics.push(
        "product-view",
        {
            "category_id": 53,
            "category_name": "Smartphones"
        }
    );
</script>

As you can see, you can add any additional information with your event. However, if you want the events you send to be correctly interpreted by mediarithmics, you have to make sure that the properties you send match you schema configured for the datamart your channel (site) is attached to.

Last updated