Ticket #626 (closed New feature: duplicate)

Opened 3 years ago

Last modified 3 years ago

Provide a function to safely submit logs from within Javascript functions

Reported by: robe Owned by:
Priority: major Milestone:
Component: Core Keywords:
Cc: Sensitive:

Description

Please provide a function to safely log requests from within javascript functions which modify the DOM.

Currently, when you try to log a visit from within a Javascript function which generates HTML output, calling piwik_log results in a document.writeln which apparently clobbers "large parts" of the DOM.

We worked around this issue by using something like

var imgsrc = _pk_getUrlLog('pix/' + io.filename, 5, pkBaseURL + 'piwik.php');
box.innerHTML += '<img src="'+imgsrc+'" border="0">';

in the Javascript which we use to dynamically generate our pages, but this is Bad Practice (tm).

Change History

Changed 3 years ago by vipsoft

  • status changed from new to closed
  • resolution set to duplicate

Thanks. This is a duplicate of #355. The new piwik.js (now in testing) no longer uses document.write.

Changed 3 years ago by robe

Sorry for the duplicate, overlooked it in the list :/.

Thanks for Piwik and keep up the good work!

Note: See TracTickets for help on using tickets.