Forked from rgoytacaz/AddToCartWithMarketingData.js
Last active
October 10, 2018 23:27
-
-
Save guilhermemarconi/dad9101ac700fbcdbd221729d3d179e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//marketingData Example | |
//vtexjs.checkout.orderForm.marketingData | |
import { getCookie } from 'path/to/cookies.js' | |
utms = { | |
utmCampaign: (getCookie('IPS') && ~getCookie('IPS').indexOf('Campanha') ? getCookie('IPS').split('Campanha=')[1].split('&')[0] : ""), | |
utmMedium: (getCookie('IPS') && ~getCookie('IPS').indexOf('Midia') ? getCookie('IPS').split('Midia=')[1].split('&')[0] : ""), | |
utmSource: (getCookie('IPS') && ~getCookie('IPS').indexOf('Parceiro') ? getCookie('IPS').split('Parceiro=')[1].split('&')[0] : ""), | |
utmiCampaign: (getCookie('ISICI') && ~getCookie('ISICI').indexOf('InternalCampaign') ? getCookie('ISICI').split('InternalCampaign=')[1].split('&')[0] : ""), | |
utmiPart: (getCookie('ISICI') && ~getCookie('ISICI').indexOf('InternalPart') ? getCookie('ISICI').split('InternalPart=')[1].split('&')[0] : "") | |
} | |
//Execute after item was added to the cart. | |
vtexjs.checkout.sendAttachment('marketingData', utms); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment