Skip to content

Instantly share code, notes, and snippets.

@rsiddle
Last active February 3, 2021 18:56
Show Gist options
  • Select an option

  • Save rsiddle/d55799b99bbea8616a6cd11040f6745d to your computer and use it in GitHub Desktop.

Select an option

Save rsiddle/d55799b99bbea8616a6cd11040f6745d to your computer and use it in GitHub Desktop.

Revisions

  1. rsiddle revised this gist Sep 7, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions delayed-retargeting.js
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    Using the window.setTimeout function will allow you to hide retargeting cookies and execute them after 45 seconds.
    This helps provide higher quality leads/audience. The example below shows Facebook's pixel tracker.
    It could be used for other pixel tracking services too.
    Case Study @ http://imscalable.com/blog/case-study-retargeting-done-wrong/
    */

    // Facebook Code
  2. rsiddle created this gist Sep 7, 2016.
    22 changes: 22 additions & 0 deletions delayed-retargeting.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    /*
    Description
    Using the window.setTimeout function will allow you to hide retargeting cookies and execute them after 45 seconds.
    This helps provide higher quality leads/audience. The example below shows Facebook's pixel tracker.
    It could be used for other pixel tracking services too.
    */

    // Facebook Code
    !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','//connect.facebook.net/en_US/fbevents.js');

    fbq('init', 'YOUR_PIXEL_ID_HERE');
    fbq('track', 'PageView');

    // 45 Second Delay Code (45,000 milliseconds)
    window.setTimeout(function() {
    fbq('track', 'Lead');
    // Note: Add other pixel triggers here.
    }, 45000);