Nodejs with tealium

Silver Contributor
Silver Contributor

Hi everybody!

Can we use technology?:


When I load the page.(2 ways of getting data)


1) Some data ganerates from DataLayer and goes to tealium (via tealium collect) (client side),

2) Other part of data  goes to tealium from another server directly (some info about user)?


we need this technology to increase speed of getting events in audience stream.


Is there some examples of using with NodeJs or other system?





Nodejs with tealium

Tealium Employee

Hi @kuzmin_sergey


If you mean into Audiencestream, then yes you can send data from the collect tag in the browser, and at the same time your web-server could send a vdata pixel to Audiencestream. 


This would certainly be possible using NodeJS.  If you would like help, please can you speak to your account manager, or email 


Many thanks
Steve Lake

Connecting data systems since the 1980s.

Nodejs with tealium

Tealium Employee

Hi @kuzmin_sergey

As @steve_lakementioned, the server side part of this you could do using our vdata pixel

This is described here


There are examples there of how to formulate the pixel using several technologies, using either POST or GET. There isn't a Node.js example, but the principle is the same - you are constructing a http pixel request with the data being represented as query parameters or POST data.


There are a couple of things specific to your server side implementation. I am assuming below you are using the GET approach, see the above article for the differences if you want to use POST.


1. You can pass tealium_trace_id as a query parameter. For your case, you should always do this if the cookie trace_id is present on the incoming request. You should use the value of the cookie as the value of the query parameter, if that trace_id cookie is present. This will allow you to use the trace utility within Tealium tools and see the server side event in the trace.


2. The tealium_vid query parameter should contain the AudienceStream visitor id.

a. If the AudienceStream visitor id already exists, then you can extract it from the utag_main cookie - it is
0156551b8b19000c5defc4035f2e05078004007000bd0 in this example;


b. If this is the visitor's first page impression, or they have cleared their cookies, the visitor id will not exist yet. In that case, if you still want to also fire your server side pixel to AudienceStream, you need to make sure your visitor id is the same one that the AudienceStream tag will use on the page, but you need to generate it on the server.

What I'd suggest here to generate it is generating a md5 hash of a concatenation of the current timestamp, the IP address and the user-agent, as well as a random number.


To get the AudienceStream (collect) tag to use this same value, you can set a cookie from your server, calling it say "server_vid", to this value. If you then add a pre-loader JavaScript extension in Tealium iQ, the collect tag will use this value. The code for this extension is below.


Give this a try and come back to me with any questions.



(function() {
    window.utag_data = window.utag_data || {};
    var getCookie = function(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1);
            if (c.indexOf(name) === 0) {
                return c.substring(name.length, c.length);
        return "";
    var server_vid = getCookie('server_vid');
    if (server_vid) {
        window.utag_data["cp.utag_main_v_id"] = server_vid;