We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more by reading our Privacy Policy.
Meta Pixel and Conversions API GraphQL for Magento Adobe Commerce
Adds the GraphQL capability to the original Apptrian Meta Pixel and Conversions API extension. Requires original (base) extension.
Magento 2 Current Extension Version: 1.0.1
Compatibility
Open Source (CE): 2.3, 2.4
Commerce using on-prem (EE): 2.3, 2.4
Commerce on Cloud (ECE): 2.3, 2.4
WARNING! This extension is not a standalone extension. It is an add-on extension. Requires original (base) extension.
Requires Meta Pixel and Conversions API v5.2.1 or newer.
Compatible with PWA Studio (Venia) frontend!
Compatible with Magento v2 Adobe Commerce - Open Source (CE), Commerce on-prem (EE), and Commerce on Cloud (ECE)!
Apptrian Meta Pixel and Conversions API GraphQL extension adds the GraphQL capability to the original Apptrian Meta Pixel and Conversions API extension. Being able to issue GraphQL queries is the first step in making your Magento Adobe Commerce frontend PWA compatible or connecting Magento to your native Android or iOS app.
GraphQL is a data query and manipulation language that allows specifying what data is to be retrieved or modified. A GraphQL server can process a client query using data from separate sources and present the results in a unified graph. The language is not tied to any specific database or storage engine.
In the Magento Adobe Commerce context, GraphQL is used to connect the Magento backend with your frontend. The backend does not need to know anything about the frontend, and the frontend does not need to know anything about the backend. The only thing that matters is that they both "speak" GraphQL.
Magento Adobe Commerce already has GraphQL add-ons for all or almost all of the core modules. These GraphQL add-ons allow Magento to work with PWA, Headless, and native Android or iOS apps. It does not matter which language, library, or framework the frontend uses. You can use React, React Native, Svelte, Vue, Angular, etc. The best example of this is the PWA Studio (Venia) frontend. Although PWA Studio is a React app, it seamlessly works with Magento Adobe Commerce because it can send GraphQL queries to the Magento backend and receive or modify data in Magento.
Just like Magento Adobe Commerce, third-party extensions also provide GraphQL add-ons to be compatible with PWA/Headless/Android/iOS apps.
Be aware having a GraphQL add-on only gives you the ability to issue queries. It does not provide the implementation of the extension functionality.
If you need PWA Studio implementation of our Meta Pixel and Conversions API extension, please check our Meta Pixel and Conversions API PWA Studio extension.
Installation Instructions
There are several ways you can install any Magento extension. Our extension is no different. We will show you three ways to install the extension, but you must not mix them. Choose one and stick to it.
If you do not know how to install an extension or you wish a professional to do it for you, we offer an additional installation service for a small fee.
Installation via file uploading
(If you purchased the extension on our site)
If you purchased the extension on our site then unpack .zip file from /Magento2/InstallByUploadingFiles/ directory inside your Magento root.
- Run the following commands on the Magento root directory:
php bin/magento maintenance:enable
php bin/magento module:enable --clear-static-content Apptrian_MetaPixelApiGraphQl
php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento setup:static-content:deploy
php bin/magento maintenance:disable
php bin/magento cache:flush
Installation via Composer
(If you purchased the extension on our site)
If you purchased the extension on our site and you want to install the extension via composer public and private keys. (To find your public and private keys, login to your Apptrian.com customer account and look at the My Downloadable Products section.)
- Run the following commands on the Magento root directory:
php bin/magento maintenance:enable
composer config --auth http-basic.packages.apptrian.com $PUBLIC_KEY $PRIVATE_KEY
composer config repositories.apptrian-meta-pixel-and-conversions-api-graph-ql composer https://packages.apptrian.com/meta-pixel-and-conversions-api-graph-ql/
composer require apptrian/meta-pixel-and-conversions-api-graph-ql
php bin/magento module:enable --clear-static-content Apptrian_MetaPixelApiGraphQl
php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento setup:static-content:deploy
php bin/magento maintenance:disable
php bin/magento cache:flush
Installation via Composer
(If you purchased the extension on Adobe Commerce Marketplace)
If you purchased the extension on Adobe Commerce Marketplace then you must use Composer. Adobe Commerce Marketplace does not allow extension downloads.
- Run the following commands on the Magento root directory:
php bin/magento maintenance:enable
composer require apptrian/meta-pixel-and-conversions-api-graph-ql
php bin/magento module:enable --clear-static-content Apptrian_MetaPixelApiGraphQl
php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento setup:static-content:deploy
php bin/magento maintenance:disable
php bin/magento cache:flush
Please make sure your Magento public and private keys are in your Magento root auth.json file. Usually, people install Magento with one Adobe Commerce Marketplace account (public and private keys) and then purchase an extension with another Adobe Commerce Marketplace account (different public and private keys). Check the Adobe Commerce Marketplace account you used to purchase the extension and make sure its public and private keys are in the Magento root auth.json file. WARNING! If you already have keys there, be very careful because maybe some other extensions are purchased with another Adobe Commerce Marketplace account.
Configuration
Our extension works out of the box. If you want to configure it differently, log into your Magento Admin and go to:
Stores > Configuration > Apptrian Extensions > Meta Pixel and Conversions API GraphQL
After changing the option, make sure you refresh your Magento cache.
Usage
The following queries are the examples of what is possible with our GraphQL add-on. For the complete list of fields, check our extension's GraphQL schema file.
Different web applications require different approaches for implementing Meta Pixel and Conversions API functionality. That is why we provide users with different queries for the same/similar things.
Category Query
query ApptrianMetaPixelApiCategory($id: Int, $uid: String, $full: Int) {
    ApptrianMetaPixelApiCategory(id: $id, uid: $uid, full: $full) {
        id
        category
    }
}
This query provides you with data for the category page event. The Category ID or UID is required.
Product Query
query ApptrianMetaPixelApiProduct($id: Int, $uid: String, $sku: String, $full: Int, $ids_labels: String ) {
    ApptrianMetaPixelApiProduct(id: $id, uid: $uid, sku: $sku, full: $full, ids_labels: $ids_labels) {
        id
        product
    }
}
This query provides you with data for the product-related events. The Product ID, UID, or SKU is required.
Products Query
query ApptrianMetaPixelApiProducts($identifiers: ApptrianMetaPixelApiProductsInput, $full: Int, $ids_labels: String) {
    ApptrianMetaPixelApiProducts(identifiers: $identifiers, full: $full, ids_labels: $ids_labels) {
        products {
            id
            product
        }
    }
}
This query provides you with data for the product-related events. The Product IDs, UIDs, or SKUs are required.
Server Query
query ApptrianMetaPixelApiServer($data: String) {
    ApptrianMetaPixelApiServer(data: $data) {
        success
    }
}
This query allows you to send a Conversions API event.
Unified Query
query ApptrianMetaPixelApiData($page_type: String, $identifier: String) {
    ApptrianMetaPixelApiData(page_type: $page_type, identifier: $identifier) {
        meta_pixel_api
    }
}
The minimal query requires both page_type and identifier.
Allowed values for page_type are: category, product, quote, and order.
If page_type is a category, the value provided to the identifier must be Category ID or Category UID.
If page_type is a product, the value provided to the identifier must be Product ID, Product UID, or Product SKU.
If page_type is a quote, the value provided to the identifier must be Quote ID or Quote UID.
If page_type is a order, the value provided to the identifier must be Order ID or Order UID.
If you are using PWA Studio, most of the time, there is no Category ID/Product ID but a Category UID/Product UID. Our GraphQL identifier field works with both ID and UID. (The UID is detected and converted to ID on the fly.)
User Query
query ApptrianMetaPixelApiUser($customer_id: String, $email: String) {
    ApptrianMetaPixelApiUser(customer_id: $customer_id, email: $email) {
        user
    }
}
Please note that this query requires an Authorization Header with a customer token. (If you are using PWA Studio, no need to worry about the Authorization Header.) If you provide a "customer_id" or "email" that does not match the authorized customer, you will not get any customer data.
FAQ
Q: Does the extension work with multi-store setups?
A: Yes, it does work with multi-store setups. It is working in the same way as the core Magento modules. You can query a non-default store by changing the header in your GraphQL request. Add or change the Store header to the store_view_code of your desired store. If you are using PWA Studio, this is automatic (no need to add/change the header yourself).

