Highlighted

Is there a simple way to add HTML?

pafe
Gold Contributor
pafe

Hi, 

I need to add HTML to our website. The HTML code is for a MailChimp popup that needs to be integrated on the website. How can I do that?

It would be a very easy task with the Google Tag Manager. But it seems that Tealium does not have a html tag. Right? 

Thank you and kind regards,

4 REPLIES 4

Is there a simple way to add HTML?

simlev
Rookie Contributor
simlev

Hi pafe,

Thanks for the great question.

I believe that Extension "Content Modification" is what you a looking for.

It allows to insert HTML into DOM on page if you know how to identify position.

Can you share a use case that you need modify HTML on page via Tag Manager?

Thanks,

Is there a simple way to add HTML?

pafe
Gold Contributor
pafe

Hi @simlev,

Thank you for the hint. The code I need to include is as follows:

<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>

<script type="text/javascript">window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us18.list-manage.com","uuid":"####","lid":"#####","uniqueMethods":true}) })</script>

Thank you very much!

Kind regards, 

pafe

Is there a simple way to add HTML?

UnknownJ
Tealium Expert
UnknownJ

The proper way to do this within Tealium would be to add a custom tag that references the MailChimp JS.

That said, the quick way would be to simply inject the script, and then use its onload attribute to execute the code in the second snippet. If you try to load it as it's presented below, what'll happen is that the first script will be loading asynchronously while the second snippet is trying to execute, which causes nasty race conditions that are likely to make the tag fail.

You'll want code along the following lines:

(function(d, script) {
    script = d.createElement('script');
    script.type = 'text/javascript';
    script.async = true;
    script.onload = function(){
        window.dojoRequire(["mojo/signup-forms/Loader"], etc...
    };
    script.src='//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js';
    d.getElementsByTagName('head')[0].appendChild(script);
}(document));

This places the second snippet into a function that executes only upon the load of the first script. This example doesn't include the dojo-config attribute because both usePlainJson=true and isDebug=false are the defaults, so there seems to be little need..

Is there a simple way to add HTML?

pafe
Gold Contributor
pafe

Hi @UnknownJ ,

Thank you very much!

Kind regards,