Third party tag - using Data Elements

Avatar

Avatar
Ignite 1
Level 2
_Lukasz_
Level 2

Likes

4 likes

Total Posts

33 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Ignite 1
Level 2
_Lukasz_
Level 2

Likes

4 likes

Total Posts

33 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Boost 3
Boost 1
View profile
_Lukasz_
Level 2

15-10-2015

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.

Any ideas/hints?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 1
Level 2
_Lukasz_
Level 2

Likes

4 likes

Total Posts

33 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Ignite 1
Level 2
_Lukasz_
Level 2

Likes

4 likes

Total Posts

33 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Boost 3
Boost 1
View profile
_Lukasz_
Level 2

15-10-2015

That works. Thank you Cleve.

Answers (4)

Answers (4)

Avatar

Avatar
Validate 1
Level 1
laura_vl
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
laura_vl
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
laura_vl
Level 1

28-09-2016

Hi Parit,

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. 

Thanks again,

Laura

Avatar

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

93 likes

Total Posts

817 posts

Correct reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

93 likes

Total Posts

817 posts

Correct reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

26-09-2016

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.

However the other round to this add your tag as Non Sequential Javascript like below:

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 

Parit Mittal

Avatar

Avatar
Validate 1
Level 1
laura_vl
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
laura_vl
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
laura_vl
Level 1

22-09-2016

How do you do this with Non-Sequential HTML for event-based rules?

Avatar

Avatar
Validate 1
Level 2
Cleve_Young
Level 2

Likes

7 likes

Total Posts

19 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
Cleve_Young
Level 2

Likes

7 likes

Total Posts

19 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
Cleve_Young
Level 2

15-10-2015

In the sequential HTML you can pull in the Data Element value by wrapping the name with %%. Example: 

  1. <img src="https://someurl.com/?c=stats&orderid=%orderid%" width="1" height="1">