facebook pixel integration

#193289
  • Resolved Dori
    Rank Math pro

    A required field is missing: ID, error is preventing me from integrating my facebook catalogue with the site. I have read several issues on your support was inc;uding this topic: https://support.rankmath.com/ticket/id-for-facebook/

    I copied that code snippet to my child theme’s function.php file, but it didn’t resolve the issue.

    I also noticed, that with variable products which have a different price for each variable, the facebook micro data debugging tool doesn’t recognize prices either.

    Do you have any suggestion to include this data?
    Thank you.

    (Site: https://pearls.jp)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ankit
    Rank Math business

    Hello,

    Thank you for your reply.

    The error is related to the missing Product ID in the schema. The product ID is not added to the schema data yet, but we have in our plan to add it in the future.

    Luckily, we have an API, so if you know about coding or have some dev, you could add the missing IDs, for now, to extend the JSON-LD data using this filter: https://rankmath.com/kb/filters-hooks-api-developer/#extend-json-ld-data

    Following the requirements told by Facebook here: https://developers.facebook.com/docs/marketing-api/catalog/guides/microdata-tags#json-ld

    Here is a code to give you you direction on how to apply this:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['Product'] ) ) {
            $data['product']['additionalProperty'] = ['@type' => 'PropertyValue', 
    		'propertyID'=> 'item_group_id', 
    		'value'=> 'fb_tshirts'];
        }
        return $data;
    }, 99, 2 );

    I hope this helps.

    Thanks.

    Dori
    Rank Math pro

    Ok, as my technical skills are not that high I would like to ask:
    1. Is this code pasted into my functions.php
    2. If I want the product ID to change dynamically depending on the SKU or product number that wordpress gave each product, how do I achieve this.
    3. What about the price range issue?

    Ankit
    Rank Math business

    Hello,

    Thank you for your reply,

    1. Is this code pasted into my functions.php

    Yes, you need to put the code inside your theme’s function.php

    2. If I want the product ID to change dynamically depending on the SKU or product number that WordPress gave each product, how do I achieve this.

    to get the current page product ID, you can use code like this :

    global $product;
    $id = $product->get_id();

    However, there are multiple ways to get a product ID.

    3. What about the price range issue?

    You can refer to this Facebook Microdata Tag page to know more about their schema:
    https://developers.facebook.com/docs/marketing-api/catalog/guides/microdata-tags#json-ld

    I would recommend you hire a developer to make things easier for yourself.

    I hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘facebook pixel integration’ is closed to new replies.