Event tracking with utag.link() not working sometimes

I implemented event tracking for a website which uses the utag.link() method to send out the events. This works consistently on our dev and staging systems but on our production system it works very erractically (I would say around 40% of the time).

When it doesn't work, I get this console log: 

 

17:08:23.129 utag.js:45 trigger:link
17:08:23.129 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu"}
17:08:23.129 utag.js:45 trigger:called before tags loaded
17:08:23.129 utag.js:45 Tag 6 did not LOAD

When it does work, I get this:

 

 

17:08:50.832 utag.js:45 trigger:link
17:08:50.832 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu"}
17:08:50.832 utag.js:45 utag.loader.RD
17:08:50.832 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu"}
17:08:50.833 utag.js:45 Read page variables
17:08:50.834 utag.js:45 ReferenceError: js is not defined
    at Object.utag.pagevars (utag.js:66)
    at Object.RDpv (utag.js:14)
    at Object.RD (utag.js:15)
    at Object.trigger (utag.js:55)
    at Object.track (utag.js:46)
    at Object.link (utag.js:46)
    at VM4778 index.js:9
17:08:50.834 utag.js:45 RE: blr
17:08:50.834 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}
17:08:50.834 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}
17:08:50.834 utag.js:45 Load Rules
17:08:50.834 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}
17:08:50.834 utag.js:45 {13: 0, 14: 0, 15: 0, 16: 0, 20: 0, 28: 0}
17:08:50.835 utag.js:45 RE: alr
17:08:50.835 utag.js:45 All Tags EXTENSIONS
17:08:50.835 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}
17:08:50.835 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}
17:08:50.835 utag.js:45 SENDING: 6
17:08:50.835 utag.js:45 RE: end
17:08:50.835 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}
17:08:50.836 utag.js:45 {at_event_type: "action", event_name: "header_click", event_category: "content interaction", event_action: "header_open", event_value: "menu", …}

 What could I be doing wrong? Any pointers?

 

Accepted Solutions (1)

Accepted Solutions (1)

I opened a support ticket and with the help of a very skilled technician was able to find the solution to my problem:

 

We are using server side rendering for our website. Due to this, there was some issue with the tracking being initialized twice (once during the prerender and once during the page load) and then scripts being executed in the wrong order. I solved this by not running the tracking initialization during prerender (by checking whether the user agent is controlled by automation with navigator.webdriver [docs])

Rookie Contributor

Answers (1)

Answers (1)

By the way, I'm using the Tealium UTAG Debugger Chrome extension to test wether calls worked or not.

Rookie Contributor