Question

How to add hidden html to the article?

  • 19 September 2022
  • 9 replies
  • 89 views

Userlevel 3
Badge +1

We would like to add following html code to the each and every article we create:

<div data-xxxid="xxxyyy"> </div>

I find the source code editor from article editor to add the code but when I add it the editor “cleans” it to the following form:

<div>&nbsp;</div>

How to do this in a right way?

We want to use this code to follow it with Google Analytics. With that code we can track certain author and how many times author´s articles are read.


9 replies

Badge

Howdy!

I found a recent answer that might help. :)

You can’t add that HTML directly to articles I’m afraid as it’d be a massive security risk. If you try anyway, it gets converted to regular text and treated as text, not as code.

Userlevel 3
Badge +1

Ok, this is setback. Our current community this is possible.

Is there way to find how many views certain author and his/hers articles has?

Badge

The best I can think of is by using a third-party analytics tool in general and drill through the data to find what you’re after, or checking to see whether the default analytics in Control is capable of doing this.

It’s worth noting that end users/community members (such as your customers) should NEVER be able to post unfiltered HTML/CSS/JS and be allowed to execute it as code. It’s a massive security risk that has been patched out of most modern forum software these days so that it doesn’t work anymore. Even ancient versions of phpBB 3.x don’t allow it by default!

This is just a personal thought, but if your current community allows anyone to do this, you might want to turn that ability off ASAP, otherwise your current community could be at risk of being hacked.

Userlevel 3
Badge +1

Thanks. I said “we would like to add”, it means that we as a admin.

Userlevel 2
Badge +3

Sorry to hear you were not able to find a solution so far… maybe @matt enbar or @bas could share their knowledge here?

@revote as @Blastoise186 mentioned that will be stripped from the html

We do have an article about using third party scripts for analytics like GA that may help 

 

Userlevel 3
Badge +1

Thanks. We will add GA scripts to the platform, of course, but GA doesn't tell who is the author. We want to have this kind of data:

  • Author xxx, articles has yyy views 
  • Author zzz, articles has qqq views
  • And so on

@revote there is the ability to send custom analytics events with tools like GA or mixpanel.

We also offer via our Pro Serve department assistance in setting up custom analytics events. If you are interested in learning more about this please let me know and I will be happy to set up a consultation with you.

Userlevel 3
Badge +1

@revote there is the ability to send custom analytics events with tools like GA or mixpanel.

We also offer via our Pro Serve department assistance in setting up custom analytics events. If you are interested in learning more about this please let me know and I will be happy to set up a consultation with you.

Thanks, I will speak internally first and I’ll get back to you if needed.

Reply