How to edit a tag to fire after pageload?

Bronze Contributor
Bronze Contributor

I want to fire a Facebook Conversion pixel when a user presses a button on a page.

As per another answer here, I went ahead and adjusted the template so that it has the following line:

u.ev = {"view" : 1, "link": 1};

Now that I try to push the event, I don't think the tag is firing. I added a debugger statement at the beginning of the tag template so that I would know if it fired. When I click the button, the console doesn't pause. The button has the following attribute:

onclick="utag.view({ga_category:"something", ga_action: "something else"});

The "something" and "something else" match up to the load rule in TiQ.

What steps can I do to test that it is working? And, am I implementing this properly?


How to edit a tag to fire after pageload?

Employee Emeritus

It sounds like you have a race condition happening and here are a couple suggestions on how to address this.

1) set a cookie on button click, then on the next page fire the pixel and clear the cookie.
2) bundle the tag in utag.js to reduce the network call on button click and hopefully this will be fast enough to fire the pixel before the page changes. With this solution, you will most likely want to track the "click" with Tealium jQuery handler set to mousedown and not click to buy you a couple hundred milliseconds.

Last if you want to test, turn on the Tealium debugger:
and check the box in Chrome Developer Tools Console for "Preserve Log"

One more piece of information I see in your question. You only need to enable "link":1 if you are using, if you are using utag.view, you do not need to enable link.

If this is not enough information, please reach out to your Account Manager and an Engineer can look at your specific case.

Thank you.