GIPHY Alt Text for GIFs is now available! Email us to learn more at bd.team@giphy.com.
GIPHY Clips (GIFs with Sound)have arrived! Learn about adding Clips to your app in our documentation!
Need to move your project from Tenor to GIPHY?   Check out our  migration guide!
logo

Action Register Endpoint

The GIPHY Action Register endpoint registers each time a user views, clicks, or sends a GIF or Sticker, helping GIPHY improve your users' search results.

INSTRUCTIONS

STEP 1: Most endpoints include an Analytics Object for each GIF in the response payload. To register user interactions (e.g., view, click, or send), trigger a request to the appropriate tracking URL specified in the Analytics Object.

EventDescriptionTrigger
onloadUser views the GIF. Call once, immediately after the asset is visible.When the GIF is displayed
onclickUser clicks on the GIF. Call once per click/tap eventOn GIF click event
onsentUser shares or sends the GIF. Call once per successful share/send action.On share/send action
Copy Code
"analytics": {
"onload": {
"url": "https://giphy-analytics.giphy.com/v2/pingback_simple?
analytics_response_payload=e%3DZXZlbnRf&action_type=SEEN"
},
"onclick": {
"url": "https://giphy-analytics.giphy.com/v2/pingback_simple?
analytics_response_payload=e%3DZXZlbnRf&action_type=CLICK"
},
"onsent": {
"url": "https://giphy-analytics.giphy.com/v2/pingback_simple?
analytics_response_payload=e%3DZXZlbnRf&action_type=SENT"
}
}

STEP 2: Build the pingback URL by appending customer_id and ts parameters to the tracking URL.

Request Parameters:Example:Description:
customer_id: string(required)e826c9fc5c929e0d6c6d423841a282aaAn identifier assigned to a user in your platform. Use it consistently across that user's requests. If you do not have your own user ID, you can use the identifier returned by the Random ID Endpoint.
ts: integer (int)(required)1527703430507A UNIX timestamp in milliseconds corresponding to when the action occurred.

Successful Response (200 OK) indicates that the analytics request has been processed. Below is an example of how to build a pingback URL using JavaScript code:

Copy Code
1// Step 1: "gifItem" is a GifItem object from a GIF API response
2const analytics = gifItem.analytics;
3
4// Step 2: Build pingback URL
5const baseUrl = new URL(analytics.onload.url);
6
7baseUrl.searchParams.append('ts', Date.now().toString());
8baseUrl.searchParams.append('customer_id', randomId);
9
10// Step 3: Send GET pingback
11const pingRes = await fetch(baseUrl.toString());
12// A 200 "OK" means the pingback was accepted