weltpixel

X (Twitter) Ads Server-Side Addon for Google Analytics 4 PRO

Requires the Google Analytics 4 PRO extension.

X (Twitter) Ads Server-Side API Integration for Magento 2

Transform your Magento 2 store's advertising capabilities with our X (Twitter) Ads Server-Side API integration. This powerful solution establishes a direct, secure connection between your e-commerce data and X's advertising platform, enabling precise conversion tracking and enhanced campaign optimization across web, mobile, and offline channels.

Designed specifically for Magento 2 merchants, this server-side implementation ensures reliable data collection and accurate conversion tracking, even in environments with strict privacy settings or ad blockers.

Key Benefits of X (Twitter) Ads Server-Side Tracking

Advanced Conversion Tracking

Bypass browser limitations and tracking prevention tools with server-side implementation, ensuring comprehensive data collection for all customer interactions and conversions on your Magento 2 store.

Enhanced Data Privacy Compliance

Meet modern privacy standards while maximizing advertising effectiveness. Our server-side integration gives you granular control over data sharing, ensuring compliance with privacy regulations while maintaining optimal campaign performance.

Future-Proof Implementation

Stay ahead of browser changes and privacy updates with a hybrid tracking approach that combines server-side reliability with client-side flexibility, ensuring consistent performance as digital marketing evolves.

Centralized Data Management

Consolidate your Magento 2 store's marketing data through a single, reliable API connection. Streamline tracking implementation while ensuring consistent measurement across all customer touchpoints and marketing channels.

How X (Twitter) Ads Server-Side Tracking Works

Customer interacts with your Magento 2 store (purchases, cart updates, product views)

Server-side tracking captures event data with 100% reliability

Secure data transmission to X (Twitter) via the official Events API

Real-time conversion data appears in your X (Twitter) Ads dashboard

The following diagram illustrates the seamless integration between your Magento 2 store, X (Twitter) Ads server-side tracking, and the X (Twitter) Events API:

X (Twitter) Ads Server-Side Integration Workflow for Magento 2

Features of the X (Twitter) Ads Server-Side Addon

Event Tracking

  • Server-side Place an Order (Purchase) Event Tracking
  • Server-side Add Payment Info Event Tracking
  • Server-side Initiate Checkout Event Tracking
  • Server-side Add To Cart Event Tracking

Additional Events

  • Server-side Add To Wishlist Event Tracking
  • Server-side Search Event Tracking
  • Server-side View Content Event Tracking

Powerful Integration

  • Ability to track selected events in conjunction with the frontend X (Twitter) Ads
  • Directly and fully integrated into the Google Analytics 4 PRO extension

Developer Tools

  • Log functionality for in-depth debugging of events sent to the X (Twitter) API
  • Easy setup, all that's required is the X (Twitter) Ads Pixel ID and the X (Twitter) Events API Key

System Compatibility

  • Compatible with Magento 2.3.x - 2.4.7
  • Works with all Magento editions
  • Supports multiple store views

Requirements for using the X (Twitter) Ads Server-Side Addon

To use the X (Twitter) Ads Server-Side Addon, you'll need the following:

  • A X (Twitter) Ads Pixel client-side integration, in order to gain access to your X (Twitter) Ads Pixel Tracking Base Code. Our Google Analytics 4 PRO extension comes with the possibility of setting up the client-side X (Twitter) Ads Pixel out of the box, which can be done within minutes.
  • The Google Analytics 4 PRO extension enabled and configured.
  • An approved X (Twitter) App with access to the X Ads API. You can create and manage your apps in the X Developer Portal. Make sure your app has the necessary permissions for the X Ads API.

How to Install the X (Twitter) Ads Server-Side Addon

1

Prerequisites

Before starting the installation, please ensure you have checked all requirements.
  • Ensure your Magento version is compatible (2.3.0 - 2.4.7 and all Security Patches)
  • Install on a testing environment first
  • Set Magento to developer mode
  • Make sure the Google Analytics 4 PRO extension is already installed and configured on your Magento 2 instance. You can find the steps for doing so in the Google Analytics 4 PRO User Guide.
php bin/magento deploy:mode:set developer
2

File Installation

Copy the extension files to your Magento 2 instance:

app/code/WeltPixel/GA4TwitterSS
If the 'app/code/WeltPixel' folder is missing, please create it manually.
3

Extension Installation

Run the following commands in your Magento root directory:

php bin/magento module:enable WeltPixel_GA4TwitterSS --clear-static-content
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
4

Cache Management

Flush any caches that you might still have enabled on your server or in Magento.
5

Production Mode

If your store was in production mode, switch it back:

php bin/magento deploy:mode:set production
6

Completion

The extension is now installed on your Magento store! Congrats!

How to Upgrade the Extension

1

Remove Old Files

Remove existing files from app/code/WeltPixel/GA4TwitterSS before upgrading.

The extension may be refactored and old unused files may cause random issues, so it's best to only keep the latest version of the files.

2

Follow Installation Steps

Follow the normal installation instructions above.

How to Configure the X (Twitter) Ads Server-Side Addon

Basic Configuration

Important Notice: To gain access to your X (Twitter) Ads API details (Consumer API, Consumer Secret, Access Token, and Access Secret), you'll need to create an X (Twitter) Developer App and request access to the Ads API. To do so, please follow X's Documentation. This is crucial as you won't have access to these details unless X (Twitter) approves your application.

Admin → WeltPixel → Google Analytics 4 Ecommerce PRO → X (Twitter) Ads Tracking Settings

Enable X (Twitter) Ads Server Side Tracking

When enabled, the server-side X (Twitter) Ads functionality will use the X (Twitter) Ads Javascript Tracking code configured in the client-side configuration section.

X (Twitter) Pixel ID

This ID can be found in your X (Twitter) Ads Manager account under Tools → Events Manager → Twitter Pixel. You can also find it in your X (Twitter) Ads Javascript Tracking code in the section above.

Consumer API Key

Input your X (Twitter) App Consumer API Key.

Consumer Secret Key

Input your X (Twitter) App Consumer Secret Key.

Authentication Access Token

Input your X (Twitter) App Authentication Access Token.

Authentication Access Secret

Input your X (Twitter) App Authentication Access Secret.

Track Events

Select the events you wish to send to X via the Events API. Options are Purchase / Search / Add to Cart / Add to Wishlist / Initiate Checkout / Add Payment Info / View Category / View Product

Note: Make sure you've added your Twitter Event IDs in the X (Twitter) Pixel Tracking Configuration section above. Otherwise, server-side data won't be associated with your created event in the X Ads Platform.

Basic Configuration

Advanced Configuration

Advanced Configuration
Send enabled events via the frontend X (Twitter) Pixel as well

Set this option to Yes if you want to send events via the frontend X (Twitter) Pixel as well. X Ads Manager should have built-in functionality to avoid data duplication, and this may (in some cases) enrich your data.

Enable File Log

Enable the creation of a log file that shows the pushed event data. The twitter-api.log file can be found in the var/log directory of Magento 2 root.

Support and Resources

Documentation

Access our comprehensive documentation in the Knowledge Base for detailed setup and configuration instructions.

Technical Support

Our dedicated support team is ready to assist you with any technical issues or questions you may encounter during setup and usage.

Regular Updates

Stay current with regular updates ensuring compatibility with the latest Magento versions and X (Twitter) Ads API changes.

Frequently Asked Questions

What is the X (Twitter) Ads Server-Side Addon?

The X (Twitter) Ads Server-Side Addon is an extension that enables server-side tracking of conversion events from your Magento 2 store to X (Twitter) Ads, providing more accurate and reliable tracking data.

Do I need the Google Analytics 4 PRO extension?

Yes, this addon requires the Google Analytics 4 PRO extension to be installed and configured on your Magento 2 store.

What events can be tracked?

The addon supports tracking of various events including purchases, add to cart actions, product views, wishlist additions, checkout steps, and more.

How secure is the data transmission?

All data is transmitted securely using X (Twitter)'s official API endpoints with authentication and encryption.

Change Log

Version History

v.1.10.1 March 12, 2025

Future updates will include additional features and enhancements to the X (Twitter) Ads Server-Side Addon.

Zoomed Image