Using the Performance Timing Plugin - adobe-analytics

I'm tyring to implementing the timingPerformance plugin through Adobe DTM. Everything is configured (at least to my knowledge), but there aren't any events triggering.
Here's a snippet of code that's set up within DTM. Note that I've removed all the respected plugins so that it Isn't such a big post. But the necessary functions have been added.
When I jump to a secondary page to test the values, I would expect to see the listed events and eVar, but this is not the case. All I see is the eVar that is collecting my previous page name value, but no events.
s.pte = 'event110,event111,event112,event113,event114,event115,event116,event117,event118,event119'
//[--------------------------- 1 to 8 ---------------------------][-- 9 --][- 10 -]
s.ptc = false;
/*****Plugin Section*******/
s.usePlugins = true
function s_doPlugins(s) {
_satellite.notify("doPlugins fired:" + document.readyState);
/* Previous Page Name */
s.prop55 = s.eVar77 = s.getPreviousValue(s.pageName, 's_ppn');
/* Percent Page Viewed */
/* Pre-requisite: Previous Page Name */
var ppv = s.getPercentPageViewed(s.pageName); //get array of data on prev page % viewed
if (ppv && typeof ppv == 'object' && ppv[0] == s.prop55) { //if ppv array returned and prev page id matches prev page name
s.prop56 = s.eVar78 = ppv[1] + '|' + ppv[2];
}
/* Time Parting Tracking */
var tp = s.getTimeParting('n', '-7');
s.prop44 = s.eVar55 = tp;
/* Performance Timing */
s.eVar77 = s.getPreviousValue(s.pageName, 'gpv_v77', ''); //Record the previous page name in the designated eVar of your choice
//s.performanceTiming('list2') //List variable if one is neededd
/* Pre-requisite: Previous Page Name */
}
Am I missing something or not calling something correctly?

As indicated in the comments the performance timing plugin uses the s.performanceTiming(); to trigger the actual plugin. With that being said here is how it should be configured in order to properly work.
The s.pte is the call for which determines whether or not to execute the actual plugin.
`s.pte = 'event10,event11,event12,event13,event14,event15,event16,event17,event18,event19'
//[--------------------------- 1 to 8 ---------------------------][-- 9 --][- 10 -]
s.ptc = false;`
Next is to initialize the plugin that is set within the doPlugins section of the s_code.
/* Performance Timing */
s.eVar9 = s.getPreviousValue(s.pageName,'gpv_v9',''); //Record the previous page name in the designated eVar of your choice
s.performanceTiming('')
Note: Adobe Analytics documentation references a "list" option within the s.perfomaceTiming('list2)` call itself. This list is optional and is not required; therefore, removing "list" will work for a standard call.

Related

jquery querybuilder: editing the Rule's structure in the file query-builder.standalone

I created a custom plugin for Jquery Querybuilder but it only works if I edit the Rule's structure from the file querybuilder-standalone itself.
The plugin I've created adds a button like the one from the plugin not-group inside each rule. The function of this plugin is to transform an input like this 'field = "value"' into this 'UPPER( field ) = "VALUE"'.
The problem with this solution is that, in order to reuse this query I need to modify the structure of the Rule itself in the query-builder.
The edits I would need to make are the following:
You can find the original code at line 2242 of the file query-builder.standalone.js
if (model.filter) {
model.filter.to_upper = item.to_upper; /* <---This is the line I added myself */
model.operator = self.getOperatorByType(item.operator, !options.allow_invalid);
if (!model.operator) {
model.operator = self.getOperators(model.filter)[0];
}
}
And this:
Original code between line 6215 and 6232
var id = self.getSQLFieldID(field, value);
//The following line us the code I need
var to_upper = data.to_upper;
/**
* Modifies the rule generated from the SQL expression
* #event changer:sqlToRule
* #memberof module:plugins.SqlSupport
* #param {object} rule
* #param {object} AST
* #returns {object}
*/
var rule = self.change('sqlToRule', {
id: id,
field: field,
operator: opVal.op,
value: opVal.val,
//The following line us the code I need
to_upper: to_upper
}, data);
'to_upper' is a property I set to false by default and to true when its related button it's clicked.
How could I do this without adding these code to query-builder itself?
Here you can find more details about my issue and the helpful answer I received from the creator of this UI component.
https://github.com/mistic100/jQuery-QueryBuilder/issues/931

onFullSync action, show updated info - DHTMLX Grid + RoR

I have a Ruby on Rails project where I use a DHTMLX Grid.
Is there a way of showing, using the event handler "onFullSync" provided by the grid API, to show updated data?
Let me explain a little better... I know I can do something like:
dp.attachEvent("onFullSync", function(){
alert("update complete");
})
But what I want is something more complex. I want to, after each completed update, alter a div adding the information like this:
Field 2 was updated to XYZ and field 3 was updated to XER on line X
Field 1 was updated to 123 and field 3 was updated to XSD on line Y
Is this possible?
Thanks
There is a onAfterUpdate event that can be used similar to onFullSync
http://docs.dhtmlx.com/api__dataprocessor_onafterupdate_event.html
It will fire after each data saving operation ( if you are saving 5 rows - it will fire 5 times )
Still, info about updated columns will not be available here.
Also, you can try onEditCell event of grid. It fires after changing data in db, but before real saving in database. Here you can get all necessary info - row, column, old value and new value.
http://docs.dhtmlx.com/api__link__dhtmlxtreegrid_oneditcell_event.html
So, what I end up doing was:
After creating the grid I created an array:
var samples = [];
Then, as per #Aquatic suggestion, I added to "onEditCell" event the following line:
samples[samples.length] = grid.cells(rId, 5).getValue();
This allowed me to add to the array the value present on column 5 of the row changed. Then, on "onFullSync" event I hide or show the div created on the view with the messages (I distinguish if it's on row or more changed on the grid).
//Deals with messages after update
dp.attachEvent("onFullSync", function(){
unique_samples = uniq_fast(samples.sort());
if (unique_samples.length == 1){
$('#updated-samples').text("");
$(".messages").show();
$('#updated-samples').text("A seguinte amostra foi actualizada: " + unique_samples[0]);
//to clear the array
samples = [];
} else if (unique_samples.length > 1){
$('#updated-samples').text("");
$(".messages").show();
$('#updated-samples').text("As seguintes amostras foram actualizadas: " + unique_samples.sort().join(", "));
//to clear the array
samples = [];
} else {
$('#updated-samples').text("");
$(".messages").hide();
//to clear the array
samples = [];
}
})
The problem with using "onEditCell" is that everytime a field is changed on that row I get a repeated value on my "samples" array, I I had to remove duplicate from that array. For that I used one of the suggestions at this answer
// remove duplicates in array
function uniq_fast(a) {
var seen = {};
var out = [];
var len = a.length;
var j = 0;
for(var i = 0; i < len; i++) {
var item = a[i];
if(seen[item] !== 1) {
seen[item] = 1;
out[j++] = item;
}
}
return out;
}
Then I have on the beginning of the view, to show the messages:
<div class="alert alert-success messages" id="updated-samples">
And that's it. I could be not the most efficient way but it works for what I wanted. I will leave the question open a few more days to see if any other option appears.

SwaggerUI doesn't show model schema for collection in POST body parameter

I downloaded SwaggerUI in June 2014, it is not easy for me to find out what version it was as I just downloaded the dist folder.
In these months I've been using Swagger for documenting the REST API I am building with Jersey, I found that the UI was not showing the model and model schema in the Data Type column for body parameters that are collections in my case a List, it only shows the word "array".
It seems that this issue is solved in newer versions, however I made several customization to the code and downloading the new version is not an option for me.
I want to know what part of the code I should modify to make this work.
I found the part that needs to be updated in my version of swagger.js is:
SwaggerOperation = (function() {
...
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
parameter = _ref1[_i];
parameter.name = parameter.name || parameter.type || parameter.dataType;
type = parameter.type || parameter.dataType;
// ++++ Add this:
if(type === 'array') {
type = 'array[' + parameter.items.$ref + ']';
}
// ++++
if (type.toLowerCase() === 'boolean') {
parameter.allowableValues = {};
parameter.allowableValues.values = ["true", "false"];
}
...
After that the parameter view looks like this:
I posted this same finding in the SwaggerUI github project issue tracker: https://github.com/wordnik/swagger-ui/issues/400

Prevent CKEditor filtering Radiant Tags (non-valid HTML tags)

I'm using CKEditor with refinerycms (rails CMS) I've also added basic support for radius tags (they are the tags used in Radiant, another rails CMS) so I'm able to list some elements from the model in the page just inserting a code.
The problem is that the radius tags mimic html:
<r:product_listing category="products" list_as="grid"/>
When using CKEditor to modify the page contents it thinks the radius tags are invalid HTML, which is correct and the expected behaviour, but I can't find the way to tell CKEditor to just ignore those tags.
Any ideas?
Thanks in advance
EDIT: Turned out that the tag was being filtered by the sanitize method in rails being called by RefineryCMS.
What kind of issues do you have with custom tags? And on which browsers?
I checked that CKEditor preserves this tag, but wraps entire content with it. To avoid that you have to edit CKEDITOR.dtd, namely:
CKEDITOR.dtd.$empty[ 'r:product_listing' ] = 1;
But that still may not be enough. To have better support you'd need to make more changes in this object - especially important is to define what can be its parents and that it's an inline tag. For example:
CKEDITOR.dtd.p[ 'r:product_listing' ] = 1; // it is allowed in <p> tag
CKEDITOR.dtd.$inline[ 'r:product_listing' ] = 1;
This still may not be enough - for example you'll most likely won't have copy&paste support.
So, if you need more reliable support I'd try a little bit different way. Using CKEDITOR.dataProcessor you can transform this tag into some normal one when data are loaded into editor and when data are retrieved transform it back to that tag.
Example solution:
// We still need this, because this tag has to be parsed correctly.
CKEDITOR.dtd.p[ 'r:product_listing' ] = 1;
CKEDITOR.dtd.$inline[ 'r:product_listing' ] = 1;
CKEDITOR.dtd.$empty[ 'r:product_listing' ] = 1;
CKEDITOR.replace( 'editor1', {
on: {
instanceReady: function( evt ) {
var editor = evt.editor;
// Add filter for html->data transformation.
editor.dataProcessor.dataFilter.addRules( {
elements: {
'r:product_listing': function( element ) {
// Span isn't self closing element - change that.
element.isEmpty = false;
// Save original element name in data-saved-name attribute.
element.attributes[ 'data-saved-name' ] = element.name;
// Change name to span.
element.name = 'span';
// Push zero width space, because empty span would be removed.
element.children.push( new CKEDITOR.htmlParser.text( '\u200b' ) );
}
}
} );
// Add filter for data->html transformation.
editor.dataProcessor.htmlFilter.addRules( {
elements: {
span: function( element ) {
// Restore everything.
if ( element.attributes[ 'data-saved-name' ] ) {
element.isEmpty = true;
element.children = [];
element.name = element.attributes[ 'data-saved-name' ];
delete element.attributes[ 'data-saved-name' ]
}
}
}
} );
}
}
} );
Now r:product_listing element will be transformed into span with zero-width space inside. Inside editor there will be a normal span, but in source mode and in data got by editor#getData() method you'll see original r:product_listing tag.
I think that this solution should be the safest one. E.g. copy and pasting works.
u can also add as protected source, so no filtering or parsing will be done.
config.protectedSource.push(/<r:product_listing[\s\S]*?\/>/g);
just add these line to your config.js ([\s\S]*? is for any random content)
check out http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-protectedSource

Is it possible to use an offset when using the Symfony sfPager class?

I would like to disregard the first n items in a pager list of items. I.e. they are being used elsewhere in the design.
So my pager list needs to be as such:
Page 1: Items 8 - 17
Page 2: Items 18 - 27
Page 3: Items 28 - 37
...
However, setting an offset or limit in the criteria object does nothing. I presume they are used by the pager itself.
Is it possible to add a offset to the pager class in some other way?
Ok, I have got around the problem by modifying sfPropelPager.class.php and putting it into a new class file which I have named atPropelPagerOffset.class.php
It works in exactly the same way apart from it takes an extra parameter, $offset
So the top of the file looks like:
protected
$criteria = null,
$peer_method_name = 'doSelect',
$peer_count_method_name = 'doCount',
$offset = 0;
public function __construct($class, $maxPerPage = 10, $offset = 0)
{
parent::__construct($class, $maxPerPage);
$this->setCriteria(new Criteria());
$this->tableName = constant($class.'Peer::TABLE_NAME');
$this->offset = $offset;
}
Then I have made this tiny change around line 50
$c->setOffset($offset+$this->offset);
Works a treat!
Simpler solution would be a custom select method:
$pager->setPeerMethod('doSelectCustom');
and then put your logic in the model Peer Class:
public static function doSelectCustom($c)
{
$c2 = clone $c;
$offset = $c2->getOffset();
$limit = $c2->getLimit();
$someCustomVar = someClass::someMethod();
if ($offset == 0) // we are in the first page
{
$c2->setLimit($limit - $someCustomVar);
$c2->add(self::SOMECOLUMN, false);
} else $c2->setOffset($offset - $someCustomVar);
return self::doSelectRS($c2); // or doSelect if you wanna retrieve objects
}

Resources