Query parameters
Updated
by Ole Dallerup
You can use URL query parameters in your links to pass User ID, Anonymous ID, User Email, Group ID, and Group Website information to be picked up by the Dreamdata analytics.js script.
When parsing in either User ID, Anonymous ID or Email identifies will happen automatically. This can be useful if you want to track users across different websites or to ensure users are identified automatically when clicking a link in a email.
When parsing in either Group Id or Group Website the analytics.js script automatically does a group call, which is a different way of saying it associating the users activities to the company representing the id and/or website.
Information | Event | Query parameter | Example |
User ID | identify | ajs_uid | ajs_uid=1234 |
Anonymous ID | identify | ajs_aid | ajs_aid=d66123be-4903-4123-90c8-bce5bf1237b |
User Email | identify | ajs_trait_email | ajs_trait_email=test@dreamdata.io |
Group ID | group | ajs_gid | ajs_gid=5678 |
Group Website | group | ajs_group_website | ajs_group_website=dreamdata.io |
Url example:
www.yourdomain.com?ajs_uid=1234&ajs_aid=d66123be-4903-4123-90c8-bce5bf1237b&ajs_trait_email=test@dreamdata.io&ajs_gid=5678&ajs_group_website=dreamdata.io
Breakdown of parameters and their use-cases
User ID
The users' unique identifier.
Anonymous ID
The anonymous' unique identifier.
User Email
Email address of the user clicking the link. You can example use it for email campaigns, which ensures that Dreamdata can track the users' activities after clicking the link.
Group ID
It is used to set the group/company unique id that is associated with an user.
It can be used when tracking a specific company. Still, you don't know who from that company might follow the link. It could be because of privacy reasons are not having the data able to parse the user specific information along.
It can be useful when doing Account-Based Marketing (ABM).
Group Website
The group website follows the same principle as the Group ID. However, instead of parsing in the company unique id you parse in the company website.
It's often used when you are targeting a specific company and cannot parse user-specific information along. For example, when you don't have the data, such as when displaying an ABM target ad, or when you, for privacy reasons, can't parse along with PII data for the user, for example in cold outreach situations.
Cross Domain Tracking
If you want to track users cross two different domains example mywebsite.com and mywebsite.io cookies won't do it as they are not shared cross domain.
However if you add anonymous id to all links cross domain the Dreamdata analytics.js will be able to associate activities on both domains the same user. Similar to if the user would have been identified with the same email on both domains.
Here below is a script that will add the anonymous id to all links on that sites that point to either mywebsite.io or mywebsite.com. The script will load when the Dreamdata analytics.js script has been loaded.
window.analytics.ready(function () {
const addParam = function (url, param, value) {
param = encodeURIComponent(param);
var a = document.createElement('a');
param += (value ? "=" + encodeURIComponent(value) : "");
a.href = url;
a.search += (a.search ? "&" : "") + param;
return a.href;
}
// ** TODO: update host list **
const hosts = ["mywebsite.io", "mywebsite.com"];
var anchors = document.getElementsByTagName('a');
for (var i = 0; i < anchors.length; i++) {
var url = new URL(anchors[i].href)
if (window.location.host != url.host && url.protocol.includes("http") && hosts.includes(url.host)) {
anchors[i].href = addParam(anchors[i].href, 'ajs_aid', analytics.user().anonymousId());
}
}
});