• Hi there,
    First, thanks for creating this awesome plugin. Love the function and interface.
    Recently, i am trying to create a custom event by tracking a button clicked by user. I am using Javascript. I manage to track the event, but i don’t know how to track the page/post title together with the event. Can you help me?
    Thank you.

    Regards,
    Kmaroz

    Note: I didnt know much about javascript or php, i just following the tutorials on your site.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Damian Góra

    (@damian-gora)

    Hi,
    Thank you for the kind words!
    Of course you can do it, it’s easy 🙂

    First you must pass a page title as a second argument of wptaoEvent() function. Take a look at the docs.

    wptaoEvent( 'your_custom_event_name', document.title);

    Then you can display the title on a WP Tao timeline. To do it use filter:

    add_filter( 'wptao_event_your_custom_event_name_description', 'callback_function_name', 10, 2 );
     
    function callback_function_name( $description, $event ) {
     
    	$description = '<span class="wptao-meta-title">' . __( 'Page title:', 'your_texdomain' ) . '</span> ';
     
    	$description .= esc_url( $event->value );
     
    	return $description;
    }

    Best
    Damian

    • This reply was modified 7 years, 1 month ago by Damian Góra.
    • This reply was modified 7 years, 1 month ago by Damian Góra.

    Hi great plugin 🙂

    I have the exact same problem and are using the code above.
    It is tracking the custom event clicks, I can’t seem to get the page or post title to appear in the time line, I need to know what page the button was clicked on, can you help?

    This is what I get.

    8:40 pm Clicked button
    Page Title:

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting Post Title for Custom Event’ is closed to new replies.