Метрика / Передавать покупки (интеграция ecommerce)

remotes/origin/feature/ecommerce-gtag
gzbender 6 years ago
parent ed61abe549
commit 5b9c942450
  1. 9
      apps/course/templates/course/course.html
  2. 12
      project/templates/blocks/lil_store_js.html
  3. 38
      web/package.json
  4. 13
      web/src/js/modules/gtag.js

@ -395,4 +395,13 @@
{% block foot %} {% block foot %}
{% include "templates/blocks/popup_course_buy.html" %} {% include "templates/blocks/popup_course_buy.html" %}
<script type="text/javascript" src="{% static 'course.js' %}"></script> <script type="text/javascript" src="{% static 'course.js' %}"></script>
<script>
window.LIL_STORE.data.gtagProduct = {
id: +'{{ course.id }}',
name: '{{ course.title }}',
category: 'course',
quantity: 1,
price: +'{{ course.price|default:0 }}',
};
</script>
{% endblock foot %} {% endblock foot %}

@ -22,6 +22,9 @@
}, },
components: {}, components: {},
urls: { urls: {
course: /\/course\/\d+\/,
courseBuy: /course\/\d+\/checkout/,
courseBuySuccess: "{% url 'course_payment_success' %}",
courses: "{% url 'courses' %}", courses: "{% url 'courses' %}",
courseEdit: /\/course\/\d+\/edit/, courseEdit: /\/course\/\d+\/edit/,
courseCreate: "{% url 'course_create' %}", courseCreate: "{% url 'course_create' %}",
@ -31,6 +34,15 @@
faq: "{% url 'faq' %}", faq: "{% url 'faq' %}",
contestEdit: /contest\/\w+\/edit/, contestEdit: /contest\/\w+\/edit/,
userGalleryEdit: "{% url 'user-gallery-edit' %}", userGalleryEdit: "{% url 'user-gallery-edit' %}",
school: "{% url 'school:school' %}",
schoolBuy: "{% url 'school-checkout' %}",
schoolBuySuccess: "{% url 'payment-success' %}",
camp: "{% url 'school:drawing-camp' %}",
campBuy: "{% url 'camp-checkout' %}",
campBuySuccess: "{% url 'camp-payment-success' %}",
giftCertificates: "{% url 'gift-certificates' %}",
giftCertificateBuy: /gift-certificate\/\d+\/checkout/,
giftCertificateBuySuccess: /payments\/gift-certificate\/\d+\/success/,
}, },
flags: { flags: {
referrer: '{{ referrer.id|default:'' }}', referrer: '{{ referrer.id|default:'' }}',

@ -10,7 +10,7 @@
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.3.3", "autoprefixer": "^6.3.3",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-loader": "^7.1.2", "babel-loader": "^7.1.5",
"babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
@ -24,13 +24,13 @@
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
"require-dir": "^0.3.0", "require-dir": "^0.3.0",
"run-sequence": "^1.1.5", "run-sequence": "^1.1.5",
"sass-loader": "^7.0.1", "sass-loader": "^7.3.1",
"style-loader": "^0.20.1", "style-loader": "^0.20.1",
"through2": "^2.0.1", "through2": "^2.0.5",
"url-loader": "^0.6.2", "url-loader": "^0.6.2",
"vue-loader": "^14.1.1", "vue-loader": "^14.2.4",
"vue-style-loader": "^3.1.2", "vue-style-loader": "^3.1.2",
"vue-template-compiler": "^2.5.13", "vue-template-compiler": "^2.6.10",
"webpack": "^3.10.0" "webpack": "^3.10.0"
}, },
"dependencies": { "dependencies": {
@ -38,32 +38,32 @@
"autosize-input": "^1.0.2", "autosize-input": "^1.0.2",
"axios": "^0.19.0", "axios": "^0.19.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"baguettebox.js": "^1.10.0", "baguettebox.js": "^1.11.0",
"bowser": "^2.1.2", "bowser": "^2.6.0",
"clipboard": "^2.0.1", "clipboard": "^2.0.4",
"downscale": "^1.0.4", "downscale": "^1.0.6",
"extract-loader": "^3.1.0", "extract-loader": "^3.1.0",
"glob": "^7.1.2", "glob": "^7.1.4",
"history": "^4.7.2", "history": "^4.9.0",
"ilyabirman-likely": "^2.3.0", "ilyabirman-likely": "^2.3.0",
"inputmask": "^3.3.11", "inputmask": "^3.3.11",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.1",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"modal-video": "git+https://github.com/gzbender/modal-video.git", "modal-video": "git+https://github.com/gzbender/modal-video.git",
"moment": "^2.20.1", "moment": "^2.24.0",
"owl.carousel": "^2.2.0", "owl.carousel": "^2.2.0",
"slugify": "^1.2.9", "slugify": "^1.3.5",
"smooth-scroll": "^12.1.5", "smooth-scroll": "^12.1.5",
"sortablejs": "^1.7.0", "sortablejs": "^1.9.0",
"svg-sprite-loader": "^3.7.3", "svg-sprite-loader": "^3.9.2",
"uuid": "^3.2.1", "uuid": "^3.3.3",
"validator": "^9.2.0", "validator": "^9.2.0",
"vue": "^2.5.13", "vue": "^2.6.10",
"vue-autosize": "^1.0.2", "vue-autosize": "^1.0.2",
"vue-awesome-swiper": "^3.1.3", "vue-awesome-swiper": "^3.1.3",
"vue-tags-component": "^1.3.0", "vue-tags-component": "^1.3.0",
"vuedraggable": "^2.16.0", "vuedraggable": "^2.23.0",
"vuejs-datepicker": "^0.9.25", "vuejs-datepicker": "^0.9.25",
"vuelidate": "^0.6.1" "vuelidate": "^0.6.1"
} }

@ -0,0 +1,13 @@
import $ from 'jquery';
$(document).ready(function () {
if(window.LIL_STORE.urlIs(window.LIL_STORE.urls.course)){
const $btn = $('[data-popup=".js-popup-course-buy"]');
$btn.click(() => {
window.gtag('event', 'begin_checkout', {
"items": [window.LIL_STORE.data.gtagProduct],
"coupon": ""
});
});
}
});
Loading…
Cancel
Save