SOLVED

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Go to solution
Dean548
Level 2

Cant add tracking snippet because Marketo keeps removing <style> tags

Hi,

 

I’m currently testing Email On Acid's Analytics feature, and I need to add a tracking code snippet to my email for it to work. However, when I paste the code into the HTML source editor and click save, Marketo automatically removes the <style> tags. Is there a way to prevent this from happening?

 

Unfortunately, I can't use the 'Edit Code' option to insert the tracking code because my email template contains dynamic content that cant be removed this is why I'm trying to add the code directly through the HTML source editor.

 

Thanks you in advance 🙂

2 ACCEPTED SOLUTIONS

Accepted Solutions
Dave_Roberts
Level 10

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Marketo's Rich Text Editor rejects <style> tags, that's the expected behavior.

 

That said, be warned: using the Edit Code feature in an email will break the connection between the email and your template and could render the modules panel obsolete for that specific email asset. I'd avoid using that as much as possible as often as possible. There's almost always a better way to edit email code in the Email 2.0 version than to use the Edit Code functionality. 

 

The best way to setup a <style> tag that you need to be on an email asset would be to add it at the template level and then reapprove the template and the email assets hanging on that template. 

 

 

View solution in original post

Dave_Roberts
Level 10

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Hey @Dean548 it'll be easier to give you a for sure working answer if you can post a couple of the EoA tracking snippets you'd be using to help identify what is unique in the snippet and what is not.

 

As a cursory explanation, the tracking snippet should contain bits that are unique and bits that are not. 
Here is an example from https://www.emailonacid.com/help-article/how-to-get-started-with-email-analytics-d1/

Dave_Roberts_0-1726779564299.png

There's a lot of info packed into the <style> line and the <div> containers and most of it probably repeats from code-to-code. The part that jumps out at me immediately is the "http://yTaRoFL4L6S.eoapxl.com/yTaRoF4L6S/" that is in the <style> tag as a content:url("....") and in the <img> as the src="...". I'd guess that's the unique piece of the code that you'd want to replace with a string variable so that you could place the entire bit of code into your template and then update the tracking code (the URL above) using a string variable so that it's unique on each page. 

I wish there was a text-version of the code snippet that I could copy/paste here to set you up rather than having to retype all of it, but if you can share an example of a few snippets, it'll be easy to identify and set you up with a solution. 

 

At the end, the code should end up looking something like this for context:

<style> ... {#_eoa_div::before  content: url('${Unique_EOA_URL_StringVariable}');} ...</style>
...
<img src="${Unique_EOA_URL_StringVariable}" ...>

If setup this way, you could then build a string variable into your template to update this with the URL piece you get from EoA from email-to-email at the Email Editor level.

View solution in original post

8 REPLIES 8
KevinHaa
Level 1

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

The usual procedure, to add EAO to Emails with dynamic content:

 

Remove the dynamic content from Email.

Use EAO on Email with "Edit Code".

Add the dynamic content again.

 

If I remember correctly, it does not even have to be all dynamic content to be removed for EAO to be applied.

Just the topmost one if this has a snippet.

 

Cheers

 

 

Dave_Roberts
Level 10

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Marketo's Rich Text Editor rejects <style> tags, that's the expected behavior.

 

That said, be warned: using the Edit Code feature in an email will break the connection between the email and your template and could render the modules panel obsolete for that specific email asset. I'd avoid using that as much as possible as often as possible. There's almost always a better way to edit email code in the Email 2.0 version than to use the Edit Code functionality. 

 

The best way to setup a <style> tag that you need to be on an email asset would be to add it at the template level and then reapprove the template and the email assets hanging on that template. 

 

 

Dean548
Level 2

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Thanks that makes sense why the tags keep getting removed!

 

The problem with that solution is that the EOA tracking code is unique If I apply it to the email template, every email sent using that template will have the same tracking code and I can't keep creating new templates for each email that I want to add a EOA tracking code otherwise ill end up with way too many templates. Do you have any other ideas?

SanfordWhiteman
Level 10 - Community Moderator

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

The entire snippet doesn’t change. You can add the dynamic parts as a mktoString variable, which is set per-email-asset.

Dean548
Level 2

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

I'm not following what your trying to explain here would you be able to share any screenshots or documentation as an example? 

SanfordWhiteman
Level 10 - Community Moderator

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Please post 2 different EOA snippets for 2 different emails, I’ll show you what goes where.

 

Make sure to use the syntax highlighter (“Insert/Edit Code Sample”) when providing code.

Dave_Roberts
Level 10

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

Hey @Dean548 it'll be easier to give you a for sure working answer if you can post a couple of the EoA tracking snippets you'd be using to help identify what is unique in the snippet and what is not.

 

As a cursory explanation, the tracking snippet should contain bits that are unique and bits that are not. 
Here is an example from https://www.emailonacid.com/help-article/how-to-get-started-with-email-analytics-d1/

Dave_Roberts_0-1726779564299.png

There's a lot of info packed into the <style> line and the <div> containers and most of it probably repeats from code-to-code. The part that jumps out at me immediately is the "http://yTaRoFL4L6S.eoapxl.com/yTaRoF4L6S/" that is in the <style> tag as a content:url("....") and in the <img> as the src="...". I'd guess that's the unique piece of the code that you'd want to replace with a string variable so that you could place the entire bit of code into your template and then update the tracking code (the URL above) using a string variable so that it's unique on each page. 

I wish there was a text-version of the code snippet that I could copy/paste here to set you up rather than having to retype all of it, but if you can share an example of a few snippets, it'll be easy to identify and set you up with a solution. 

 

At the end, the code should end up looking something like this for context:

<style> ... {#_eoa_div::before  content: url('${Unique_EOA_URL_StringVariable}');} ...</style>
...
<img src="${Unique_EOA_URL_StringVariable}" ...>

If setup this way, you could then build a string variable into your template to update this with the URL piece you get from EoA from email-to-email at the Email Editor level.

SanfordWhiteman
Level 10 - Community Moderator

Re: Cant add tracking snippet because Marketo keeps removing <style> tags

On a side note, I love how they don't mention this won't work in Outlook without images enabled.