Think of your favorite website: how did you find it? Did you use a search engine? Or click on an ad? Or follow a link in a blog post?
Web developers, marketers, and data analysts use that information to improve their sources (sometimes called channels or touchpoints) online. If an ad campaign drives a lot of visits to their site, then they know that source is working! We say that those visits are attributed to the ad campaign.
But how do websites capture that information? The answer is UTM parameters. These parameters capture when and how a user finds the site. Site owners use special links containing UTM parameters in their ads, blog posts, and other sources. When a user clicks one, a row is added to a database describing their page visit. You can see Datagran’s schema for a “page visits” table below.
Datagran’s web pixel generates raw logs in the form of a table. Below is the Schema of the basic elements:
JSON_EXTRACT
function to transform into JSON i.e. JSON_EXTRACT(dynamic_payload, '$.utm_source')
. You can find utm parameters here.
{"title": "Datagran", "url": "[<https://www.datagran.io/>](<https://www.datagran.io/>)", "ref": "[<https://www.google.no/>](<https://www.google.no/>)"}
{"en": "Visit GT 1m", "ep": {"User id": "Capture from Cookie"}}
{"tag": "a", "class": "navlink w-inline-block", "id": "", "text": "", "anchor": "", "pu": "[<https://www.datagran.io/>](<https://www.datagran.io/>)"}
User table:
dg_tracker.identify('useridentify')
function)