I have a one-page javascript application in which I try to implement Advanced Matching using the new Facebook pixel to give us better attribution to our ads.
Right now, we launch the FB pixel when the application loads first, and then trigger standard track events based on user behavior in the application, for example. Buy when the user completes their order.
A simplified view of what is happening below ...
// App loads // URL: xxxx.com/[client]/ !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js'); // Pixel Initialised // we don't know any user details at this stage fbq('init', '[PIXELID]'); fbq('track', 'PageView'); // User selects the event they want to purchase tickets from // URL: xxxx.com/[client]/event/[productid]/ fbq('track', 'PageView'); fbq('track', 'ViewContent', { content_name: 'Store', content_ids: '[productid]', content_type: 'product_group' }); // User goes through rest of purchase process // More Standard Events sent, eg Add To Cart // User completes purchase // URL: xxxx.com/[client]/order/completed/ // At this point we now know email address, name & phone, but pixel is already initialised. How do we do Advanced Matching? fbq('track', 'PageView'); fbq('track', 'Purchase', { content_type: 'Store', value: 75.00, currency: 'USD', num_items: 4, order_id: '20160710090000', });
In the expanded mapping, it is indicated that the fields should be set when the pixel is initialized. However, since we only initialize the pixel once when the application loads (when we donβt know any user details), Iβm not sure how to implement the extended mapping. Initializing the same pixel again causes an error, and there seems to be no way to pass extended matching fields to a track event or a way to reinitialize the pixel.
Has anyone had success using extended matching in a single js application for a page?