onClick Google Analytics Event Tracking for Links in RichTextEditor

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

onClick Google Analytics Event Tracking for Links in RichTextEditor

Vivek
Hello,

Is it possible to add the following onClick Google Analytics Event Tracking i.e. onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);"
to the links added in the RichTextEditor. Attached is the screenshot for clarity. When I tried doing so, on Save it just deletes or wipes it off.


Inputs on the same is appreciated.

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: onClick Google Analytics Event Tracking for Links in RichTextEditor

Jeroen Reijn
Administrator
Hi,

I'm not sure if it's that easy to do with the rich text area.
You could allow it by allowing onClick attributes in the HTML Cleaner,
but then there is no simple way yet to add it except in html/source
mode.

An alternative approach is to use for instance jQuery to add the
onclick automatically to all <a> elements.
Example can be found here:
http://martinprzybyla.com/2010/12/29/add-onclick-events-to-all-outbound-links-with-jquery-depending-on-domain/

On Wed, Jan 23, 2013 at 2:07 AM, Vivek <[hidden email]> wrote:

> Hello,
>
> Is it possible to add the following onClick Google Analytics Event Tracking
> i.e. onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First
> Birthday']);"
> to the links added in the RichTextEditor. Attached is the screenshot for
> clarity. When I tried doing so, on Save it just deletes or wipes it off.
> <http://hippo.2275632.n2.nabble.com/file/n7580257/RichTextEditor-OnClickAttribute.png>
>
> Inputs on the same is appreciated.
>
> Thanks,
>
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/onClick-Google-Analytics-Event-Tracking-for-Links-in-RichTextEditor-tp7580257.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Jeroen Reijn
Solution Architect
Hippo

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

http://about.me/jeroenreijn
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: onClick Google Analytics Event Tracking for Links in RichTextEditor

Ard
In reply to this post by Vivek
On Wed, Jan 23, 2013 at 2:07 AM, Vivek <[hidden email]> wrote:

> Hello,
>
> Is it possible to add the following onClick Google Analytics Event Tracking
> i.e. onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First
> Birthday']);"
> to the links added in the RichTextEditor. Attached is the screenshot for
> clarity. When I tried doing so, on Save it just deletes or wipes it off.
> <http://hippo.2275632.n2.nabble.com/file/n7580257/RichTextEditor-OnClickAttribute.png>
>
> Inputs on the same is appreciated.

I assume you want these 'events' to be added to links in the frontend.
Are you using the HST? If so, you can hook in this kind of stuff
runtime with the hst. See [1] and see [2] for a worked out example

Regards Ard

[1] http://www.onehippo.org/7_8/library/concepts/rewriting-rich-text-field-runtime/hst-2-rewriting-rich-text-field-runtime.html
[2] http://www.onehippo.org/7_8/library/concepts/rewriting-rich-text-field-runtime/hst-2-example-of-context-aware-lightbox-for-all-inline-images.html

>
> Thanks,
>
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/onClick-Google-Analytics-Event-Tracking-for-Links-in-RichTextEditor-tp7580257.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: onClick Google Analytics Event Tracking for Links in RichTextEditor

Vivek
@Jeroen - Good to know that it could be achieved through HTML Cleaner. Let me try that since this requirement will be used on few landing pages that I am currently building and should work for now even if it requires working in html/source mode.

@Ard - Yes I am using HST. So will go through those worked out examples for a long term solution.

Thanks!!!
Reply | Threaded
Open this post in threaded view
|

Re: onClick Google Analytics Event Tracking for Links in RichTextEditor

abhishek bhardwaj
Hi all,

i am facing problem while checkout my code (on commit changes) it show following error message......
please help me.




_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html

snap.png (99K) Download Attachment
Ard
Reply | Threaded
Open this post in threaded view
|

Re: onClick Google Analytics Event Tracking for Links in RichTextEditor

Ard


Op 24 jan. 2013 06:14 schreef "Abhishek Bhardwaj" <[hidden email]> het volgende:
>
> Hi all,
>
> i am facing problem while checkout my code (on commit changes) it show following error message......
> please help me.
>

Pls start a new mail / forum thread for a new question / problem instead of hijacking an existing thread.

Regards ard

>
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html