Skip to content

Instantly share code, notes, and snippets.

@szepeshazi
Last active February 12, 2018 07:52
Show Gist options
  • Save szepeshazi/e9044825fd5d56bc51870eec22949c75 to your computer and use it in GitHub Desktop.
Save szepeshazi/e9044825fd5d56bc51870eec22949c75 to your computer and use it in GitHub Desktop.
Adding variables from Dart to Google Tag Manager data layer
JsObject dataLayer = context['dataLayer'];
dataLayer ??= new JsObject(context['Array']);
Map<String, dynamic> productInfo = {
'name': '1 month subscription',
'price': 21000,
'currency': 'HUF'
};
dataLayer.callMethod('push', [new JsObject.jsify(productInfo)]);
context['dataLayer'] = dataLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment