Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

Facebook Pixel, Google Tag manager etc #38

Closed wezzou1 closed 6 years ago

wezzou1 commented 6 years ago

Hi, I wonder how it's work with Google tag manager and facebook pixel in highway? Do you guys have any exempel on that? Would nice to have a simple solution in the documentation like you have with google analytics!

<script>
  !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');
  fbq('init', 'your-pixel-id-goes-here');
  fbq('track', 'PageView');
</script>
<noscript>
  <img height="1" width="1" style="display:none" 
       src="https://www.facebook.com/tr?id=your-pixel-id-goes-here&ev=PageView&noscript=1"/>
</noscript>
ThaoD5 commented 6 years ago

Using google tag manager, you can bind new events in the tag manager himself Here is an article that could help : https://www.analyticsmania.com/post/single-page-web-app-with-google-tag-manager/

Using Analytics and, I guess, the facebook pixel / ... , you have to trigger the page change: https://developers.google.com/analytics/devguides/collection/analyticsjs/pages

Sending the page change event would happen on the NAVIGATE_IN event I guess, we didn't really test an official sending of data etc, but on projects we used Highway, we used the tag manager and it worked without problem :)

ThaoD5 commented 6 years ago

We preferred to not have to manage anything of any analytics because the options are various and custom for each project, also, we didn't find it suited to integrate the support of this in Highway :)

Hope this helped you understand how to work with this :-)

ThaoD5 commented 6 years ago

By the way, we planned to improve the documentation with the infos I am providing you here so that any user can access it and have a path to explore about analytics

wezzou1 commented 6 years ago

@ThaoD5 alright! nice! Would be nice and better for all off us to quick get access to a simple documentation.