Skip to content

Commit

Permalink
Merge pull request #140 from globeandmail/chore/revert-last-two-merge
Browse files Browse the repository at this point in the history
Revert last two merges
  • Loading branch information
Rahmon authored Oct 19, 2021
2 parents 8ba244b + a1526f8 commit ea0540b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
20 changes: 5 additions & 15 deletions includes/functions/content-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,19 @@ function setup() {
return __NAMESPACE__ . "\\$function";
};

add_action( 'wp_after_insert_post', $n( 'track_event' ), 10, 4 );
add_action( 'transition_post_status', $n( 'track_event' ), 10, 3 );
}

/**
* Sending data to SnowPlow.
*
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
* @param null|WP_Post $post_before Null for new posts, the WP_Post object prior
* to the update for updated posts.
* @param string $new_status New post status.
* @param string $old_status Old post status.
* @param WP_Post $post Post object.
*
* @return null|WP_Error
*/
function track_event( $post_id, $post, $update, $post_before ) {

$new_status = $post->post_status;
$old_status = $post_before ? $post_before->post_status : '';

// Don't send any event if the page is assigned to the front page or posts page
if ( $post_id === (int) get_option( 'page_on_front' ) || $post_id === (int) get_option( 'page_for_posts' ) ) {
return;
}
function track_event( $new_status, $old_status, $post ) {

// Don't send any event when creating new article.
if ( 'auto-draft' === $new_status || 'inherit' === $new_status ) {
Expand Down
3 changes: 1 addition & 2 deletions includes/functions/tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ function get_tracking_data() {
$data['data']['content']['contentId'] = strval( $post->ID );
}

if ( is_front_page() || is_home() ) {
if ( is_front_page() ) {
$data['data']['page']['breadcrumb'] = 'homepage';
$data['data']['page']['sectionName'] = 'homepage';
$data['data']['page']['type'] = 'section';
$data['data']['content']['type'] = 'section';
}

if ( 'prod' === $env ) {
Expand Down

0 comments on commit ea0540b

Please sign in to comment.