We are currently using Wordpress where we have a plugin to insert third party tags. There we can use shortcodes for parameters such as order id. E.g.:
<img src="https://someurl.com/?c=stats&orderid=[orderid]" width="1" height="1">
We need to move a lot of pixels from Wordpress to DTM and I'm looking for an easy way for Marketers to do it, without overwriting the code like this:
document.write('<img src="https://someurl.com/?c=stats&orderid=' + _satellite.getVar('orderid') + '" width="1" height="1">');
An easier way would be something like this (this time, the Sequential HTML would be used):
<img src="https://someurl.com/?c=stats&orderid=<script>_satellite.getVar('orderid');</script>" width="1" height="1">
It would be easier as you would need to replace the '[orderid] with '<script>_satellite.getVar('orderid');</script>' This however simply returns the '<script>_satellite.getVar('orderid');</script>' for the orderid parameter.
Solved! Go to Solution.
Hi Laura ,
Non- sequential HTML tags are injected as hidden iframes Hence iframe can’t get all the same information the parent page can. This includes many data elements- for security reasons, it can’t reference a data element that pulls from Custom JS or JS objects. If you’re referencing a data element, you need to use “%dataElementName%” rather than “_satellite.getVar(“dataElementName”)” as _satellite method doesn't work inside iframe. This isn’t the most supported usage, so definitely test it thoroughly.
var dcIMG = document.createElement('img'); dcIMG.setAttribute('src',"https://someurl.com/?c=stats&orderid="+ _satellite.getVar('orderid') ); dcIMG.setAttribute('height','1'); dcIMG.setAttribute('width','1'); document.body.appendChild(dcIMG);
Thanks & Regards
Thanks so much for your response. This is a similar solution to the one I had as well, but I needed to place the code within the "custom rule" section at the top of the tag (and set it to 'return true' to ensure it fires) in order for this to work. Without placing it here I was getting a HTML header content-type error when I tried to append the tag.
Although not clean, this solution seems to be working now.