Use your own logging option
If you wanted to log something during development, you probably used the javascript console.
But if this happens in several places, from different scripts and by different colleagues, it quickly becomes very confusing. That’s why I have extended MOPPI with the possibility of your own logging.
You can now pass logging calls directly to MOPPI and see there what you have logged when and on which page.
All you have to do is use a recent MOPPI version (1.9.0 Janus or higher) and insert a script into your Optimizely project Javascript. You will find this in your project under setting – javascript. Then insert the following code snippet there:
console.optly = function( name, type, data )
{
var logit = true; if ( ( typeof name !== "string" ) || ( typeof type !== "string" ) ) logit = false;
if ( logit ) { window.dispatchEvent(new CustomEvent('MOPPI_LOG_FIRED',{ detail: { "name": name, "type":type, "data":data } } )); return true; }
else { console.error("MOPPI log request failed."); return false; }
};
Once you have done this, you can integrate simple logging commands into your scripts. These require three parameters:
- a text for logging ( string )
- a type of logging entry ( string )
- additional data ( string, number, object, array, undefined or null )
The call is very straightforward:
console.optly( myText, myType, myData );
That’s all there is to it. A call could look like this, for example:
console.optly( "object is incomplete", "alert", {"key1":"value1"} );
How to find the log in MOPPI
In MOPPI itself you will find a new tab called “Log”. ( For this tab you will find all the adjustable options analogous to all other tabs in the extension settings )
As you have probably already recognised, you can see in the name of the tab itself how many log entries are stored. The entries themselves are summarised per URL and also visually separated.
Each entry itself shows you the type followed by the respective name. Below that, you will find the type of the transferred data as well as the data itself.
For the chronological classification, you can see the time at which each entry was recorded in the top right-hand corner.
Of course, you can also delete the entire log. To do so, simply use the bin symbol at the top right next to the heading.
Minor modifications in detail
- The reference to the possibility of supporting this project financially via PayPal has been removed. Instead, you will now find a link to this homepage for MOPPI at the bottom right of the MOPPI window.
- The web tab has also been removed as the homepage link is now available.
Who was Janus ?
Janus was the Roman god of the beginning and the end. He belongs to the oldest Roman gods and to the original Roman mythology. He is a purely Roman god and has no equivalent in Greek mythology. His cult was extremely well known in Rome, but was also found in some Roman colonies, such as Dalmatia on the Adriatic.
More about MOPPI
If you want to learn more about the full functionality of MOPPI, you can find a feature overview and some tutorials here:
Sorry, but the next block is in German.
Sie optimieren bereits selbst und suchen einen Optimizely Freelancer?
Gerne unterstützen wir Sie auch bei er Überbrückung kurz- oder mittelfristiger Engpässe Ihrer eigenen Kapazitäten. Sprechen Sie uns einfach an. Gemeinsam finden wir sicher eine Lösung.
Unsere Optimizely Kompetenzen sind umfassend, professionell und durch jahrelange Erfahrung geprägt. Wir können Sie auf jedem Level unterstützen, unabhängig davon, ob Sie erst starten oder bereits sehr erfahren im Umgang mit diesem führenden Tool sind.