Skip to content

Commit

Permalink
refactor: rename function generateAdditionalInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
hakenprog committed Nov 2, 2023
1 parent 53cabdd commit 40d11e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getSessionID,
urlHasUtmParams,
getUtmParams,
generateAdditionalInfo,
getAdditionalInfo,
isRepeatedEntry,
} from "./utm";
import { ref } from "vue";
Expand All @@ -29,7 +29,7 @@ export default defineNuxtPlugin((nuxtApp) => {

const utmParams = getUtmParams(query);

const additionalInfo = generateAdditionalInfo();
const additionalInfo = getAdditionalInfo();

const timestamp = new Date().toISOString();

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/utm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Ref } from "vue";
import { LocationQuery } from "vue-router";
import { UTMParams, AdditionalInfo, DataObject } from "nuxt-utm";

const generateSessionId = () => {
export const generateSessionId = () => {
return Math.random().toString(36).substring(2, 15);
};

Expand Down Expand Up @@ -50,7 +50,7 @@ export const getUtmParams = (query: LocationQuery) => {
return utmParams;
};

export const generateAdditionalInfo = () => {
export const getAdditionalInfo = () => {
const additionalInfo: AdditionalInfo = {
referrer: document.referrer,
userAgent: navigator.userAgent,
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/basic/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MyModule from "../../../src/module";
import UtmModule from "../../../src/module";

export default defineNuxtConfig({
modules: [MyModule],
modules: [UtmModule],
});

0 comments on commit 40d11e3

Please sign in to comment.