This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Content read notification
expandshrink

Content read notification

Content read notification

Tuesday 10 April 2012 5:20:22 pm - 11 replies

Hello,

my aim is to have one user,an administrative one,to be notified when other users view some pages.

The subtree notification rule noifies the user about publishing a content:I would like to have the user notified when the content is read(or viewed)

I've searched in the forum and in the thecnical manual 4.X but I don't understand how can I get the result.

Is there someone who can help?Should I send this post in another session?

My ezpublish version is 4.3

 

Thanks

Modified on Tuesday 10 April 2012 5:22:47 pm by MANUELE ARENGHI

Tuesday 10 April 2012 9:15:00 pm

Hi Manuele,

There is a hidden (disabled by default) workflow trigger, content/read, that can serve the purpose.

You need to add the following to workflow.ini override:

[OperationSettings]
AvailableOperationList[]=content_read

clear INI caches and then create a workflow event and attach it to after content read trigger, that can be used to do whatever you want after some content is read. The downside of this approach is that you need to code all the logic for deciding what content to be notified about, for what users/groups and for creating the notifications.

I'm not aware or can't remember ATM of any other way this can be achieved.

Wednesday 11 April 2012 12:04:25 am

Hello,

Edi was right this is the only way to achieve part of your wish but there is a probleme : the proxies...

 

When  yous access a web page , you can acces the server but often it is wbepage recorded by a proxies and then no access to the serveur.

To know how many time a webpage is seen, i would prefer  to  rely on a tool like google analytics...

 

see you

 

Alex

Wednesday 11 April 2012 8:45:09 am

Thanks for your answers.

I'm already using Google analytics but my aim is to be notified with an email every time a user view some specific pages,which is not done by Google analytics.

I think the way shown by Edi could work.Althought I should understand:

"The downside of this approach is that you need to code all the logic for deciding what content to be notified about, for what users/groups and for creating the notifications."

Can you please,send me some links about how to do this work?

Thanks

Wednesday 11 April 2012 10:15:02 am

Hi Manuele,

here is a tutorial on how to create custom workflow events and how to use them in triggers. It should give you an overview how workflows operate in eZ Publish

http://share.ez.no/learn/ez-publish/creating-a-simple-custom-workflow-event

Tuesday 24 April 2012 11:40:55 am

It seems to me that creating a custom workflow is too difficult for me.

Maybe It could be enought to been able to have logged user's name informations  as custom variable in google analytics.Althought I'm not able to have custom variables working with ezpublish and google analytics.

I use bcwebsitestatistics extension.

To set cutom variables I've put the following code in pagelayout.tpl,before closing </body> tag:

-----------------------------------------------------------------------------------------------------

<script type="text/javascript">// <![CDATA[

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-XXXXXX-2"']);

_gaq.push(['_setCustomVar',1,'utente_var',{$current_user.contentobject.name|wash}, 3]);

_gaq.push(['_trackPageview']);

(function() { var ga = document.createElement('script');ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();// ]]>

</script>

-----------------------------------------------------------------------------------------------------

But this does not work.Can anyone help me??

Thanks

Tuesday 24 April 2012 11:59:07 am

Hi Manuele,

I'm not really familliar with Google Analytics to say how to push the custom variables to Google, but I can see two issues here with the code:

1) If you use {literal} and {/literal} tags around your javascript code, then the following:

_gaq.push(['_setCustomVar',1,'utente_var',{$current_user.contentobject.name|wash}, 3]);

must be written as:

_gaq.push(['_setCustomVar',1,'utente_var','{/literal}{$current_user.contentobject.name|wash}{literal}', 3]);

for eZ Publish templating engine to properly output the current user name. Also take notice of added single quotes around user name.

2) If the Google Analytics code is in a misconfigured cache block, then this will not work. User ID ( {$current_user.contentobject_id} ) should be one of the keys for the cache block where this code is located.

Wednesday 02 May 2012 9:42:43 am

Hi Edi,

thank you for your answer.

1)

I'm not using {literal} and {/literal} tagsaround my javascript code.

I added single quotes around user name.

2)Google Analytics code is not in a a misconfigured cache block:If I put in javascript code:

alert({$current_user.contentobject.name|wash});

The alert id correctly shown

-----------

I released that the javascript code was not compiled when it contains the last part:

(function() { var ga = document.createElement('script');ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();// ]]>

So I decided to remove it.After removing it, the alert began to work.Althought when I access to google analytics,and  open custom variables table I cannot see my var.

Any ideas?

Wednesday 02 May 2012 11:20:22 am

One more information:

If I add to my javascript code:

  (function() {    var ga = document.createElement( 'script' );    ga.type = 'text/javascript';    ga.async = true;    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);  })();

I get this error:

Extra characters found, should have been a whitespace or the end of the expressionCharacters: '.createElement( 'script' );    ga.type = 'text/javascript';    ga.async = true;    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);  '

Wednesday 02 May 2012 11:48:38 am

I've added {literal} and {/literal} tags around my js code.Now I've been able to add also the  code:

  (function() {    var ga = document.createElement( 'script' );    ga.type = 'text/javascript';    ga.async = true;    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);  })();

Hope this will work.I'll come back with the result within a few days

Friday 04 May 2012 4:52:32 pm

Hi Manuele,

sorry for replying so late, I was rather busy for last couple of days.

Basicly, since javascript in directly included in your templates will most likely contain { & } braces, and those braces are, as you know, eZ template specific, you need to either:

  • wrap the entire JavaScript code in {literal} and {/literal} tags, in order for template engine to stop processing the javascript as template code. In this case, if you want to output something with eZ tpl code, you put those blocks in {/literal}{literal}, for example: "{/literal}{def $my_var = fetch(...)}{literal}", as shown above.
  • every instance of { & } braces replace with {ldelim} or {rdelim} in order for eZ tpl engine to output them literally

I hope you managed to get everything working happy.gif Emoticon

Saturday 05 May 2012 10:43:48 am

ok, it works

thanks for your help

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from