GithubHelp home page GithubHelp logo

wendyhouserules / marketingformfill Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 21 KB

A Javascript snippet to fill hidden form fields with GA Client ID, source and medium using referrer logic, campaign, and referrer.

License: GNU General Public License v3.0

HTML 27.00% JavaScript 73.00%

marketingformfill's Introduction

Marketing Attribution Form Fill

Javascript snippets to fill hidden form fields with marketing attribution data GA Client ID, source and medium using referrer logic, campaign, and referrer using Google Tag Manager.

Step by step guide:

Create 1st party cookie variables in GTM and set the COokie Name values to the following: MarketingSource: marketingSource MarketingMedium: marketingMedium MarketingReferrer: marketingReferrer MarketingCampaign: marketingCampaign GA Cookie: _ga

Create a custom Javascript variable called GA Client ID and add this code into it:

// Grabs the client ID from our 'GA Cookie' 1st party cookie variable and extracts the Client ID function() { return {{GA Cookie}}.substring(6) }

Create a Custom HTML tag and add in the code in set-marketing-cookies.js Set the trigger to fire on 'DOM Ready' This should now drop cookies with source, medium, campaign, and referrer information. You can check in the browser by using dev tools 'Inspect' and going to the 'Application' tab

Add hidden form fields to your form with the following IDs:

  • msource
  • mmedium
  • mreferrer
  • mcampaign
  • gaclientid

Create a Custom HTML tag and add in the code in form-fill-marketing-vars.js Set the trigger to fire on 'Window Loaded'

Mission Complete - You now have marketing attribution data in your form submissions

marketingformfill's People

Contributors

wendyhouserules avatar

Watchers

 avatar

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.