Developer
User guidesDeveloper websiteHelp centerLog in
  • Welcome!
  • Organisations structure
    • Datamart
    • Users and roles
  • User points
    • User identifiers
      • Networks IDs
        • Device-based Network IDs
          • Custom Device ID integration
          • ID5
          • First ID
        • User-based Network IDs
          • Custom User ID integration
          • UTIQ martechpass
      • Accounts
      • Emails
      • Device identifiers
    • User activities and events
    • Compartments
    • User profiles
    • User segments
    • Hyper point & Quarantine
  • Data model
    • Defining your schema
    • Computed fields
      • Concepts
      • Setup
      • Development
      • Examples
  • Data ingestion
    • Real time user tracking
      • Website tracking
      • Mobile apps tracking
      • Ads exposure tracking
      • AMP tracking
      • Conversions tracking
      • Email views and clicks
      • Tracking API
      • Event rules
      • Activity analyzers
    • Bulk processing
      • Imports
        • User activities import
        • User profiles import
        • User choices import
        • Segments import
      • Deletions
        • User identifiers deletion
        • Device points deletion
        • User points deletion
      • User identifiers association
      • Integration batch
    • Activities analytics
    • Data warehouse
      • Preliminary setup
        • BigQuery
      • Create data warehouse
  • Querying your data
    • OTQL queries
    • OTQL examples
    • GraphQL queries
    • UserPoint API
    • User activities
    • Activities analytics queries
      • API Quickstart
      • Dimensions and metrics
      • Use cases
    • Funnel API
  • Alerting
    • Alert configurations
  • Data visualisation
    • Quickstart
    • Dashboards
    • Sections and cards
    • Charts
    • Datasets and data sources
      • Using a data file data source
    • Transformations
    • Filters
    • Cookbook
    • Reference
  • Advanced usages
    • Audience segmentation
      • Audience features
      • Segment builders
      • Audience segment metrics
      • Audience segment feed
        • Building new feeds
        • Monitoring a feed
        • Curated Audiences (SDA)
      • Edge segments
      • Cohort-based Lookalike
    • Contextual targeting
      • Setup
      • Activation
        • Google Ad Manager
        • Xandr (through prebid.js)
      • API documentation
    • Exporting your data
      • Query Exports
      • Datamart replication
    • Data privacy compliance
      • User choices
      • Cleaning rules
      • Exercise of user rights
      • Cookies
    • Campaigns
    • Automations
      • Email routers
      • Email renderers
      • Opt-in provider
      • Custom action plugins
      • Usage limits for automations
    • Plugins
      • Concepts
      • Creation & Deployment
      • Coding your plugin
      • Manage existing plugins
      • Layouts
      • Presets
      • Monitoring
      • Throttling
      • Batching (for external feeds)
    • Platform monitoring
      • Resources usage
        • Dimensions and metrics
      • Collection volumes
        • Dimensions and metrics
      • Events ingestion monitoring
        • Dimensions and metrics
    • Data Clean Room
      • Bunker
      • Clean room
  • Resources
    • Tutorial: Data Ingestion
      • Your first events
        • Add the mediarithmics tag
          • Getting the tag
          • Adding the tag
        • Send events using the tag
          • Adding event properties
          • Finding the UserEvent type in your schema
          • Matching your schema
          • Standard events
      • Your first bulk imports
        • API basics
          • Authentication
          • Your first API call
        • Send documents using the API
          • Requirements
          • Sending documents
    • Using our API
      • Authentication
    • Tools & libraries
      • mics CLI
      • JS Tag
      • Plugin SDK
    • Data cubes
      • Creating a report
      • Reference
Powered by GitBook
On this page
  • How to add event rules
  • Available event rules
  • Property To Origin Copy
  • Url Match
  • User Identifier Insertion

Was this helpful?

Export as PDF
  1. Data ingestion
  2. Real time user tracking

Event rules

PreviousTracking APINextActivity analyzers

Last updated 2 years ago

Was this helpful?

Every time an event is sent, we run the event rules associated with its channel. They are predefined actions to extract properties, reshape data or identify a user from a property.

If the action you wish to do on each event is not possible with an event rule, you should have a look at .

How to add event rules

You can go to a channel's settings, edit, and then scroll down to event rules.

Available event rules

Property To Origin Copy

This Event Rule will help you take an existing property from an event and copy it into the origin of the activity. You can copy:

  • The URL of the Event

  • The Referrer of the Event

  • Any Event Property

Url Match

This Event Rule allows you to write a pattern that will be matched against all the $url values of incoming $page_view events. The pattern can extract some values from the Url Path and from the Url Query String.

Limitations

Url Match only works for $page_view events. Any other event won't be processed by the Url Match event rule.

Please note that $page_view events will be deleted at the end of the activity processing stage.

Use case

Useful if for technical and/or organizational reasons, you can't customize the Tracking JS Snippet on a web page to retrieve information from the data layer.

  1. Use the Url Match event rule to extract properties from the page's URL and add them to the event.

For example, if a $page_view event is tracked with the URL https://foo.bar/category/0001/article/super-awesome-article, you would be able to generate this kind of event

{
    "$ts": 1568296040000,
    "$event_name": "article_view",
    "$properties": {
        "category": "0001",
        "article_id": "super-awesome-article",
        "source": "web"
    }
}

How to

The URL Match is taking 2 parameters:

  1. The URL Pattern that will be used to match the $url value of $page_view events

  2. The event template that will be used to generate the event if the $url is matching the URL pattern

Patterns are URL in which you can add:

  • A variable extraction rule for path parameters with:variableName

  • A wildcard with *

Wildcards can be placed several times in the URL pattern. For instance, you can do https://foo.bar/*.* which will match for a route shaped as https://foo.bar/a/b/c.xls

Example *//foo.bar/category/:categoryId/article/:articleId

  • * at the beginning will match both URLs in and in http in the URL

  • :categoryId will extract the value in the URL corresponding to the categoryId. As it is a named variable, it can be used as a value in the event that will be generated.

  • :articleId works as:categoryId

The Query String values are automatically extracted in variables that have the name of the parameter in the Query String. https://foo.bar/a/b/c?var=value&var2=value2 extracts both value and value2 in variables named var and var2.

The event template is containing the following information:

  • The $event_name that will be used for the generated event as a static string

  • A list of properties in a key-value way that will be added in the event properties

In the properties values you can either pass:

  • A static string directly. Ex: sport

  • A string in the format {{variableName}} that will be replaced by a value extracted in the URL pattern

If a variable used in the event template is not extracted from the URL (either from the path or from the Query String), it's value will be {{variableName}} in the generated event.

Examples

Let's take the following event rule:

  • Url pattern: *//foo.bar/category/:categoryId/article/:articleId

  • Event template:

Property
Value

article_id

{{articleId}}

category_id

{{categoryId}}

visit_origin

{{origin}}

source_event_rule

1

$page_view event with Url: https://foo.bar/category/0001/article/super-awesome-article?origin=email will generate

{
    "$ts": 1568296040000,
    "$event_name": "article_view",
    "$properties": {
        "category": "0001",
        "article_id": "super-awesome-article",
        "visit_origin": "email",
        "source_event_rule": "1"
    }
}

$page_view event with Url http://foo.bar/category/0001/article/super-awesome-article will generate

{
    "$ts": 1568296040000,
    "$event_name": "article_view",
    "$properties": {
        "category": "0001",
        "article_id": "super-awesome-article",
        "visit_origin": "{{origin}}",
        "source_event_rule": "1"
    }
}

$page_view event with Url https://oof.bar/category/0001/article/super-awesome-article will generate nothing as the Url domain (oof.bar) is not matching the pattern.

page_view event with Url https://foo.bar/category/0001/article/super-awesome-article will generate nothing as the "source" event name is not $page_view.

User Identifier Insertion

This event rule allows you to extract a property from an event to convert it into a user identifier, such as an Email Hash or a User Account Id.

You can apply a hash on this extraction. We currently support the following hash methods:

  • SHA_256

  • SHA_1

  • SHA_384

  • SHA_512

  • MD5

  • MD2

This event rule is useful when you don't want to pass an identifier as a global property of the activity, but rather have it computed directly by your datamart.

If several values of an identifier are found within an activity, we keep only the last one.

{
    "$event_name": "PageView",
    "$properties": {
        "user_id": "<USER_ID>"
    }
}

In the scenario above, you will be able to extract the user_id, store it as a User Account Id.

If you want more information about the different parts of an URL,

Use the that will automatically track $page_view events with the URL of the page.

please read this article.
Activity Analyzers
default JS Snippet