Giter Club home page Giter Club logo

conversionsapi-tag-for-googletagmanager's People

Contributors

facebook-github-bot avatar heymultiverse avatar marksliva avatar odundar avatar sahava avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conversionsapi-tag-for-googletagmanager's Issues

Possible error in documentation regarding deduplication

In the documentation it is stated that you should add a parameter called x-fb-event_id to the GA4 event on the web client, in order to send the event_id along to the Conversions API:

On the GA4 event configure to send an extra parameter, named x-fb-event_id set to {{FBEventIDVar}}Variable.

I could not get this working, and when I looked inside the code here, I found that the param is read from just event_id:

event.event_id = eventModel.event_id;

Setting a param in "fields to set" on the GA4 tag just named event_id fixed everything, and the id is now sent along to the API when previewing.

Am I correct in assuming this is a documentation error, or am I reading it wrong?

Error : x-fb-cd-contents : ['contents'] must be an array."

I try to send custom_data "contents" via x-fb-cd-contents parameter via InitiateChekout and Purchase but I get a 200 error on server side debug mode :

{"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_subcode":2804019,"is_transient":false,"error_user_title":"Server Side Api Parameter Error","error_user_msg":"The parameter $['data'][0]['custom_data']['contents'] must be an array.","fbtrace_id":"Ack-e18nn4DSE933xa9Xv2_"}}

BUT, those parameters are well sent through client side tag :

Parameters: (4)
contents:
[{"id":"1234567890","name":"Boucles doreilles ROMY","item_price":35,"quantity":1}]
value:
35
currency:
EUR
content_type:
product

It seems that the parameter x-fb-cd-contents doesn't match the "contents" parameter or is unable to sent it correctly.

Grateful for any ideas, many thanks.

BUG: You need to check for user_data.address before accessing its properties

If user_data.address doesn't exist in the eventModel, then this line (and all subsequent attempts to access user_data.address will throw an error):

(eventModel.user_data != null ? hashFunction(eventModel.user_data.address.first_name) : null);

So it should be something like:

(event_model.user_data != null && event_model.user_data.address != null ? ...

Feature request: Can override the page location parameter in the browser side Facebook pixel

Suppose I have a website in which I have a iframe. I have setup my pixel in the iframe. Now if I fire any event it is taking the iframe src URL not the main website URL. Now I want to override the URL parameter. But I can't do that in the browser side pixel. As the pixel automatically collects the page URL parameter. It will be nice if we can override the URL parameter as GA4 allows to override the page_location parameter so that the right page URL shown in the event manager. Not the iframe URL.

If It is possible in the browser side pixel right now pls guide me how do I implement that.

v10.0 requests failing

I'm seeing the tag sending requests to https://graph.facebook.com/v10.0/[...]/events . These are returning a 400 response with the error message:

OAuth "Facebook Platform" "invalid_request" "(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v11.0."

I've tried adding a fresh tag, same result. I know the template has been updated for v11 so I'm sure I shouldn't be seeing this problem.

Context: I'm sending events to the GA4 Measurement Protocol client. They're being received and triggering the FB tag. The body being sent on my requests to FB looks to be valid, carrying all the parameters I need and expect.

Grateful for any ideas, thanks.

Naming Convention for custom events

If you send a buildin event like ViewContent, the tag converts it from view_content to ViewContent.
{"data":[{"event_name":"PageView"}]}
if you send a custom event like do_something it will not be converted to DoSomething.

Sending a custom data along with an event

Hello,

Would you please help on how should I send a custom event parameter in FB conversion API?
It seems impossible! for example for the event "Lead", I need to send "form_name" as a custom parameter but the template doesn't pick this parameter up from the GA4 tag. I tried with x-fb-cd-form_name but doesn't work either.

Thank you in advanced

Tag parsing wrong contents array?

We are using a server-side tag setup for GTM where the data is passed to the server as a GA4 Purchase event and then sent along to FB CAPI using this Facebook Incubator tag template.

I've written a custom Javascript variable in GTM to parse a Google Analytics ecommerce "products" array and return it in the format FB CAPI wants for "contents":

image

image

As you can see, it takes the price, quantity, and sku for each item and saves them in the correct format. I am explicitly passing this array as "contents":

image

However, trying to pass the purchase events to the server is failing with code 400 and receives the following response:

"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_subcode":2804008,"is_transient":false,"error_user_title":"Invalid Contents Parameter","error_user_msg":"The contents parameter you entered doesn\u2019t contain a list of JSON objects. Enter a list of JSON objects that contain the product IDs associated with the event plus information about the products. For example: [{ 'id' : 'ABC123', 'quantity' : '2', 'item_price' : 5.99}, { 'id' : 'XYZ789' , 'quantity' : 2, 'item_price' : 9.99}]","fbtrace_id":"ASsXl7dWNIzLxh8RdCpOp45"}}

Digging in, it seems like the tag is somehow creating its own "content" array and ignoring the one I'm sending. In the process, it seems to be grabbing the wrong field, using "name" instead of "sku". This is the request body it is sending (some data anonymized):

{"data":[{"event_name":"Purchase","event_time":1656000012,"event_source_url":"https://www.customer.com/order/checkout","action_source":"website","user_data":{"client_ip_address":"111.111.111.111","client_user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36","ph":"a1b2c3d4e5f6...abcdef","fbp":"fb.1.1111...1111"},"custom_data":{"currency":"USD","value":7.94,"order_id":"4f719af2-3637-42ee-8e8a-28e8f3783858","contents":[{"title":"Homestyle Huddle Wrap","item_price":7.49,"quantity":1}]}}],"partner_agent":"gtmss-1.0.0-0.0.5"}

Specifically, note the contents array:

"contents" : [
   {
      "title" : "Homestyle Huddle Wrap",
      "item_price" : 7.49,
      "quantity" : 1
   }
]

This is not what's being passed, and it actually doesn't match any of our objects- we don't use "title" anywhere in our objects, so this object in this format has to be coming from this tag template.

However, that seems to be making it fail, since FB is expecting "id" but getting "title"? In other words, FB's tag seems to be ignoring the provided "contents" array and instead building its own, but FB CAPI seems to be rejecting the "contents" array built by FB's own tag.

Any thoughts on why this is happening and how to fix it? Why isn't the tag using the "contents" array I have already built and am sending to it, and why is the one it appears to be building failing?

Instructions not available

Hello,

Really appreciate the work you have put into this. Could you please make the instructions available again? Seems like they have been taken down from the Facebook developers website.

Thanks.

Strip port from IP address

Facebook conversions API does not accept IP addresses with port number. Parameter ip_override, which is used as a user IP address, can have a port.

Modify the ip_override so that the port is removed.

How to set up FB pixel if I´m going to set up Conversiones API with GTM

Hi,
I set up a FB pixel on my website to track 5 events and those are working properly. Now I want to set up conversion API with GTM, but I don´t have a clue how to. My first questions is if I could maintain pixel on my website or I have to migrate pixel tracking to GTM. Another question is if pixel can still on my website while conversion API is through GTM: do I have to set up the same events in both parts: GTM and Facebook. (I just have one domain, one website, one pixel)

Or please tell me what is the best way to do this, I have read all day about this and I´m still lost.

How can we pass in LDU reqs from the GA4 event?

The tag template doesn't currently allow for customization of LDU params in the data collected in the CAPI Server Container.

The CAPI documentation shows the capability exists, and the Stape.io tag template has implemented LDU options.

Would love to have official FB support.

Events failing, test failing

My 'standard' events are not making it to GA4 or Facebook. After some digging, I'm finding that the test 'on EventModel model data tag triggers to send to Conversions API' is failing with the following error message:

sendHttpRequest expected to have been called with arguments ("https://graph.facebook.com/v12.0/123/events?access_token=abc", (), [object Object], "{"data":[{"event_name":"Test1","event_time":"123456789","action_source":"source123","user_data":{"client_ip_address":"1.2.3.4","client_user_agent":"Test_UA","em":"[email protected]","ph":"123456789","fn":"foo","ln":"bar","ct":"menlopark","st":"ca","zp":"12345","country":"us","ge":"m","db":"19910526","external_id":"user123","subscription_id":"abc123","fbp":"test_browser_id","fbc":"test_click_id"},"custom_data":{"currency":"USD","value":"123","search_string":"query123","order_id":"order_123","content_category":"testCategory","content_name":"Foo","content_type":"product","contents":[{"id":"123","quantity":2},{"id":"456","quantity":2}],"num_items":"4","predicted_ltv":"10000","status":"subscribed","delivery_category":"home_delivery"}}],"partner_agent":"gtmss-1.0.0-0.0.4","test_event_code":"test123"}"), but it was not.

Please advise.

Universal Analytics compatibility

if Universal Analytics instead of GA4 tags are used to send requests to the server-side container, simple tracking for pageviews and even most events is possible (when the UA event action is named properly). But as UA does not allow to send individual event parameters like GA4 there is no way to set the "value" for the "Purchase" event. The information still exists in the event model when using UA but is called 'x-ga-mp1-tr'. Getting the value from eventModel.value || eventModel['x-ga-mp1-tr'] would at least allow some data to get through when a UA purcase e-commerce event hits the server container.

Feature request: have the Tag template rewrite the FB cookies

To help work with ITP's restrictions on JavaScript-set cookies, it would be useful if the Tag template rewrote the _fbc and _fbp cookies (if available in the request OR if fbclid is in the page location) in the HTTP response.

Tag templates can modify the response as well, so a setCookie() API call with those cookies would help extend the lifetime of FB's cookies especially on Safari and iOS browsers.

Configure user_data to pass for GA4 "view_page" event

Hello,

I have configured GA4 with Conversions API and server-side GTM. Everything works fine, except that "view_page" event is only passing user IP address, Agent and click ID.

I couldn't find any information how I can pass user_data (first name, last name, country, email, phone) to PageView event on Facebook. User data is successfully passed on events like add_to_cart, checkout, etc.

How I can configure this?

Thanks!

user_data variable undefined Tagmanager webserver

Hello,

I set up the FB conversion API with google tag manager and it worked just fine, my only issue is that the user_data is not sending from the tag manager web server to the server, what seems to be the issue?

Hourly Data Freshness instead Real time

I use this tag for sending CAPI requests to Facebook. And I mentioned that in the “Data Freshness” tab of the detailed event view, Facebook shows that data have not come in real-time. But it’s impossible due to how GTM SS works itself. All data go to Facebook in real-time.

I checked few GTM SS -> CAPI installations, and all of them have this issue.

Is there are any options to fix this?
Maybe any thought on why Facebook thinks that data not sent in real time?

Data Freshness

Official guide refers to x-fb-event_id but template expects event_id

The guide at https://developers.facebook.com/docs/marketing-api/conversions-api/guides/gtm-server-side refers to x-fb-event_id being the GA4 event parameter name but this line makes me think it should be just event_id:

event.event_id = eventModel.event_id;

For instance, with this GTM config:

Google Tag Manager 2021-11-29 at 3 48 20 PM

I see this in the server side GTM debugger:

Tag Manager Debug Mode 2021-11-29 at 3 49 23 PM

When I use x-fb-event_id as the param name in GTM, I don't see any event_id in the server side GTM debugger.

Deduplication event_id 0%

Hello.
I'm sorry, but I don't know what to do.
We use ConversionsAPI-Tag-for-GoogleTagManager to send events through the server.
All accounts are getting a deduplication error. It repeats again and again after marking it as "resolved" in the pixel.
image

There were no problems before 2021-10-22.
I don't understand why this is happening. We pass evenID and event_id to the deduplication parameters.
When we run debugging through pixel to we see that events are deduplicated.
image

But Facebook keeps showing this error and in the cluster the deduplication shows 0% for the server.
image

Maybe the problem is with facebook, but I'm not sure.
Can you tell me what the problem is ?
Do you also have this problem?

Normalization of first/last name before hashing

I have encountered an issue relating to normalization of customer information before hashing.

I sent customer information (i.e., first name) in an event (let's say Purchase) using both pixel and Conversion API. For Conversion API, I used Facebook Conversions API Tag template (https://github.com/facebookincubator/ConversionsAPI-Tag-for-GoogleTagManager).
I found that the hashed string from pixel is different from the one from Facebook Conversions API Tag template.
For example, if the first name is "a b" (notice the space between the 2 letters), the hashed string from pixel is c8687a08aa5d6ed2044328fa6a697ab8e96dc34291e8c2034ae8c38e6fcc6d65 and the one from the template is fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603.
I think the reason is because pixel removes all spaces in the first name before hashing while the template only removes the leading and trailing spaces.

image

Could you tell me which normalization process is correct?
Does the first name after being hashed without removing the space affect Facebook retargeting?

Thank you.

Rogue Purchase Events Fired in GTM Server Container

For one of the clients we've set up the GTM server integration for a Shopify site. When testing tag fires, we noted a Purchase event was being received by GTM server container on ViewContent & InitiateCheckout events, even though the Purchase tag wasn't fired on the GTM web container. I've double-checked this myself, and even showed it to the FB solutions engineer for Southern Europe, and we cannot figure out how / why this is happening.

Naturally our first suspicion was Shopify, but we've even disconnected the Shopify integration, just to be sure even though Shopify was never given the server container transport URL. Unsurprisingly, the error still persists.

Happy to share details in private or via the Direct Support for CAPI. This feels more like a GTM bug than a Facebook integration bug, but I'm not sure we can get any direct support from Google on this.

After creating tag based on template the tag is not shown in GTM

I uploaded the template and tried to create a tag with a testcode, started testing the GTM setup, so far so good.

I wanted to finalize the setup by removing the testcode from the testfield. But the whole new tag created, based on this template, is not te be found. I can only edit the template.
I assume that the tag is somewhere in the GTM system as the data is still arriving in the facebook test environment.

Can you confirm this is also happening on your part?

Feature Request: phone number parsing from E.164

It would be handy to have the tag code strip out the + symbl from E.164 provided phone numbers before hashing.
My rationale is as follows.

The Conversions API wants us to provide phone numbers hashed from a digits-only version e.g.

Example:
Input: US phone number (650)555-1212
Normalized format: 16505551212

but the common event data model expects E.164 format with the + symbol included.

This means that when we push data around the datalayer, event parameters etc. we need to have a custom variable that formats the number for the Conversion API alone adding in unnecessary steps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.